| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // The |source| is owned by the WebRtcAudioDeviceImpl. | 51 // The |source| is owned by the WebRtcAudioDeviceImpl. |
| 52 // Called on the main thread. | 52 // Called on the main thread. |
| 53 WebRtcLocalAudioRenderer(const blink::WebMediaStreamTrack& audio_track, | 53 WebRtcLocalAudioRenderer(const blink::WebMediaStreamTrack& audio_track, |
| 54 int source_render_view_id, | 54 int source_render_view_id, |
| 55 int source_render_frame_id, | 55 int source_render_frame_id, |
| 56 int session_id, | 56 int session_id, |
| 57 int frames_per_buffer); | 57 int frames_per_buffer); |
| 58 | 58 |
| 59 // MediaStreamAudioRenderer implementation. | 59 // MediaStreamAudioRenderer implementation. |
| 60 // Called on the main thread. | 60 // Called on the main thread. |
| 61 virtual void Start() override; | 61 void Start() override; |
| 62 virtual void Stop() override; | 62 void Stop() override; |
| 63 virtual void Play() override; | 63 void Play() override; |
| 64 virtual void Pause() override; | 64 void Pause() override; |
| 65 virtual void SetVolume(float volume) override; | 65 void SetVolume(float volume) override; |
| 66 virtual base::TimeDelta GetCurrentRenderTime() const override; | 66 base::TimeDelta GetCurrentRenderTime() const override; |
| 67 virtual bool IsLocalRenderer() const override; | 67 bool IsLocalRenderer() const override; |
| 68 | 68 |
| 69 const base::TimeDelta& total_render_time() const { | 69 const base::TimeDelta& total_render_time() const { |
| 70 return total_render_time_; | 70 return total_render_time_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 protected: | 73 protected: |
| 74 virtual ~WebRtcLocalAudioRenderer(); | 74 ~WebRtcLocalAudioRenderer() override; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 // MediaStreamAudioSink implementation. | 77 // MediaStreamAudioSink implementation. |
| 78 | 78 |
| 79 // Called on the AudioInputDevice worker thread. | 79 // Called on the AudioInputDevice worker thread. |
| 80 virtual void OnData(const int16* audio_data, | 80 void OnData(const int16* audio_data, |
| 81 int sample_rate, | 81 int sample_rate, |
| 82 int number_of_channels, | 82 int number_of_channels, |
| 83 int number_of_frames) override; | 83 int number_of_frames) override; |
| 84 | 84 |
| 85 // Called on the AudioInputDevice worker thread. | 85 // Called on the AudioInputDevice worker thread. |
| 86 virtual void OnSetFormat(const media::AudioParameters& params) override; | 86 void OnSetFormat(const media::AudioParameters& params) override; |
| 87 | 87 |
| 88 // media::AudioRendererSink::RenderCallback implementation. | 88 // media::AudioRendererSink::RenderCallback implementation. |
| 89 // Render() is called on the AudioOutputDevice thread and OnRenderError() | 89 // Render() is called on the AudioOutputDevice thread and OnRenderError() |
| 90 // on the IO thread. | 90 // on the IO thread. |
| 91 virtual int Render(media::AudioBus* audio_bus, | 91 int Render(media::AudioBus* audio_bus, int audio_delay_milliseconds) override; |
| 92 int audio_delay_milliseconds) override; | 92 void OnRenderError() override; |
| 93 virtual void OnRenderError() override; | |
| 94 | 93 |
| 95 // Initializes and starts the |sink_| if | 94 // Initializes and starts the |sink_| if |
| 96 // we have received valid |source_params_| && | 95 // we have received valid |source_params_| && |
| 97 // |playing_| has been set to true && | 96 // |playing_| has been set to true && |
| 98 // |volume_| is not zero. | 97 // |volume_| is not zero. |
| 99 void MaybeStartSink(); | 98 void MaybeStartSink(); |
| 100 | 99 |
| 101 // Sets new |source_params_| and then re-initializes and restarts |sink_|. | 100 // Sets new |source_params_| and then re-initializes and restarts |sink_|. |
| 102 void ReconfigureSink(const media::AudioParameters& params); | 101 void ReconfigureSink(const media::AudioParameters& params); |
| 103 | 102 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 162 |
| 164 // Used to DCHECK that some methods are called on the capture audio thread. | 163 // Used to DCHECK that some methods are called on the capture audio thread. |
| 165 base::ThreadChecker capture_thread_checker_; | 164 base::ThreadChecker capture_thread_checker_; |
| 166 | 165 |
| 167 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioRenderer); | 166 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioRenderer); |
| 168 }; | 167 }; |
| 169 | 168 |
| 170 } // namespace content | 169 } // namespace content |
| 171 | 170 |
| 172 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_RENDERER_H_ | 171 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_RENDERER_H_ |
| OLD | NEW |