Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/synchronization/lock.h" | |
| 10 #include "content/renderer/media/webrtc_audio_device_impl.h" | |
| 11 #include "media/base/audio_decoder.h" | |
| 12 #include "media/base/audio_renderer_sink.h" | |
| 13 #include "media/base/rtc_audio_renderer.h" | |
| 14 | |
| 15 namespace content { | |
| 16 | |
| 17 class WebRtcAudioRendererSource; | |
| 18 | |
| 19 // This renderer handles calls from the pipeline and WebRtc ADM. It is used | |
| 20 // for connecting WebRtc MediaStream with pipeline. | |
| 21 class WebRtcAudioRenderer | |
| 22 : public media::RtcAudioRenderer, | |
| 23 NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback) { | |
| 24 public: | |
| 25 WebRtcAudioRenderer(); | |
| 26 | |
| 27 void Initialize(WebRtcAudioRendererSource* source); | |
| 28 | |
| 29 // Methods called on pipeline thread ---------------------------------------- | |
|
wjia(left Chromium)
2012/10/24 22:05:15
RtcAudioRenderer methods will be called on main th
no longer working on chromium
2012/10/25 10:19:41
Good to know, thanks. I just realized that those m
| |
| 30 // RtcAudioRenderer implementation. | |
| 31 virtual void Play() OVERRIDE; | |
| 32 virtual void Pause() OVERRIDE; | |
| 33 virtual void Stop() OVERRIDE; | |
| 34 virtual void SetVolume(float volume) OVERRIDE; | |
| 35 | |
| 36 protected: | |
| 37 virtual ~WebRtcAudioRenderer(); | |
| 38 | |
| 39 private: | |
| 40 enum State { | |
| 41 UNINITIALIZED, | |
| 42 PLAYING, | |
| 43 PAUSED, | |
| 44 }; | |
| 45 // Flag to keep track the state set by the pipeline. | |
|
wjia(left Chromium)
2012/10/24 22:05:15
Is this comment valid?
no longer working on chromium
2012/10/25 10:19:41
No. It is changed.
| |
| 46 State state_; | |
| 47 | |
| 48 // media::AudioRendererSink::RenderCallback implementation. | |
| 49 virtual int Render(media::AudioBus* audio_bus, | |
| 50 int audio_delay_milliseconds) OVERRIDE; | |
| 51 virtual void OnRenderError() OVERRIDE; | |
| 52 | |
| 53 private: | |
|
wjia(left Chromium)
2012/10/24 22:05:15
redundant "private".
no longer working on chromium
2012/10/25 10:19:41
Done.
| |
| 54 | |
| 55 // The sink (destination) for rendered audio. | |
| 56 scoped_refptr<media::AudioRendererSink> sink_; | |
| 57 | |
| 58 // Audio data source from the browser process. | |
| 59 scoped_refptr<WebRtcAudioRendererSource> source_; | |
| 60 | |
| 61 // Cached values of utilized audio parameters. Platform dependent. | |
| 62 media::AudioParameters params_; | |
| 63 | |
| 64 // Buffers used for temporary storage during render callbacks. | |
| 65 // Allocated during initialization. | |
| 66 scoped_array<int16> buffer_; | |
| 67 | |
| 68 // Protect access to members above. | |
| 69 base::Lock lock_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioRenderer); | |
| 72 }; | |
| 73 | |
| 74 } // namespace content | |
| 75 | |
| 76 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ | |
| OLD | NEW |