Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[sailfishos][media] Update media resource state when the playing stat…
…e changes for any reason. Fixes JB#42900
  • Loading branch information
denexter authored and rainemak committed May 27, 2020
1 parent 9e2dc6c commit 50fc4fa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dom/media/MediaDecoder.cpp
Expand Up @@ -39,6 +39,8 @@
#include "AndroidBridge.h"
#endif

#include "NemoResourceHandler.h"

using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::media;
Expand Down Expand Up @@ -824,6 +826,8 @@ MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!IsShutdown());

NemoResourceHandler::MediaInfo(this, aInfo->HasAudio(), aInfo->HasVideo());

DECODER_LOG("MetadataLoaded, channels=%u rate=%u hasAudio=%d hasVideo=%d",
aInfo->mAudio.mChannels, aInfo->mAudio.mRate,
aInfo->HasAudio(), aInfo->HasVideo());
Expand Down Expand Up @@ -1209,6 +1213,14 @@ MediaDecoder::ChangeState(PlayState aState)
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!IsShutdown(), "SHUTDOWN is the final state.");

if (mPlayState != aState) {
if (mPlayState == PLAY_STATE_PLAYING) {
NemoResourceHandler::ReleaseResources(this);
} else if (aState == PLAY_STATE_PLAYING) {
NemoResourceHandler::AquireResources(this);
}
}

if (mNextState == aState) {
mNextState = PLAY_STATE_PAUSED;
}
Expand Down

0 comments on commit 50fc4fa

Please sign in to comment.