mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 952389. Part 2: When all streams in the MSG are blocked, allow the MSG to suspend indefinitely and pause AudioStream outputs while suspended. r=padenot
This commit is contained in:
parent
c16d623fd5
commit
270ee7e65f
@ -1116,6 +1116,28 @@ MediaStreamGraphImpl::AllFinishedStreamsNotified()
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
MediaStreamGraphImpl::PauseAllAudioOutputs()
|
||||
{
|
||||
for (uint32_t i = 0; i < mStreams.Length(); ++i) {
|
||||
MediaStream* s = mStreams[i];
|
||||
for (uint32_t j = 0; j < s->mAudioOutputStreams.Length(); ++j) {
|
||||
s->mAudioOutputStreams[j].mStream->Pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaStreamGraphImpl::ResumeAllAudioOutputs()
|
||||
{
|
||||
for (uint32_t i = 0; i < mStreams.Length(); ++i) {
|
||||
MediaStream* s = mStreams[i];
|
||||
for (uint32_t j = 0; j < s->mAudioOutputStreams.Length(); ++j) {
|
||||
s->mAudioOutputStreams[j].mStream->Resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaStreamGraphImpl::RunThread()
|
||||
{
|
||||
@ -1180,7 +1202,6 @@ MediaStreamGraphImpl::RunThread()
|
||||
RecomputeBlocking(endBlockingDecisions);
|
||||
|
||||
// Play stream contents.
|
||||
uint32_t audioStreamsActive = 0;
|
||||
bool allBlockedForever = true;
|
||||
// True when we've done ProduceOutput for all processed streams.
|
||||
bool doneAllProducing = false;
|
||||
@ -1221,7 +1242,6 @@ MediaStreamGraphImpl::RunThread()
|
||||
// Only playback audio and video in real-time mode
|
||||
CreateOrDestroyAudioStreams(prevComputedTime, stream);
|
||||
PlayAudio(stream, prevComputedTime, mStateComputedTime);
|
||||
audioStreamsActive += stream->mAudioOutputStreams.Length();
|
||||
PlayVideo(stream);
|
||||
}
|
||||
SourceMediaStream* is = stream->AsSourceStream();
|
||||
@ -1233,7 +1253,7 @@ MediaStreamGraphImpl::RunThread()
|
||||
allBlockedForever = false;
|
||||
}
|
||||
}
|
||||
if (ensureNextIteration || !allBlockedForever || audioStreamsActive > 0) {
|
||||
if (ensureNextIteration || !allBlockedForever) {
|
||||
EnsureNextIteration();
|
||||
}
|
||||
|
||||
@ -1261,6 +1281,7 @@ MediaStreamGraphImpl::RunThread()
|
||||
if (mRealtime) {
|
||||
PRIntervalTime timeout = PR_INTERVAL_NO_TIMEOUT;
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
bool pausedOutputs = false;
|
||||
if (mNeedAnotherIteration) {
|
||||
int64_t timeoutMS = MEDIA_GRAPH_TARGET_PERIOD_MS -
|
||||
int64_t((now - mCurrentTimeStamp).ToMilliseconds());
|
||||
@ -1273,6 +1294,8 @@ MediaStreamGraphImpl::RunThread()
|
||||
mWaitState = WAITSTATE_WAITING_FOR_NEXT_ITERATION;
|
||||
} else {
|
||||
mWaitState = WAITSTATE_WAITING_INDEFINITELY;
|
||||
PauseAllAudioOutputs();
|
||||
pausedOutputs = true;
|
||||
}
|
||||
if (timeout > 0) {
|
||||
mMonitor.Wait(timeout);
|
||||
@ -1280,6 +1303,9 @@ MediaStreamGraphImpl::RunThread()
|
||||
(TimeStamp::Now() - mInitialTimeStamp).ToSeconds(),
|
||||
(TimeStamp::Now() - now).ToSeconds()));
|
||||
}
|
||||
if (pausedOutputs) {
|
||||
ResumeAllAudioOutputs();
|
||||
}
|
||||
}
|
||||
mWaitState = WAITSTATE_RUNNING;
|
||||
mNeedAnotherIteration = false;
|
||||
|
@ -370,6 +370,14 @@ public:
|
||||
{
|
||||
mStreamOrderDirty = true;
|
||||
}
|
||||
/**
|
||||
* Pause all AudioStreams being written to by MediaStreams
|
||||
*/
|
||||
void PauseAllAudioOutputs();
|
||||
/**
|
||||
* Resume all AudioStreams being written to by MediaStreams
|
||||
*/
|
||||
void ResumeAllAudioOutputs();
|
||||
|
||||
// Data members
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user