×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2007
    Location
    Spain
    Posts
    15

    KERN-EXEC 0 when calling PauseL method of CVideoPlayerUtility from another thread

    KERN-EXEC 0 when calling PauseL method of CVideoPlayerUtility from another thread

    I got a KERN-EXEC 0 panic when I try to call the PauseL method of a CVideoPlayerUtility from a thread different from the thread that created the object (the GUI thread). The main structure of my code is the following:


    ------------------------------------------------------------------------


    class CMediaEngine : public CBase, public MVideoPlayerUtilityObserver {
    private:
    CVideoPlayerUtility* iPlayer;
    }
    void CMediaEngine::InitControllerL(TDes& aVideoAddr)
    {
    iPlayer = NULL;
    iPlayer = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
    EMdaPriorityPreferenceNone,
    iView->ClientWsSession(),
    iView->ScreenDevice(),
    iView->ClientWindow(),
    iView->VideoRect(),
    iView->VideoRect());
    iPlayer->OpenUrlL(aVideoAddr);
    }


    void CMediaEngine ::PauseL()
    {
    iPlayer->PauseL(); //-------> the execution reaches this and then crashes
    }

    ------------------------------------------------------------------------
    In my view class:


    void CVPAPLAYERContainerView::DoActivateL(
    ...

    iAppUi->container = CMediaContainer::NewL(ClientRect());
    iAppUi->engine = CMediaEngine::NewL(iAppUi->container);
    iAppUi->engine->InitControllerL(iAppUi->url);
    ...
    }

    ------------------------------------------------------------------------
    The thread that I call pause from:

    User::LeaveIfError(iThd1->Create(_L("WaitForPause"),
    threadFunc1,KDefaultStackSize,NULL,arg));
    iThd1->Resume();

    TInt CVPAPLAYERAppUi::threadFunc1(TAny* t){
    ((CVPAPLAYERAppUi*) t)->WaitingPause();
    return(0);
    }

    void CVPAPLAYERAppUi::WaitingPause(){
    engine->PauseL(); //-------> the fatal call, after this, engine tries to access its CVideoPlayerUtility attribute and crashes in the place shown before
    }
    ------------------------------------------------------------------------


    I know the error has something to do with that thread not being able to find the CVideoPlayerUtility object but I don't know how to fix it.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: KERN-EXEC 0 when calling PauseL method of CVideoPlayerUtility from another threa

    In Symbian environment almost everything is thread-specific by default. Some R-classes (inheriting from RSessionBase) have Share/ShareAuto methods, but complex multimedia classes usually do not support this possibility.
    However in this case, you can implement an Active Object in your main thread (simply invoking PauseL in its RunL method), and signal it from your other thread (get the RThread::Id in the main thread - when you simply instantiate an RThread object, it represents the current thread -, and RThread::Open it in the secondary. Then you can use RThread::RequestComplete).

  3. #3
    Registered User
    Join Date
    Sep 2007
    Location
    Spain
    Posts
    15

    Re: KERN-EXEC 0 when calling PauseL method of CVideoPlayerUtility from another threa

    It worked, thank you. Now my code is like this:

    --------------------------------------------------------
    MediaEngine.h

    class CMediaEngine : public CBase,public CActive, public MVideoPlayerUtilityObserver{
    ...
    CVideoPlayerUtility* iPlayer;
    void RunL();
    TThreadId mainTThreadId;
    ...
    }

    --------------------------------------------------------
    MediaEngine.cpp

    CMediaEngine::CMediaEngine (TThreadId aMainThreadId) :iPlayer(NULL),CActive(CActive::EPriorityStandard)
    {
    mainThreadId=aMainThreadId;
    }

    void CMediaEngine ::PauseL()
    {
    RThread mainThread;
    TInt resOpen=mainThread.Open(this->mainThreadId);
    TRequestStatus* status=&iStatus;
    if (!IsActive() {
    SetActive();
    }
    mainThread.RequestComplete(status,KErrNone);
    }

    void CMediaEngine::RunL(){
    iPlayer->PauseL();
    }
    --------------------------------------------------------
    Where I create the CMediaEngine object:

    RThread mainThread;
    TThreadId mainThreadId=mainThread.Id();
    iAppUi->engine =CMediaEngine::NewL(iAppUi->container,mainThreadId);
    --------------------------------------------------------

    Finally, in the new thread:
    iAppUi->engine->PauseL();

Similar Threads

  1. Replies: 6
    Last Post: 2007-03-01, 18:19
  2. System crash while calling insertL() from another thread
    By matlev in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-02-28, 18:28
  3. Link errors when trying to Display bitmap
    By Bkc82 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-01-16, 22:46
  4. Thread function not being called
    By kamalsinghania in forum Symbian
    Replies: 5
    Last Post: 2006-01-04, 12:28
  5. problem with calling method of MyAppUI.cpp
    By chishti.hameed in forum Symbian
    Replies: 4
    Last Post: 2005-07-08, 12:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×