mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 08:35:26 +00:00
Bug 1123535 - Don't hold decoder monitor while calling PreReadMetadata. r=kentuckyfriedtakahe
This commit is contained in:
parent
4c110c41a5
commit
90912c2e6f
@ -1578,9 +1578,9 @@ void MediaDecoderStateMachine::StartDecoding()
|
||||
|
||||
void MediaDecoderStateMachine::StartWaitForResources()
|
||||
{
|
||||
NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(),
|
||||
"Should be on state machine or decode thread.");
|
||||
AssertCurrentThreadInMonitor();
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
NS_ASSERTION(OnDecodeThread(),
|
||||
"Should be on decode thread.");
|
||||
SetState(DECODER_STATE_WAIT_FOR_RESOURCES);
|
||||
DECODER_LOG("StartWaitForResources");
|
||||
}
|
||||
@ -2179,29 +2179,29 @@ nsresult MediaDecoderStateMachine::DecodeMetadata()
|
||||
MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA);
|
||||
DECODER_LOG("Decoding Media Headers");
|
||||
|
||||
nsresult res;
|
||||
MediaInfo info;
|
||||
bool isAwaitingResources = false;
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
mReader->PreReadMetadata();
|
||||
|
||||
if (mReader->IsWaitingMediaResources()) {
|
||||
StartWaitForResources();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult res;
|
||||
MediaInfo info;
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
res = mReader->ReadMetadata(&info, getter_Transfers(mMetadataTags));
|
||||
isAwaitingResources = mReader->IsWaitingMediaResources();
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
if (mState == DECODER_STATE_DECODING_METADATA &&
|
||||
mReader->IsWaitingMediaResources()) {
|
||||
if (NS_SUCCEEDED(res) &&
|
||||
mState == DECODER_STATE_DECODING_METADATA &&
|
||||
isAwaitingResources) {
|
||||
// change state to DECODER_STATE_WAIT_FOR_RESOURCES
|
||||
StartWaitForResources();
|
||||
// affect values only if ReadMetadata succeeds
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
mDecoder->SetMediaSeekable(mReader->IsMediaSeekable());
|
||||
|
Loading…
Reference in New Issue
Block a user