| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
| 18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
| 19 #include "content/public/renderer/media_stream_audio_renderer.h" | 19 #include "content/public/renderer/media_stream_audio_renderer.h" |
| 20 #include "content/renderer/media/webrtc_audio_device_impl.h" | 20 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 21 #include "media/base/audio_decoder.h" | 21 #include "media/base/audio_decoder.h" |
| 22 #include "media/base/audio_pull_fifo.h" | 22 #include "media/base/audio_pull_fifo.h" |
| 23 #include "media/base/audio_renderer_sink.h" | 23 #include "media/base/audio_renderer_sink.h" |
| 24 #include "media/base/channel_layout.h" | 24 #include "media/base/channel_layout.h" |
| 25 #include "media/base/output_device.h" | 25 #include "media/base/output_device.h" |
| 26 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 26 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
| 27 | 27 |
| 28 namespace media { | |
| 29 class AudioOutputDevice; | |
| 30 } // namespace media | |
| 31 | |
| 32 namespace webrtc { | 28 namespace webrtc { |
| 33 class AudioSourceInterface; | 29 class AudioSourceInterface; |
| 34 } // namespace webrtc | 30 } // namespace webrtc |
| 35 | 31 |
| 36 namespace content { | 32 namespace content { |
| 37 | 33 |
| 38 class WebRtcAudioRendererSource; | 34 class WebRtcAudioRendererSource; |
| 39 | 35 |
| 40 // This renderer handles calls from the pipeline and WebRtc ADM. It is used | 36 // This renderer handles calls from the pipeline and WebRtc ADM. It is used |
| 41 // for connecting WebRtc MediaStream with the audio pipeline. | 37 // for connecting WebRtc MediaStream with the audio pipeline. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // |sink_|. | 203 // |sink_|. |
| 208 void PrepareSink(); | 204 void PrepareSink(); |
| 209 | 205 |
| 210 // The RenderFrame in which the audio is rendered into |sink_|. | 206 // The RenderFrame in which the audio is rendered into |sink_|. |
| 211 const int source_render_frame_id_; | 207 const int source_render_frame_id_; |
| 212 const int session_id_; | 208 const int session_id_; |
| 213 | 209 |
| 214 const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread_; | 210 const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread_; |
| 215 | 211 |
| 216 // The sink (destination) for rendered audio. | 212 // The sink (destination) for rendered audio. |
| 217 scoped_refptr<media::AudioOutputDevice> sink_; | 213 scoped_refptr<media::RestartableAudioRendererSink> sink_; |
| 218 | 214 |
| 219 // The media stream that holds the audio tracks that this renderer renders. | 215 // The media stream that holds the audio tracks that this renderer renders. |
| 220 const blink::WebMediaStream media_stream_; | 216 const blink::WebMediaStream media_stream_; |
| 221 | 217 |
| 222 // Audio data source from the browser process. | 218 // Audio data source from the browser process. |
| 223 WebRtcAudioRendererSource* source_; | 219 WebRtcAudioRendererSource* source_; |
| 224 | 220 |
| 225 // Protects access to |state_|, |source_|, |audio_fifo_|, | 221 // Protects access to |state_|, |source_|, |audio_fifo_|, |
| 226 // |audio_delay_milliseconds_|, |fifo_delay_milliseconds_|, |current_time_|, | 222 // |audio_delay_milliseconds_|, |fifo_delay_milliseconds_|, |current_time_|, |
| 227 // |sink_params_| and |render_callback_count_| | 223 // |sink_params_| and |render_callback_count_| |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // Used for triggering new UMA histogram. Counts number of render | 260 // Used for triggering new UMA histogram. Counts number of render |
| 265 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|. | 261 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|. |
| 266 int render_callback_count_; | 262 int render_callback_count_; |
| 267 | 263 |
| 268 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); | 264 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); |
| 269 }; | 265 }; |
| 270 | 266 |
| 271 } // namespace content | 267 } // namespace content |
| 272 | 268 |
| 273 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 269 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
| OLD | NEW |