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 scoped_ptr<base::Thread> vda_thread) |
| 17 : gpu_factories_(gpu_factories), vda_thread_(vda_thread.Pass()) {} |
| 18 |
| 19 webrtc::VideoDecoder* RTCVideoDecoderFactory::CreateVideoDecoder( |
| 20 webrtc::VideoCodecType type) { |
| 21 // RendererGpuVideoDecoderFactories is not thread-safe. Make a copy. |
| 22 scoped_ptr<RTCVideoDecoder> decoder( |
| 23 new RTCVideoDecoder(gpu_factories_->Clone(), vda_thread_.get())); |
| 24 if (decoder->InitVideoDecodeAccelerator(type)) |
| 25 return decoder.release(); |
| 26 // Initialize will fail when the codec is not supported. |
| 27 return NULL; |
| 28 } |
| 29 |
| 30 void RTCVideoDecoderFactory::DestroyVideoDecoder( |
| 31 webrtc::VideoDecoder* decoder) { |
| 32 gpu_factories_->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder); |
| 33 } |
| 34 |
| 35 } // namespace content |
OLD | NEW |