Bug 927245 - Remove deprecated Audio Data API implementation. r=cajbir,smaug

This commit is contained in:
Matthew Gregan
2014-04-03 10:53:39 +13:00
parent 8ae9d19033
commit 8897789e29
54 changed files with 9 additions and 2171 deletions

View File

@@ -197,7 +197,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
mDispatchedRunEvent(false),
mDecodeThreadWaiting(false),
mRealTime(aRealTime),
mEventManager(aDecoder),
mLastFrameStatus(MediaDecoderOwner::NEXT_FRAME_UNINITIALIZED)
{
MOZ_COUNT_CTOR(MediaDecoderStateMachine);
@@ -945,8 +944,6 @@ void MediaDecoderStateMachine::AudioLoop()
ReentrantMonitorAutoExit exit(mDecoder->GetReentrantMonitor());
mAudioStream->Drain();
}
// Fire one last event for any extra frames that didn't fill a framebuffer.
mEventManager.Drain(mAudioEndTime);
}
}
}
@@ -957,7 +954,6 @@ void MediaDecoderStateMachine::AudioLoop()
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mAudioStream->Shutdown();
mAudioStream = nullptr;
mEventManager.Clear();
if (!mAudioCaptured) {
mAudioCompleted = true;
UpdateReadyState();
@@ -979,9 +975,6 @@ uint32_t MediaDecoderStateMachine::PlaySilence(uint32_t aFrames,
uint32_t maxFrames = SILENCE_BYTES_CHUNK / aChannels / sizeof(AudioDataValue);
uint32_t frames = std::min(aFrames, maxFrames);
WriteSilence(mAudioStream, frames);
// Dispatch events to the DOM for the audio just written.
mEventManager.QueueWrittenAudioData(nullptr, frames * aChannels,
(aFrameOffset + frames) * aChannels);
return frames;
}
@@ -1014,10 +1007,6 @@ uint32_t MediaDecoderStateMachine::PlayFromAudioQueue(uint64_t aFrameOffset,
offset = audio->mOffset;
frames = audio->mFrames;
// Dispatch events to the DOM for the audio just written.
mEventManager.QueueWrittenAudioData(audio->mAudioData.get(),
audio->mFrames * aChannels,
(aFrameOffset + frames) * aChannels);
if (offset != -1) {
mDecoder->UpdatePlaybackOffset(offset);
}
@@ -1142,9 +1131,6 @@ void MediaDecoderStateMachine::UpdatePlaybackPosition(int64_t aTime)
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
}
// Notify DOM of any queued up audioavailable events
mEventManager.DispatchPendingEvents(GetMediaTime());
mMetadataManager.DispatchMetadataIfNeeded(mDecoder, aTime);
if (fragmentEnded) {
@@ -1776,14 +1762,6 @@ bool MediaDecoderStateMachine::HasLowUndecodedData(double aUsecs) const
return stream->GetCachedDataEnd(currentPos) < requiredPos;
}
void MediaDecoderStateMachine::SetFrameBufferLength(uint32_t aLength)
{
NS_ASSERTION(aLength >= 512 && aLength <= 16384,
"The length must be between 512 and 16384");
AssertCurrentThreadInMonitor();
mEventManager.SetSignalBufferLength(aLength);
}
void
MediaDecoderStateMachine::DecodeError()
{
@@ -1887,19 +1865,7 @@ nsresult MediaDecoderStateMachine::DecodeMetadata()
mLowAudioThresholdUsecs /= NO_VIDEO_AMPLE_AUDIO_DIVISOR;
}
// Inform the element that we've loaded the metadata and the first frame,
// setting the default framebuffer size for audioavailable events. Also,
// if there is audio, let the MozAudioAvailable event manager know about
// the metadata.
if (HasAudio()) {
mEventManager.Init(mInfo.mAudio.mChannels, mInfo.mAudio.mRate);
// Set the buffer length at the decoder level to be able, to be able
// to retrive the value via media element method. The RequestFrameBufferLength
// will call the MediaDecoderStateMachine::SetFrameBufferLength().
uint32_t frameBufferLength = mInfo.mAudio.mChannels * FRAMEBUFFER_LENGTH_PER_CHANNEL;
mDecoder->RequestFrameBufferLength(frameBufferLength);
}
// Inform the element that we've loaded the metadata and the first frame.
nsCOMPtr<nsIRunnable> metadataLoadedEvent =
new AudioMetadataEventRunner(mDecoder,
mInfo.mAudio.mChannels,
@@ -2852,12 +2818,6 @@ nsIEventTarget* MediaDecoderStateMachine::GetStateMachineThread()
return mStateMachineThreadPool->GetEventTarget();
}
void MediaDecoderStateMachine::NotifyAudioAvailableListener()
{
AssertCurrentThreadInMonitor();
mEventManager.NotifyAudioAvailableListener();
}
void MediaDecoderStateMachine::SetPlaybackRate(double aPlaybackRate)
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");