MediaDecoderStateMachine* MediaSourceDecoder::CreateStateMachine() { MOZ_ASSERT(NS_IsMainThread()); mDemuxer = new MediaSourceDemuxer(); mReader = new MediaFormatReader(this, mDemuxer, GetVideoFrameContainer()); return new MediaDecoderStateMachine(this, mReader); }
MediaDecoderStateMachine* MP4Decoder::CreateStateMachine() { mReader = new MediaFormatReader(this, new MP4Demuxer(GetResource()), GetVideoFrameContainer()); return new MediaDecoderStateMachine(this, mReader); }
MediaDecoderStateMachine* OggDecoder::CreateStateMachine() { RefPtr<OggDemuxer> demuxer = new OggDemuxer(GetResource()); RefPtr<MediaFormatReader> reader = new MediaFormatReader(this, demuxer, GetVideoFrameContainer()); demuxer->SetChainingEvents(&reader->TimedMetadataProducer(), &reader->MediaNotSeekableProducer()); return new MediaDecoderStateMachine(this, reader); }
double HTMLVideoElement::MozFrameDelay() { MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread."); VideoFrameContainer* container = GetVideoFrameContainer(); // Hide negative delays. Frame timing tweaks in the compositor (e.g. // adding a bias value to prevent multiple dropped/duped frames when // frame times are aligned with composition times) may produce apparent // negative delay, but we shouldn't report that. return container ? std::max(0.0, container->GetFrameDelay()) : 0.0; }
MediaDecoderStateMachine* ChannelMediaDecoder::CreateStateMachine() { MOZ_ASSERT(NS_IsMainThread()); MediaFormatReaderInit init; init.mVideoFrameContainer = GetVideoFrameContainer(); init.mKnowsCompositor = GetCompositor(); init.mCrashHelper = GetOwner()->CreateGMPCrashHelper(); init.mFrameStats = mFrameStats; init.mResource = mResource; mReader = DecoderTraits::CreateReader(ContainerType(), init); return new MediaDecoderStateMachine(this, mReader); }
double HTMLVideoElement::MozFrameDelay() { MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread."); VideoFrameContainer* container = GetVideoFrameContainer(); return container ? container->GetFrameDelay() : 0; }
MediaDecoderStateMachine* WebMDecoder::CreateStateMachine() { bool useFormatDecoder = Preferences::GetBool("media.format-reader.webm", true); RefPtr<MediaDecoderReader> reader = useFormatDecoder ? static_cast<MediaDecoderReader*>(new MediaFormatReader(this, new WebMDemuxer(GetResource()), GetVideoFrameContainer())) : new WebMReader(this); return new MediaDecoderStateMachine(this, reader); }
MediaDecoderStateMachine* WebMDecoder::CreateStateMachine() { RefPtr<MediaDecoderReader> reader = new MediaFormatReader(this, new WebMDemuxer(GetResource()), GetVideoFrameContainer()); return new MediaDecoderStateMachine(this, reader); }