| 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_LOCAL_AUDIO_RENDERER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_RENDERER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_RENDERER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_RENDERER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/renderer/media/webrtc_audio_device_impl.h" | 13 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 14 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 14 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
| 15 #include "webkit/media/media_stream_audio_renderer.h" | 15 #include "webkit/media/media_stream_audio_renderer.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 class AudioBus; | 18 class AudioBus; |
| 19 class AudioOutputDevice; |
| 19 class AudioParameters; | 20 class AudioParameters; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace webrtc { | 23 namespace webrtc { |
| 23 class AudioTrackInterface; | 24 class AudioTrackInterface; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace content { | 27 namespace content { |
| 27 | 28 |
| 28 class RendererAudioOutputDevice; | |
| 29 class WebRtcAudioCapturer; | 29 class WebRtcAudioCapturer; |
| 30 | 30 |
| 31 // WebRtcLocalAudioRenderer is a webkit_media::MediaStreamAudioRenderer | 31 // WebRtcLocalAudioRenderer is a webkit_media::MediaStreamAudioRenderer |
| 32 // designed for rendering local audio media stream tracks, | 32 // designed for rendering local audio media stream tracks, |
| 33 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreamtrack | 33 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreamtrack |
| 34 // It also implements media::AudioRendererSink::RenderCallback to render audio | 34 // It also implements media::AudioRendererSink::RenderCallback to render audio |
| 35 // data provided from a WebRtcAudioCapturer source which is set at construction. | 35 // data provided from a WebRtcAudioCapturer source which is set at construction. |
| 36 // When the audio layer in the browser process asks for data to render, this | 36 // When the audio layer in the browser process asks for data to render, this |
| 37 // class provides the data by implementing the WebRtcAudioCapturerSink | 37 // class provides the data by implementing the WebRtcAudioCapturerSink |
| 38 // interface, i.e., we are a sink seen from the WebRtcAudioCapturer perspective. | 38 // interface, i.e., we are a sink seen from the WebRtcAudioCapturer perspective. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // by this class when the sink asks for new data. | 98 // by this class when the sink asks for new data. |
| 99 // The WebRtcAudioCapturer is today created by WebRtcAudioDeviceImpl. | 99 // The WebRtcAudioCapturer is today created by WebRtcAudioDeviceImpl. |
| 100 scoped_refptr<WebRtcAudioCapturer> source_; | 100 scoped_refptr<WebRtcAudioCapturer> source_; |
| 101 | 101 |
| 102 scoped_refptr<webrtc::AudioTrackInterface> audio_track_; | 102 scoped_refptr<webrtc::AudioTrackInterface> audio_track_; |
| 103 | 103 |
| 104 // The render view in which the audio is rendered into |sink_|. | 104 // The render view in which the audio is rendered into |sink_|. |
| 105 const int source_render_view_id_; | 105 const int source_render_view_id_; |
| 106 | 106 |
| 107 // The sink (destination) for rendered audio. | 107 // The sink (destination) for rendered audio. |
| 108 scoped_refptr<RendererAudioOutputDevice> sink_; | 108 scoped_refptr<media::AudioOutputDevice> sink_; |
| 109 | 109 |
| 110 // Used to DCHECK that we are called on the correct thread. | 110 // Used to DCHECK that we are called on the correct thread. |
| 111 base::ThreadChecker thread_checker_; | 111 base::ThreadChecker thread_checker_; |
| 112 | 112 |
| 113 // Contains copies of captured audio frames. | 113 // Contains copies of captured audio frames. |
| 114 scoped_ptr<media::AudioFifo> loopback_fifo_; | 114 scoped_ptr<media::AudioFifo> loopback_fifo_; |
| 115 | 115 |
| 116 // Stores last time a render callback was received. The time difference | 116 // Stores last time a render callback was received. The time difference |
| 117 // between a new time stamp and this value can be used to derive the | 117 // between a new time stamp and this value can be used to derive the |
| 118 // total render time. | 118 // total render time. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 129 | 129 |
| 130 // Protects |loopback_fifo_|, |playing_| and |sink_|. | 130 // Protects |loopback_fifo_|, |playing_| and |sink_|. |
| 131 mutable base::Lock thread_lock_; | 131 mutable base::Lock thread_lock_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioRenderer); | 133 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioRenderer); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace content | 136 } // namespace content |
| 137 | 137 |
| 138 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_RENDERER_H_ | 138 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_RENDERER_H_ |
| OLD | NEW |