Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/media/rtc_video_decoder_factory.h" | |
| 6 | |
| 7 #include "base/location.h" | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" | |
| 10 #include "content/renderer/media/rtc_video_decoder.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 RTCVideoDecoderFactory::RTCVideoDecoderFactory( | |
| 15 const scoped_refptr<RendererGpuVideoDecoderFactories>& gpu_factories, | |
| 16 base::Thread* vda_thread) | |
| 17 : gpu_factories_(gpu_factories), | |
| 18 vda_thread_(vda_thread) { | |
| 19 } | |
| 20 | |
| 21 webrtc::VideoDecoder* RTCVideoDecoderFactory::CreateVideoDecoder( | |
| 22 webrtc::VideoCodecType type) { | |
| 23 // RendererGpuVideoDecoderFactories is not thread-safe. Make a copy. | |
| 24 scoped_ptr<RTCVideoDecoder> decoder( | |
| 25 new RTCVideoDecoder(gpu_factories_->Copy())); | |
|
wuchengli
2013/06/10 15:24:22
This is a little bit ugly. But I think this is the
| |
| 26 vda_thread_->message_loop()->AddDestructionObserver(decoder.get()); | |
|
Ami GONE FROM CHROMIUM
2013/06/11 23:48:05
I think .get() is no longer needed.
Ami GONE FROM CHROMIUM
2013/06/11 23:48:05
Is vda_thread_->message_loop() != gpu_factories_->
wuchengli
2013/06/13 10:28:07
No. We need MessageLoop, not MessageLoopProxy. Onl
wuchengli
2013/06/13 10:28:07
Done. AddDestructionObserver is moved to ctor of R
| |
| 27 if (decoder->Initialize(type)) | |
| 28 return decoder.release(); | |
| 29 // Initialize will fail when the codec is not supported. | |
| 30 return NULL; | |
| 31 } | |
| 32 | |
| 33 void RTCVideoDecoderFactory::DestroyVideoDecoder( | |
| 34 webrtc::VideoDecoder* decoder) { | |
| 35 gpu_factories_->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder); | |
| 36 } | |
| 37 | |
| 38 } // namespace content | |
| OLD | NEW |