Skip to content

Release Method #8

@bicoi

Description

@bicoi

Hi,

I have a question related to "release" method of MediaPlayer and Player class.

  1. In MediaPlayer class, when we call release() we will release Player and set this value to null (mPlayer = null).
  2. In Player class we will send message "MSG_STOP" to EventHandler stop other threads,

But EventHandle will handle "MSG_STOP" in another thread, so have a case a command "mPlayer = null" is run while we are processing "MSG_STOP". When "mPlayer = null" is set I think app will be crashed, because we are referencing to mPlayer in EventHandle.

Could you give your advice about this situation? Or I have misunderstood anything?

In the case it has problem, could I use "sendMessageAndAwaitResponse(nMsg)" instead of "mEventHandler.sendMessageAtFrontOfQueue(nMsg)" in release method of Player?

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions