Bug 1046282 part 4: Make Create*Decoder functions return already_AddRefed. r=rillian

This commit is contained in:
Daniel Holbert 2014-07-30 18:40:21 -07:00
Родитель 686bdc6674
Коммит 6624882c4b
9 изменённых файлов: 67 добавлений и 48 удалений

Просмотреть файл

@ -211,29 +211,34 @@ public:
}
// Decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE {
BlankVideoDataCreator* decoder = new BlankVideoDataCreator(
BlankVideoDataCreator* creator = new BlankVideoDataCreator(
aConfig.display_width, aConfig.display_height, aImageContainer);
return new BlankMediaDataDecoder<BlankVideoDataCreator>(decoder,
aVideoTaskQueue,
aCallback);
nsRefPtr<MediaDataDecoder> decoder =
new BlankMediaDataDecoder<BlankVideoDataCreator>(creator,
aVideoTaskQueue,
aCallback);
return decoder.forget();
}
// Decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE {
BlankAudioDataCreator* decoder = new BlankAudioDataCreator(
BlankAudioDataCreator* creator = new BlankAudioDataCreator(
aConfig.channel_count, aConfig.samples_per_second);
return new BlankMediaDataDecoder<BlankAudioDataCreator>(decoder,
aAudioTaskQueue,
aCallback);
nsRefPtr<MediaDataDecoder> decoder =
new BlankMediaDataDecoder<BlankAudioDataCreator>(creator,
aAudioTaskQueue,
aCallback);
return decoder.forget();
}
};

Просмотреть файл

@ -93,7 +93,7 @@ public:
// Returns nullptr if the decoder can't be created.
// It is safe to store a reference to aConfig.
// Called on decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
@ -110,7 +110,7 @@ public:
// COINIT_MULTITHREADED.
// It is safe to store a reference to aConfig.
// Called on decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback) = 0;

Просмотреть файл

@ -66,22 +66,26 @@ AppleDecoderModule::Shutdown()
return NS_OK;
}
MediaDataDecoder*
already_AddRefed<MediaDataDecoder>
AppleDecoderModule::CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback)
{
return new AppleVTDecoder(aConfig, aVideoTaskQueue, aCallback, aImageContainer);
nsRefPtr<MediaDataDecoder> decoder =
new AppleVTDecoder(aConfig, aVideoTaskQueue, aCallback, aImageContainer);
return decoder.forget();
}
MediaDataDecoder*
already_AddRefed<MediaDataDecoder>
AppleDecoderModule::CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback)
{
return new AppleATDecoder(aConfig, aAudioTaskQueue, aCallback);
nsRefPtr<MediaDataDecoder> decoder =
new AppleATDecoder(aConfig, aAudioTaskQueue, aCallback);
return decoder.forget();
}
} // namespace mozilla

Просмотреть файл

@ -25,7 +25,7 @@ public:
virtual nsresult Shutdown() MOZ_OVERRIDE;
// Decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
@ -33,7 +33,7 @@ public:
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
// Decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;

Просмотреть файл

@ -192,7 +192,7 @@ EMEDecoderModule::Shutdown()
return NS_OK;
}
MediaDataDecoder*
already_AddRefed<MediaDataDecoder>
EMEDecoderModule::CreateH264Decoder(const VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
@ -213,13 +213,14 @@ EMEDecoderModule::CreateH264Decoder(const VideoDecoderConfig& aConfig,
return nullptr;
}
return new EMEDecryptor(decoder,
aCallback,
mTaskQueue,
mProxy);
nsRefPtr<MediaDataDecoder> emeDecoder(new EMEDecryptor(decoder,
aCallback,
mTaskQueue,
mProxy));
return emeDecoder.forget();
}
MediaDataDecoder*
already_AddRefed<MediaDataDecoder>
EMEDecoderModule::CreateAACDecoder(const AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback)
@ -236,10 +237,11 @@ EMEDecoderModule::CreateAACDecoder(const AudioDecoderConfig& aConfig,
return nullptr;
}
return new EMEDecryptor(decoder,
aCallback,
mTaskQueue,
mProxy);
nsRefPtr<MediaDataDecoder> emeDecoder(new EMEDecryptor(decoder,
aCallback,
mTaskQueue,
mProxy));
return emeDecoder.forget();
}
} // namespace mozilla

Просмотреть файл

@ -33,7 +33,7 @@ public:
virtual nsresult Shutdown() MOZ_OVERRIDE;
// Decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
@ -41,7 +41,7 @@ public:
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
// Decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;

Просмотреть файл

@ -25,23 +25,27 @@ public:
virtual nsresult Shutdown() MOZ_OVERRIDE { return NS_OK; }
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE
{
return new FFmpegH264Decoder<V>(aVideoTaskQueue, aCallback, aConfig,
aImageContainer);
nsRefPtr<MediaDataDecoder> decoder =
new FFmpegH264Decoder<V>(aVideoTaskQueue, aCallback, aConfig,
aImageContainer);
return decoder.forget();
}
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE
{
return new FFmpegAACDecoder<V>(aAudioTaskQueue, aCallback, aConfig);
nsRefPtr<MediaDataDecoder> decoder =
new FFmpegAACDecoder<V>(aAudioTaskQueue, aCallback, aConfig);
return decoder.forget();
}
};

Просмотреть файл

@ -63,29 +63,33 @@ WMFDecoderModule::Shutdown()
return NS_OK;
}
MediaDataDecoder*
already_AddRefed<MediaDataDecoder>
WMFDecoderModule::CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback)
{
return new WMFMediaDataDecoder(new WMFVideoMFTManager(aConfig,
aLayersBackend,
aImageContainer,
sDXVAEnabled),
aVideoTaskQueue,
aCallback);
nsRefPtr<MediaDataDecoder> decoder =
new WMFMediaDataDecoder(new WMFVideoMFTManager(aConfig,
aLayersBackend,
aImageContainer,
sDXVAEnabled),
aVideoTaskQueue,
aCallback);
return decoder.forget();
}
MediaDataDecoder*
already_AddRefed<MediaDataDecoder>
WMFDecoderModule::CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback)
{
return new WMFMediaDataDecoder(new WMFAudioMFTManager(aConfig),
aAudioTaskQueue,
aCallback);
nsRefPtr<MediaDataDecoder> decoder =
new WMFMediaDataDecoder(new WMFAudioMFTManager(aConfig),
aAudioTaskQueue,
aCallback);
return decoder.forget();
}
} // namespace mozilla

Просмотреть файл

@ -25,7 +25,7 @@ public:
virtual nsresult Shutdown() MOZ_OVERRIDE;
// Decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
@ -33,7 +33,7 @@ public:
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
// Decode thread.
virtual MediaDataDecoder*
virtual already_AddRefed<MediaDataDecoder>
CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;