already_AddRefed<MediaDataDecoder> AppleDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) { RefPtr<MediaDataDecoder> decoder = new AppleATDecoder(aParams.AudioConfig(), aParams.mTaskQueue); return decoder.forget(); }
already_AddRefed<MediaDataDecoder> GonkDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) { RefPtr<MediaDataDecoder> decoder = new GonkMediaDataDecoder(new GonkAudioDecoderManager(aParams.AudioConfig()), aParams.mCallback); return decoder.forget(); }
// Decode thread. already_AddRefed<MediaDataDecoder> CreateAudioDecoder(const CreateDecoderParams& aParams) override { const AudioInfo& config = aParams.AudioConfig(); BlankAudioDataCreator* creator = new BlankAudioDataCreator( config.mChannels, config.mRate); RefPtr<MediaDataDecoder> decoder = new BlankMediaDataDecoder<BlankAudioDataCreator>(creator, aParams); return decoder.forget(); }
VorbisDataDecoder::VorbisDataDecoder(const CreateDecoderParams& aParams) : mInfo(aParams.AudioConfig()) , mTaskQueue(aParams.mTaskQueue) , mPacketCount(0) , mFrames(0) { // Zero these member vars to avoid crashes in Vorbis clear functions when // destructor is called before |Init|. PodZero(&mVorbisBlock); PodZero(&mVorbisDsp); PodZero(&mVorbisInfo); PodZero(&mVorbisComment); }
already_AddRefed<MediaDataDecoder> WMFDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) { nsAutoPtr<WMFAudioMFTManager> manager(new WMFAudioMFTManager(aParams.AudioConfig())); if (!manager->Init()) { return nullptr; } RefPtr<MediaDataDecoder> decoder = new WMFMediaDataDecoder(manager.forget(), aParams.mTaskQueue, aParams.mCallback); return decoder.forget(); }
already_AddRefed<MediaDataDecoder> AndroidDecoderModule::CreateAudioDecoder( const CreateDecoderParams& aParams) { const AudioInfo& config = aParams.AudioConfig(); if (config.mBitDepth != 16) { // We only handle 16-bit audio. return nullptr; } LOG("CreateAudioFormat with mimeType=%s, mRate=%d, channels=%d", config.mMimeType.Data(), config.mRate, config.mChannels); nsString drmStubId; if (mProxy) { drmStubId = mProxy->GetMediaDrmStubId(); } RefPtr<MediaDataDecoder> decoder = RemoteDataDecoder::CreateAudioDecoder(aParams, drmStubId, mProxy); return decoder.forget(); }
already_AddRefed<MediaDataDecoder> RemoteDecoderModule::CreateAudioDecoder( const CreateDecoderParams& aParams) { LaunchRDDProcessIfNeeded(); if (!mManagerThread) { return nullptr; } RefPtr<RemoteAudioDecoderChild> child = new RemoteAudioDecoderChild(); MediaResult result(NS_OK); // We can use child as a ref here because this is a sync dispatch. In // the error case for InitIPDL, we can't just let the RefPtr go out of // scope at the end of the method because it will release the // RemoteAudioDecoderChild on the wrong thread. This will assert in // RemoteDecoderChild's destructor. Passing the RefPtr by reference // allows us to release the RemoteAudioDecoderChild on the manager // thread during this single dispatch. RefPtr<Runnable> task = NS_NewRunnableFunction("RemoteDecoderModule::CreateAudioDecoder", [&]() { result = child->InitIPDL(aParams.AudioConfig(), aParams.mOptions); if (NS_FAILED(result)) { // Release RemoteAudioDecoderChild here, while we're on // manager thread. Don't just let the RefPtr go out of scope. child = nullptr; } }); SyncRunnable::DispatchToThread(mManagerThread, task); if (NS_FAILED(result)) { if (aParams.mError) { *aParams.mError = result; } return nullptr; } RefPtr<RemoteMediaDataDecoder> object = new RemoteMediaDataDecoder( child, mManagerThread, RemoteDecoderManagerChild::GetManagerAbstractThread()); return object.forget(); }
already_AddRefed<MediaDataDecoder> AndroidDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams) { const AudioInfo& config = aParams.AudioConfig(); MOZ_ASSERT(config.mBitDepth == 16, "We only handle 16-bit audio!"); MediaFormat::LocalRef format; LOG("CreateAudioFormat with mimeType=%s, mRate=%d, channels=%d", config.mMimeType.Data(), config.mRate, config.mChannels); NS_ENSURE_SUCCESS(MediaFormat::CreateAudioFormat( config.mMimeType, config.mRate, config.mChannels, &format), nullptr); RefPtr<MediaDataDecoder> decoder = MediaPrefs::PDMAndroidRemoteCodecEnabled() ? RemoteDataDecoder::CreateAudioDecoder(config, format, aParams.mCallback) : MediaCodecDataDecoder::CreateAudioDecoder(config, format, aParams.mCallback); return decoder.forget(); }
WaveDataDecoder::WaveDataDecoder(const CreateDecoderParams& aParams) : mInfo(aParams.AudioConfig()) , mTaskQueue(aParams.mTaskQueue) { }