mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1199121. Part 1 - add the ability to handle video-only streams to AudioSinkWrapper. r=kinetik. (dcb3ff91b) - Bug 1199121. Part 2 - handle the case where audio ends before video and switch to system clock for calculating playback position. r=kinetik. (6760286f5) - Bug 1199121. Part 3 - remove unused code. r=kinetik. (2bc6494ff) - Bug 1187315 - Refactor out Constraints.webidl. r=bz (d0b80419b) - Bug 1200099. Ensure mSameOriginMedia is propagated to DecodedStream even if we don't get a watch notification. r=jwwang (76e66bcb7) - bug 962719 update NextFrameStatus() on finished notification r=roc (74f281f6c) - Bug 1200208 - Send the audio-playback notification when the page calls HTMLMediaElement::Play() before the metadata has been fully loaded; r=baku (ddeabce54) - Bug 1200673 - Try to create the audio channel agent in the constructor for AutoNotifyAudioChannelAgent too; r=baku (5027e28d3) - Bug 1184292 - Remove some Wakelock warning messages when unlocking. r=smaug (694622bb3) - bug 1196632 pass ownership of runnables to NS_DispatchToMainThread r=jesup (797e0042b) - bug 1198100 remove mNotificationMainThreadRunnable r=baku (8301016d0) - Bug 1027864 - webaudio - Implement AudioChunk::IsSilentOrSubnormal(), r=karlt (a59243929) - bug 1186779 add a method to cast AudioChunk data for writing when not shared r=padenot (bbe37c740) - Bug 1118372 - Properly apply volume in WaveShaperNodeEngine. r=padenot (d3bbd6aee) - bug 1186779 use ChannelFloatsForWrite() instead of const_cast r=padenot (3f148dea4) - bug 1196109 keep memory allocation for mixed input channel pointer array r=padenot (9ed44e6ca) - bug 1197028 release shared buffers from downstream so that upstream can re-use r=padenot (fabdd44e1) - bug 1190291 move mNextStateComputedTime to local variable r=padenot (d59e1de17) - bug 1190291 don't process blocks beyond aTicksToProcess in an offline graph r=padenot (76daca5cb) - Bug 1183883 - Switch graph thread slowdown warning to log message. r=padenot (3a268d8ee) - bug 962719 move mStateComputedTime to MediaStreamGraphImpl r=padenot (e233a7e7c) - Bug 1163585 - Small improvement of the use of nsTArray in MSG::UpdateCurrentTimeForStreams, r=padenot (b88ca2599) - Bug 1163597 - MediaStreamGraphImpl::RecomputeBlockingAt: optimization in the number of loops for the mStreams array, r=padenot (06ecdd5c7) - Bug 1163597 - patch 2 - MediaStreamGraphImpl::RecomputeBlockingAt CLOSED TREE (e3642ccc5)
This commit is contained in:
@@ -340,6 +340,9 @@ MediaDecoderStateMachine::InitializationTask()
|
||||
mWatchManager.Watch(mPlayState, &MediaDecoderStateMachine::PlayStateChanged);
|
||||
mWatchManager.Watch(mLogicallySeeking, &MediaDecoderStateMachine::LogicallySeekingChanged);
|
||||
mWatchManager.Watch(mSameOriginMedia, &MediaDecoderStateMachine::SameOriginMediaChanged);
|
||||
|
||||
// Propagate mSameOriginMedia to mDecodedStream.
|
||||
SameOriginMediaChanged();
|
||||
}
|
||||
|
||||
bool MediaDecoderStateMachine::HasFutureAudio()
|
||||
@@ -1752,15 +1755,17 @@ MediaDecoderStateMachine::StartAudioSink()
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasAudio() && !mAudioSink->IsStarted()) {
|
||||
if (!mAudioSink->IsStarted()) {
|
||||
mAudioCompleted = false;
|
||||
mAudioSink->Start(GetMediaTime(), mInfo);
|
||||
|
||||
mAudioSinkPromise.Begin(
|
||||
mAudioSink->OnEnded(TrackInfo::kAudioTrack)->Then(
|
||||
auto promise = mAudioSink->OnEnded(TrackInfo::kAudioTrack);
|
||||
if (promise) {
|
||||
mAudioSinkPromise.Begin(promise->Then(
|
||||
OwnerThread(), __func__, this,
|
||||
&MediaDecoderStateMachine::OnAudioSinkComplete,
|
||||
&MediaDecoderStateMachine::OnAudioSinkError));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2534,31 +2539,6 @@ void MediaDecoderStateMachine::RenderVideoFrames(int32_t aMaxFrames,
|
||||
container->SetCurrentFrames(frames[0]->As<VideoData>()->mDisplay, images);
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::ResyncAudioClock()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (IsPlaying()) {
|
||||
SetPlayStartTime(TimeStamp::Now());
|
||||
mPlayDuration = GetAudioClock();
|
||||
}
|
||||
}
|
||||
|
||||
int64_t
|
||||
MediaDecoderStateMachine::GetAudioClock() const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
// We must hold the decoder monitor while using the audio stream off the
|
||||
// audio sink to ensure that it doesn't get destroyed on the audio sink
|
||||
// while we're using it.
|
||||
AssertCurrentThreadInMonitor();
|
||||
MOZ_ASSERT(HasAudio() && !mAudioCompleted && IsPlaying());
|
||||
// Since this function is called while we are playing and AudioSink is
|
||||
// started once playback starts, IsStarted() is guaranteed to be true.
|
||||
MOZ_ASSERT(mAudioSink->IsStarted());
|
||||
return mAudioSink->GetPosition();
|
||||
}
|
||||
|
||||
int64_t MediaDecoderStateMachine::GetStreamClock() const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
@@ -2566,22 +2546,6 @@ int64_t MediaDecoderStateMachine::GetStreamClock() const
|
||||
return mDecodedStream->GetPosition();
|
||||
}
|
||||
|
||||
int64_t MediaDecoderStateMachine::GetVideoStreamPosition(TimeStamp aTimeStamp) const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (!IsPlaying()) {
|
||||
return mPlayDuration;
|
||||
}
|
||||
|
||||
// Time elapsed since we started playing.
|
||||
int64_t delta = DurationToUsecs(aTimeStamp - mPlayStartTime);
|
||||
// Take playback rate into account.
|
||||
delta *= mPlaybackRate;
|
||||
return mPlayDuration + delta;
|
||||
}
|
||||
|
||||
int64_t MediaDecoderStateMachine::GetClock(TimeStamp* aTimeStamp) const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
@@ -2598,12 +2562,8 @@ int64_t MediaDecoderStateMachine::GetClock(TimeStamp* aTimeStamp) const
|
||||
} else {
|
||||
if (mAudioCaptured) {
|
||||
clock_time = GetStreamClock();
|
||||
} else if (HasAudio() && !mAudioCompleted) {
|
||||
clock_time = GetAudioClock();
|
||||
} else {
|
||||
t = TimeStamp::Now();
|
||||
// Audio is disabled on this system. Sync to the system clock.
|
||||
clock_time = GetVideoStreamPosition(t);
|
||||
clock_time = mAudioSink->GetPosition(&t);
|
||||
}
|
||||
NS_ASSERTION(GetMediaTime() <= clock_time, "Clock should go forwards.");
|
||||
}
|
||||
@@ -2979,17 +2939,6 @@ MediaDecoderStateMachine::LogicalPlaybackRateChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
// AudioStream will handle playback rate change when we have audio.
|
||||
// Do nothing while we are not playing. Change in playback rate will
|
||||
// take effect next time we start playing again.
|
||||
if (!HasAudio() && IsPlaying()) {
|
||||
// Remember how much time we've spent in playing the media
|
||||
// for playback rate will change from now on.
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
mPlayDuration = GetVideoStreamPosition(now);
|
||||
SetPlayStartTime(now);
|
||||
}
|
||||
|
||||
mPlaybackRate = mLogicalPlaybackRate;
|
||||
mAudioSink->SetPlaybackRate(mPlaybackRate);
|
||||
|
||||
@@ -3030,7 +2979,6 @@ void MediaDecoderStateMachine::OnAudioSinkComplete()
|
||||
MOZ_ASSERT(!mAudioCaptured, "Should be disconnected when capturing audio.");
|
||||
|
||||
mAudioSinkPromise.Complete();
|
||||
ResyncAudioClock();
|
||||
mAudioCompleted = true;
|
||||
}
|
||||
|
||||
@@ -3041,7 +2989,6 @@ void MediaDecoderStateMachine::OnAudioSinkError()
|
||||
MOZ_ASSERT(!mAudioCaptured, "Should be disconnected when capturing audio.");
|
||||
|
||||
mAudioSinkPromise.Complete();
|
||||
ResyncAudioClock();
|
||||
mAudioCompleted = true;
|
||||
|
||||
// Make the best effort to continue playback when there is video.
|
||||
|
||||
Reference in New Issue
Block a user