Chromium Code Reviews| 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 #ifndef CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_DECODER_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_DECODER_FACTORY_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_DECODER_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_DECODER_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "base/threading/thread.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 11 #include "third_party/webrtc/media/engine/webrtcvideodecoderfactory.h" | 12 #include "third_party/webrtc/media/engine/webrtcvideodecoderfactory.h" |
| 12 #include "third_party/webrtc/modules/video_coding/include/video_codec_interface. h" | 13 #include "third_party/webrtc/modules/video_coding/include/video_codec_interface. h" |
| 13 | 14 |
| 15 namespace base { | |
| 16 class SingleThreadTaskRunner; | |
| 17 } // namespace base | |
| 18 | |
| 19 namespace media { | |
| 20 class VideoDecoder; | |
| 21 } // namespace media | |
| 22 | |
| 14 namespace webrtc { | 23 namespace webrtc { |
| 15 class VideoDecoder; | 24 class VideoDecoder; |
| 16 } // namespace webrtc | 25 } // namespace webrtc |
| 17 | 26 |
| 18 namespace media { | |
| 19 class GpuVideoAcceleratorFactories; | |
| 20 } // namespace media | |
| 21 | |
| 22 namespace content { | 27 namespace content { |
| 23 | 28 |
| 24 // TODO(wuchengli): add unittest. | 29 // TODO(wuchengli): add unittest. |
| 25 class CONTENT_EXPORT RTCVideoDecoderFactory | 30 class CONTENT_EXPORT RTCVideoDecoderFactory |
| 26 : NON_EXPORTED_BASE(public cricket::WebRtcVideoDecoderFactory) { | 31 : NON_EXPORTED_BASE(public cricket::WebRtcVideoDecoderFactory) { |
| 27 public: | 32 public: |
| 28 explicit RTCVideoDecoderFactory( | 33 // A factory closure which can be run to create a media::VideoDecoder. |
| 29 media::GpuVideoAcceleratorFactories* gpu_factories); | 34 using CreateVideoDecoderCB = |
| 35 base::Callback<std::unique_ptr<media::VideoDecoder>()>; | |
| 36 | |
| 37 // |create_video_decoder_cb| will be passed to the created RtcVideoDecoder, | |
| 38 // which will run it on |decoder_task_runner|'s thread. All calls made on | |
| 39 // RtcVideoDecoder will be proxied on this thread to the media::VideoDecoder | |
| 40 // returned by this callback. For more information, see RtcVideoDeocder. | |
| 41 RTCVideoDecoderFactory( | |
| 42 const CreateVideoDecoderCB& create_video_decoder_cb, | |
|
emircan
2016/10/20 17:52:25
Can we name this as create_mojo_video_decoder_cb o
slan
2016/10/25 21:25:32
Using "mojo" in the name would be inaccurate right
| |
| 43 const scoped_refptr<base::SingleThreadTaskRunner>& decoder_task_runner); | |
| 30 ~RTCVideoDecoderFactory() override; | 44 ~RTCVideoDecoderFactory() override; |
| 31 | 45 |
| 32 // Runs on Chrome_libJingle_WorkerThread. The child thread is blocked while | 46 // Runs on Chrome_libJingle_WorkerThread. The child thread is blocked while |
| 33 // this runs. | 47 // this runs. |
| 34 webrtc::VideoDecoder* CreateVideoDecoder( | 48 webrtc::VideoDecoder* CreateVideoDecoder( |
| 35 webrtc::VideoCodecType type) override; | 49 webrtc::VideoCodecType type) override; |
| 36 | 50 |
| 37 // Runs on Chrome_libJingle_WorkerThread. The child thread is blocked while | 51 // Runs on Chrome_libJingle_WorkerThread. The child thread is blocked while |
| 38 // this runs. | 52 // this runs. |
| 39 void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) override; | 53 void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) override; |
| 40 | 54 |
| 41 private: | 55 private: |
| 42 media::GpuVideoAcceleratorFactories* gpu_factories_; | 56 // These are cached and passed into RtcVideoDecoder::Create(). |
| 57 const CreateVideoDecoderCB create_video_decoder_cb_; | |
| 58 const scoped_refptr<base::SingleThreadTaskRunner> decoder_task_runner_; | |
| 43 | 59 |
| 44 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoderFactory); | 60 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoderFactory); |
| 45 }; | 61 }; |
| 46 | 62 |
| 47 } // namespace content | 63 } // namespace content |
| 48 | 64 |
| 49 #endif // CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_DECODER_FACTORY_H_ | 65 #endif // CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_DECODER_FACTORY_H_ |
| OLD | NEW |