Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1108)

Side by Side Diff: content/renderer/media/webrtc_local_audio_renderer.h

Issue 23731007: Implicit audio output device selection for getUserMedia. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 // Tracking this at http://crbug.com/164813. 41 // Tracking this at http://crbug.com/164813.
42 class CONTENT_EXPORT WebRtcLocalAudioRenderer 42 class CONTENT_EXPORT WebRtcLocalAudioRenderer
43 : NON_EXPORTED_BASE(public MediaStreamAudioRenderer), 43 : NON_EXPORTED_BASE(public MediaStreamAudioRenderer),
44 NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback), 44 NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback),
45 NON_EXPORTED_BASE(public WebRtcAudioCapturerSink) { 45 NON_EXPORTED_BASE(public WebRtcAudioCapturerSink) {
46 public: 46 public:
47 // Creates a local renderer and registers a capturing |source| object. 47 // Creates a local renderer and registers a capturing |source| object.
48 // The |source| is owned by the WebRtcAudioDeviceImpl. 48 // The |source| is owned by the WebRtcAudioDeviceImpl.
49 // Called on the main thread. 49 // Called on the main thread.
50 WebRtcLocalAudioRenderer(WebRtcLocalAudioTrack* audio_track, 50 WebRtcLocalAudioRenderer(WebRtcLocalAudioTrack* audio_track,
51 int source_render_view_id); 51 int source_render_view_id,
52 int session_id,
53 int sample_rate,
54 int frames_per_buffer);
52 55
53 // MediaStreamAudioRenderer implementation. 56 // MediaStreamAudioRenderer implementation.
54 // Called on the main thread. 57 // Called on the main thread.
55 virtual void Start() OVERRIDE; 58 virtual void Start() OVERRIDE;
56 virtual void Stop() OVERRIDE; 59 virtual void Stop() OVERRIDE;
57 virtual void Play() OVERRIDE; 60 virtual void Play() OVERRIDE;
58 virtual void Pause() OVERRIDE; 61 virtual void Pause() OVERRIDE;
59 virtual void SetVolume(float volume) OVERRIDE; 62 virtual void SetVolume(float volume) OVERRIDE;
60 virtual base::TimeDelta GetCurrentRenderTime() const OVERRIDE; 63 virtual base::TimeDelta GetCurrentRenderTime() const OVERRIDE;
61 virtual bool IsLocalRenderer() const OVERRIDE; 64 virtual bool IsLocalRenderer() const OVERRIDE;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // The audio track which provides data to render. Given that this class 97 // The audio track which provides data to render. Given that this class
95 // implements local loopback, the audio track is getting data from a capture 98 // implements local loopback, the audio track is getting data from a capture
96 // instance like a selected microphone and forwards the recorded data to its 99 // instance like a selected microphone and forwards the recorded data to its
97 // sinks. The recorded data is stored in a FIFO and consumed 100 // sinks. The recorded data is stored in a FIFO and consumed
98 // by this class when the sink asks for new data. 101 // by this class when the sink asks for new data.
99 // The WebRtcAudioCapturer is today created by WebRtcAudioDeviceImpl. 102 // The WebRtcAudioCapturer is today created by WebRtcAudioDeviceImpl.
100 scoped_refptr<WebRtcLocalAudioTrack> audio_track_; 103 scoped_refptr<WebRtcLocalAudioTrack> audio_track_;
101 104
102 // The render view in which the audio is rendered into |sink_|. 105 // The render view in which the audio is rendered into |sink_|.
103 const int source_render_view_id_; 106 const int source_render_view_id_;
107 const int session_id_;
104 108
105 // The sink (destination) for rendered audio. 109 // The sink (destination) for rendered audio.
106 scoped_refptr<media::AudioOutputDevice> sink_; 110 scoped_refptr<media::AudioOutputDevice> sink_;
107 111
108 // Used to DCHECK that we are called on the correct thread. 112 // Used to DCHECK that we are called on the correct thread.
109 base::ThreadChecker thread_checker_; 113 base::ThreadChecker thread_checker_;
110 114
111 // Contains copies of captured audio frames. 115 // Contains copies of captured audio frames.
112 scoped_ptr<media::AudioFifo> loopback_fifo_; 116 scoped_ptr<media::AudioFifo> loopback_fifo_;
113 117
114 // Stores last time a render callback was received. The time difference 118 // Stores last time a render callback was received. The time difference
115 // between a new time stamp and this value can be used to derive the 119 // between a new time stamp and this value can be used to derive the
116 // total render time. 120 // total render time.
117 base::Time last_render_time_; 121 base::Time last_render_time_;
118 122
119 // Keeps track of total time audio has been rendered. 123 // Keeps track of total time audio has been rendered.
120 base::TimeDelta total_render_time_; 124 base::TimeDelta total_render_time_;
121 125
122 // The audio parameters used by the renderer. 126 // The audio parameters used by the renderer.
123 media::AudioParameters audio_params_; 127 media::AudioParameters audio_params_;
124 128
125 // Set when playing, cleared when paused. 129 // Set when playing, cleared when paused.
126 bool playing_; 130 bool playing_;
127 131
128 // Protects |loopback_fifo_|, |playing_| and |sink_|. 132 // Protects |loopback_fifo_|, |playing_| and |sink_|.
129 mutable base::Lock thread_lock_; 133 mutable base::Lock thread_lock_;
130 134
135 // The preferred sample rate and buffer sizes provided via the ctor.
136 const int sample_rate_;
137 const int frames_per_buffer_;
138
139 // The preferred device id of the output device or empty for the default
140 // output device.
141 const std::string output_device_id_;
142
131 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioRenderer); 143 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioRenderer);
132 }; 144 };
133 145
134 } // namespace content 146 } // namespace content
135 147
136 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_RENDERER_H_ 148 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_renderer.cc ('k') | content/renderer/media/webrtc_local_audio_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698