OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/rtc_video_decoder_factory.h" | 5 #include "content/renderer/media/rtc_video_decoder_factory.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" | 9 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" |
10 #include "content/renderer/media/rtc_video_decoder.h" | 10 #include "content/renderer/media/rtc_video_decoder.h" |
11 #include "media/filters/gpu_video_decoder_factories.h" | |
12 | 11 |
13 namespace content { | 12 namespace content { |
14 | 13 |
15 RTCVideoDecoderFactory::RTCVideoDecoderFactory( | 14 RTCVideoDecoderFactory::RTCVideoDecoderFactory( |
16 const scoped_refptr<RendererGpuVideoDecoderFactories>& gpu_factories) | 15 const scoped_refptr<RendererGpuVideoAcceleratorFactories>& gpu_factories) |
17 : gpu_factories_(gpu_factories) { | 16 : gpu_factories_(gpu_factories) { |
18 DVLOG(2) << "RTCVideoDecoderFactory"; | 17 DVLOG(2) << "RTCVideoDecoderFactory"; |
19 } | 18 } |
20 | 19 |
21 RTCVideoDecoderFactory::~RTCVideoDecoderFactory() { | 20 RTCVideoDecoderFactory::~RTCVideoDecoderFactory() { |
22 DVLOG(2) << "~RTCVideoDecoderFactory"; | 21 DVLOG(2) << "~RTCVideoDecoderFactory"; |
23 } | 22 } |
24 | 23 |
25 webrtc::VideoDecoder* RTCVideoDecoderFactory::CreateVideoDecoder( | 24 webrtc::VideoDecoder* RTCVideoDecoderFactory::CreateVideoDecoder( |
26 webrtc::VideoCodecType type) { | 25 webrtc::VideoCodecType type) { |
27 DVLOG(2) << "CreateVideoDecoder"; | 26 DVLOG(2) << "CreateVideoDecoder"; |
28 // RendererGpuVideoDecoderFactories is not thread safe. It cannot be shared | 27 // GpuVideoAcceleratorFactories is not thread safe. It cannot be shared |
29 // by different decoders. This method runs on Chrome_libJingle_WorkerThread | 28 // by different decoders. This method runs on Chrome_libJingle_WorkerThread |
30 // and the child thread is blocked while this runs. We cannot create new gpu | 29 // and the child thread is blocked while this runs. We cannot create new gpu |
31 // factories here. Clone one instead. | 30 // factories here. Clone one instead. |
32 scoped_ptr<RTCVideoDecoder> decoder = | 31 scoped_ptr<RTCVideoDecoder> decoder = |
33 RTCVideoDecoder::Create(type, gpu_factories_->Clone()); | 32 RTCVideoDecoder::Create(type, gpu_factories_->Clone()); |
34 return decoder.release(); | 33 return decoder.release(); |
35 } | 34 } |
36 | 35 |
37 void RTCVideoDecoderFactory::DestroyVideoDecoder( | 36 void RTCVideoDecoderFactory::DestroyVideoDecoder( |
38 webrtc::VideoDecoder* decoder) { | 37 webrtc::VideoDecoder* decoder) { |
39 DVLOG(2) << "DestroyVideoDecoder"; | 38 DVLOG(2) << "DestroyVideoDecoder"; |
40 gpu_factories_->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder); | 39 gpu_factories_->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder); |
41 } | 40 } |
42 | 41 |
43 } // namespace content | 42 } // namespace content |
OLD | NEW |