OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEBRTC_AUDIO_RENDERER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "content/renderer/media/webrtc_audio_device_impl.h" | 11 #include "content/renderer/media/webrtc_audio_device_impl.h" |
12 #include "media/base/audio_decoder.h" | 12 #include "media/base/audio_decoder.h" |
13 #include "media/base/audio_pull_fifo.h" | 13 #include "media/base/audio_pull_fifo.h" |
14 #include "media/base/audio_renderer_sink.h" | 14 #include "media/base/audio_renderer_sink.h" |
15 #include "webkit/media/media_stream_audio_renderer.h" | 15 #include "webkit/media/media_stream_audio_renderer.h" |
16 | 16 |
| 17 namespace media { |
| 18 class AudioOutputDevice; |
| 19 } |
| 20 |
17 namespace content { | 21 namespace content { |
18 | 22 |
19 class RendererAudioOutputDevice; | |
20 class WebRtcAudioRendererSource; | 23 class WebRtcAudioRendererSource; |
21 | 24 |
22 // This renderer handles calls from the pipeline and WebRtc ADM. It is used | 25 // This renderer handles calls from the pipeline and WebRtc ADM. It is used |
23 // for connecting WebRtc MediaStream with the audio pipeline. | 26 // for connecting WebRtc MediaStream with the audio pipeline. |
24 class CONTENT_EXPORT WebRtcAudioRenderer | 27 class CONTENT_EXPORT WebRtcAudioRenderer |
25 : NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback), | 28 : NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback), |
26 NON_EXPORTED_BASE(public webkit_media::MediaStreamAudioRenderer) { | 29 NON_EXPORTED_BASE(public webkit_media::MediaStreamAudioRenderer) { |
27 public: | 30 public: |
28 explicit WebRtcAudioRenderer(int source_render_view_id); | 31 explicit WebRtcAudioRenderer(int source_render_view_id); |
29 | 32 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 virtual void OnRenderError() OVERRIDE; | 67 virtual void OnRenderError() OVERRIDE; |
65 | 68 |
66 // Called by AudioPullFifo when more data is necessary. | 69 // Called by AudioPullFifo when more data is necessary. |
67 // This method is called on the AudioOutputDevice worker thread. | 70 // This method is called on the AudioOutputDevice worker thread. |
68 void SourceCallback(int fifo_frame_delay, media::AudioBus* audio_bus); | 71 void SourceCallback(int fifo_frame_delay, media::AudioBus* audio_bus); |
69 | 72 |
70 // The render view in which the audio is rendered into |sink_|. | 73 // The render view in which the audio is rendered into |sink_|. |
71 const int source_render_view_id_; | 74 const int source_render_view_id_; |
72 | 75 |
73 // The sink (destination) for rendered audio. | 76 // The sink (destination) for rendered audio. |
74 scoped_refptr<RendererAudioOutputDevice> sink_; | 77 scoped_refptr<media::AudioOutputDevice> sink_; |
75 | 78 |
76 // Audio data source from the browser process. | 79 // Audio data source from the browser process. |
77 WebRtcAudioRendererSource* source_; | 80 WebRtcAudioRendererSource* source_; |
78 | 81 |
79 // Buffers used for temporary storage during render callbacks. | 82 // Buffers used for temporary storage during render callbacks. |
80 // Allocated during initialization. | 83 // Allocated during initialization. |
81 scoped_ptr<int16[]> buffer_; | 84 scoped_ptr<int16[]> buffer_; |
82 | 85 |
83 // Protects access to |state_|, |source_| and |sink_|. | 86 // Protects access to |state_|, |source_| and |sink_|. |
84 base::Lock lock_; | 87 base::Lock lock_; |
(...skipping 13 matching lines...) Expand all Loading... |
98 double frame_duration_milliseconds_; | 101 double frame_duration_milliseconds_; |
99 | 102 |
100 double fifo_io_ratio_; | 103 double fifo_io_ratio_; |
101 | 104 |
102 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); | 105 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); |
103 }; | 106 }; |
104 | 107 |
105 } // namespace content | 108 } // namespace content |
106 | 109 |
107 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 110 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
OLD | NEW |