Chromium Code Reviews| Index: content/renderer/media/rtc_video_decoder_factory.cc |
| diff --git a/content/renderer/media/rtc_video_decoder_factory.cc b/content/renderer/media/rtc_video_decoder_factory.cc |
| index 3c6b9ad5ac861ae7351c686c7328e157508d3a8d..194579bdcc2e73fc7e6a287457d30c39e3d43ab2 100644 |
| --- a/content/renderer/media/rtc_video_decoder_factory.cc |
| +++ b/content/renderer/media/rtc_video_decoder_factory.cc |
| @@ -11,43 +11,30 @@ |
| namespace content { |
| RTCVideoDecoderFactory::RTCVideoDecoderFactory( |
| - const scoped_refptr<media::GpuVideoDecoder::Factories>& gpu_factories) |
| - : vda_loop_proxy_(gpu_factories->GetMessageLoop()) { |
| + scoped_ptr<base::Thread> vda_thread, |
| + const scoped_refptr<content::RendererGpuVideoDecoderFactories>& |
| + gpu_factories) |
| + : vda_thread_(vda_thread.Pass()), gpu_factories_(gpu_factories) { |
| DVLOG(2) << "RTCVideoDecoderFactory"; |
| - // The decoder cannot be created in CreateVideoDecoder because VDA has to be |
| - // created on |vda_loop_proxy_|, which can be the child thread. The child |
| - // thread is blocked when CreateVideoDecoder runs. This supports only one |
| - // VDA-powered <video> tag at a time. |
| - // TODO(wuchengli): remove this restriction. |
| - // |decoder_| can be null if VDA does not support VP8. |
| - decoder_ = RTCVideoDecoder::Create(gpu_factories); |
| } |
| RTCVideoDecoderFactory::~RTCVideoDecoderFactory() { |
| DVLOG(2) << "~RTCVideoDecoderFactory"; |
| - if (decoder_) { |
| - webrtc::VideoDecoder* decoder = decoder_.release(); |
| - if (!vda_loop_proxy_->DeleteSoon(FROM_HERE, decoder)) |
| - delete decoder; |
| - } |
| } |
| webrtc::VideoDecoder* RTCVideoDecoderFactory::CreateVideoDecoder( |
| webrtc::VideoCodecType type) { |
| DVLOG(2) << "CreateVideoDecoder"; |
| - // Only VP8 is supported. |
| - if (type == webrtc::kVideoCodecVP8) |
| - return decoder_.release(); |
| - return NULL; |
| + scoped_ptr<RTCVideoDecoder> decoder = |
| + RTCVideoDecoder::Create(type, gpu_factories_->Clone()); |
|
scherkus (not reviewing)
2013/07/18 00:54:43
can we call RenderThreadImpl::current()->GetGpuFac
wuchengli
2013/07/18 09:42:00
CVD() is called on Chrome_libJingle_WorkerThread a
|
| + return decoder.release(); |
| } |
| void RTCVideoDecoderFactory::DestroyVideoDecoder( |
| webrtc::VideoDecoder* decoder) { |
| DVLOG(2) << "DestroyVideoDecoder"; |
| - // Save back the decoder because it is the only one. VideoDecoder::Release |
| - // should have been called. |
| - decoder->RegisterDecodeCompleteCallback(NULL); |
| - decoder_.reset(decoder); |
| + if (!vda_thread_->message_loop_proxy()->DeleteSoon(FROM_HERE, decoder)) |
| + delete decoder; |
| } |
| } // namespace content |