Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/mojo/services/renderer_config.h" | 5 #include "media/mojo/services/renderer_config.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "media/audio/audio_manager_base.h" | 9 #include "media/audio/audio_manager_base.h" |
| 10 #include "media/audio/audio_output_stream_sink.h" | 10 #include "media/audio/audio_output_stream_sink.h" |
| 11 #include "media/audio/fake_audio_log_factory.h" | 11 #include "media/audio/fake_audio_log_factory.h" |
| 12 #include "media/base/media.h" | 12 #include "media/base/media.h" |
| 13 #include "media/base/null_video_sink.h" | |
| 13 #include "media/filters/opus_audio_decoder.h" | 14 #include "media/filters/opus_audio_decoder.h" |
| 14 | 15 |
| 15 #if !defined(MEDIA_DISABLE_FFMPEG) | 16 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 16 #include "media/filters/ffmpeg_audio_decoder.h" | 17 #include "media/filters/ffmpeg_audio_decoder.h" |
| 17 #include "media/filters/ffmpeg_video_decoder.h" | 18 #include "media/filters/ffmpeg_video_decoder.h" |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 #if !defined(MEDIA_DISABLE_LIBVPX) | 21 #if !defined(MEDIA_DISABLE_LIBVPX) |
| 21 #include "media/filters/vpx_video_decoder.h" | 22 #include "media/filters/vpx_video_decoder.h" |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 namespace media { | 25 namespace media { |
| 25 namespace internal { | 26 namespace internal { |
| 26 | 27 |
| 27 class DummyVideoRendererSink : public VideoRendererSink { | |
| 28 public: | |
| 29 DummyVideoRendererSink() {} | |
| 30 ~DummyVideoRendererSink() override {} | |
| 31 | |
| 32 void Start(RenderCallback* callback) override {} | |
| 33 void Stop() override {} | |
| 34 void PaintFrameUsingOldRenderingPath( | |
| 35 const scoped_refptr<VideoFrame>& frame) override {} | |
| 36 | |
| 37 private: | |
| 38 DISALLOW_COPY_AND_ASSIGN(DummyVideoRendererSink); | |
| 39 }; | |
| 40 | |
| 41 class DefaultRendererConfig : public PlatformRendererConfig { | 28 class DefaultRendererConfig : public PlatformRendererConfig { |
| 42 public: | 29 public: |
| 43 DefaultRendererConfig() { | 30 DefaultRendererConfig() { |
| 44 InitializeMediaLibrary(); | 31 InitializeMediaLibrary(); |
| 45 | 32 |
| 46 // TODO(dalecurtis): We should find a single owner per process for the audio | 33 // TODO(dalecurtis): We should find a single owner per process for the audio |
| 47 // manager or make it a lazy instance. It's not safe to call Get()/Create() | 34 // manager or make it a lazy instance. It's not safe to call Get()/Create() |
| 48 // across multiple threads... | 35 // across multiple threads... |
| 49 // | 36 // |
| 50 // TODO(dalecurtis): Eventually we'll want something other than a fake audio | 37 // TODO(dalecurtis): Eventually we'll want something other than a fake audio |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 video_decoders.push_back(new FFmpegVideoDecoder(media_task_runner)); | 76 video_decoders.push_back(new FFmpegVideoDecoder(media_task_runner)); |
| 90 #endif | 77 #endif |
| 91 | 78 |
| 92 return video_decoders.Pass(); | 79 return video_decoders.Pass(); |
| 93 } | 80 } |
| 94 | 81 |
| 95 scoped_refptr<AudioRendererSink> GetAudioRendererSink() override { | 82 scoped_refptr<AudioRendererSink> GetAudioRendererSink() override { |
| 96 return new AudioOutputStreamSink(); | 83 return new AudioOutputStreamSink(); |
| 97 } | 84 } |
| 98 | 85 |
| 99 scoped_ptr<VideoRendererSink> GetVideoRendererSink() override { | 86 scoped_ptr<VideoRendererSink> GetVideoRendererSink( |
| 100 return make_scoped_ptr(new DummyVideoRendererSink()); | 87 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) override { |
| 88 return make_scoped_ptr( | |
| 89 new NullVideoSink(false, base::TimeDelta::FromMilliseconds(30), | |
|
DaleCurtis
2015/06/16 16:24:44
FromSecondsD(1.0 / 60) is what I used elsewhere.
xhwang
2015/06/16 17:16:57
Done.
| |
| 90 NullVideoSink::NewFrameCB(), task_runner)); | |
| 101 } | 91 } |
| 102 | 92 |
| 103 const AudioHardwareConfig& GetAudioHardwareConfig() override { | 93 const AudioHardwareConfig& GetAudioHardwareConfig() override { |
| 104 return *audio_hardware_config_; | 94 return *audio_hardware_config_; |
| 105 } | 95 } |
| 106 | 96 |
| 107 private: | 97 private: |
| 108 FakeAudioLogFactory fake_audio_log_factory_; | 98 FakeAudioLogFactory fake_audio_log_factory_; |
| 109 scoped_ptr<AudioHardwareConfig> audio_hardware_config_; | 99 scoped_ptr<AudioHardwareConfig> audio_hardware_config_; |
| 110 | 100 |
| 111 DISALLOW_COPY_AND_ASSIGN(DefaultRendererConfig); | 101 DISALLOW_COPY_AND_ASSIGN(DefaultRendererConfig); |
| 112 }; | 102 }; |
| 113 | 103 |
| 114 scoped_ptr<PlatformRendererConfig> CreatePlatformRendererConfig() { | 104 scoped_ptr<PlatformRendererConfig> CreatePlatformRendererConfig() { |
| 115 return make_scoped_ptr(new DefaultRendererConfig()); | 105 return make_scoped_ptr(new DefaultRendererConfig()); |
| 116 } | 106 } |
| 117 | 107 |
| 118 } // namespace internal | 108 } // namespace internal |
| 119 } // namespace media | 109 } // namespace media |
| OLD | NEW |