| 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 #ifndef CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ | 5 #ifndef CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ |
| 6 #define CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ | 6 #define CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "chromecast/common/media/cma_ipc_common.h" | 13 #include "chromecast/common/media/cma_ipc_common.h" |
| 14 #include "chromecast/media/cma/pipeline/audio_pipeline.h" | |
| 15 #include "media/base/pipeline_status.h" | 14 #include "media/base/pipeline_status.h" |
| 16 | 15 |
| 17 namespace base { | 16 namespace base { |
| 18 class SingleThreadTaskRunner; | 17 class SingleThreadTaskRunner; |
| 19 class SharedMemory; | 18 class SharedMemory; |
| 20 } | 19 } |
| 21 | 20 |
| 22 namespace media { | 21 namespace media { |
| 23 class AudioDecoderConfig; | 22 class AudioDecoderConfig; |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace chromecast { | 25 namespace chromecast { |
| 27 namespace media { | 26 namespace media { |
| 28 class AudioPipelineProxyInternal; | 27 class AudioPipelineProxyInternal; |
| 29 struct AvPipelineClient; | |
| 30 class AvStreamerProxy; | 28 class AvStreamerProxy; |
| 31 class CodedFrameProvider; | 29 class CodedFrameProvider; |
| 32 class MediaChannelProxy; | 30 class MediaChannelProxy; |
| 31 struct AvPipelineClient; |
| 33 | 32 |
| 34 class AudioPipelineProxy : public AudioPipeline { | 33 class AudioPipelineProxy { |
| 35 public: | 34 public: |
| 36 AudioPipelineProxy(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 35 AudioPipelineProxy(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 37 scoped_refptr<MediaChannelProxy> media_channel_proxy); | 36 scoped_refptr<MediaChannelProxy> media_channel_proxy); |
| 38 ~AudioPipelineProxy() override; | 37 ~AudioPipelineProxy(); |
| 39 | 38 |
| 40 void Initialize( | 39 void Initialize( |
| 41 const ::media::AudioDecoderConfig& config, | 40 const ::media::AudioDecoderConfig& config, |
| 42 scoped_ptr<CodedFrameProvider> frame_provider, | 41 scoped_ptr<CodedFrameProvider> frame_provider, |
| 43 const ::media::PipelineStatusCB& status_cb); | 42 const ::media::PipelineStatusCB& status_cb); |
| 44 void StartFeeding(); | 43 void StartFeeding(); |
| 45 void Flush(const base::Closure& done_cb); | 44 void Flush(const base::Closure& done_cb); |
| 46 void Stop(); | 45 void Stop(); |
| 47 | 46 |
| 48 // AudioPipeline implementation. | 47 void SetClient(const AvPipelineClient& client); |
| 49 void SetClient(const AvPipelineClient& client) override; | 48 void SetVolume(float volume); |
| 50 void SetVolume(float volume) override; | |
| 51 | 49 |
| 52 private: | 50 private: |
| 53 base::ThreadChecker thread_checker_; | 51 base::ThreadChecker thread_checker_; |
| 54 | 52 |
| 55 void OnAvPipeCreated( | 53 void OnAvPipeCreated( |
| 56 const ::media::AudioDecoderConfig& config, | 54 const ::media::AudioDecoderConfig& config, |
| 57 const ::media::PipelineStatusCB& status_cb, | 55 const ::media::PipelineStatusCB& status_cb, |
| 58 scoped_ptr<base::SharedMemory> shared_memory); | 56 scoped_ptr<base::SharedMemory> shared_memory); |
| 59 void OnPipeWrite(); | 57 void OnPipeWrite(); |
| 60 void OnPipeRead(); | 58 void OnPipeRead(); |
| 61 | 59 |
| 62 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 60 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 63 | 61 |
| 64 // |proxy_| main goal is to convert function calls to IPC messages. | 62 // |proxy_| main goal is to convert function calls to IPC messages. |
| 65 scoped_ptr<AudioPipelineProxyInternal> proxy_; | 63 scoped_ptr<AudioPipelineProxyInternal> proxy_; |
| 66 | 64 |
| 67 scoped_ptr<AvStreamerProxy> audio_streamer_; | 65 scoped_ptr<AvStreamerProxy> audio_streamer_; |
| 68 | 66 |
| 69 base::WeakPtr<AudioPipelineProxy> weak_this_; | 67 base::WeakPtr<AudioPipelineProxy> weak_this_; |
| 70 base::WeakPtrFactory<AudioPipelineProxy> weak_factory_; | 68 base::WeakPtrFactory<AudioPipelineProxy> weak_factory_; |
| 71 | 69 |
| 72 DISALLOW_COPY_AND_ASSIGN(AudioPipelineProxy); | 70 DISALLOW_COPY_AND_ASSIGN(AudioPipelineProxy); |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 } // namespace media | 73 } // namespace media |
| 76 } // namespace chromecast | 74 } // namespace chromecast |
| 77 | 75 |
| 78 #endif // CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ | 76 #endif // CHROMECAST_RENDERER_MEDIA_AUDIO_PIPELINE_PROXY_H_ |
| OLD | NEW |