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 #include "content/renderer/media/webrtc_audio_device_impl.h" | 5 #include "content/renderer/media/webrtc_audio_device_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // Report unexpected sample rates using a unique histogram name. | 121 // Report unexpected sample rates using a unique histogram name. |
122 if (dir == kAudioOutput) { | 122 if (dir == kAudioOutput) { |
123 UMA_HISTOGRAM_COUNTS("WebRTC.AudioOutputFramesPerBufferUnexpected", | 123 UMA_HISTOGRAM_COUNTS("WebRTC.AudioOutputFramesPerBufferUnexpected", |
124 param); | 124 param); |
125 } else { | 125 } else { |
126 UMA_HISTOGRAM_COUNTS("WebRTC.AudioInputFramesPerBufferUnexpected", param); | 126 UMA_HISTOGRAM_COUNTS("WebRTC.AudioInputFramesPerBufferUnexpected", param); |
127 } | 127 } |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 WebRtcAudioDeviceImpl::WebRtcAudioDeviceImpl() | 131 WebRtcAudioDeviceImpl::WebRtcAudioDeviceImpl(int render_view_id) |
132 : ref_count_(0), | 132 : ref_count_(0), |
133 render_loop_(base::MessageLoopProxy::current()), | 133 render_loop_(base::MessageLoopProxy::current()), |
134 audio_transport_callback_(NULL), | 134 audio_transport_callback_(NULL), |
135 input_delay_ms_(0), | 135 input_delay_ms_(0), |
136 output_delay_ms_(0), | 136 output_delay_ms_(0), |
137 last_error_(AudioDeviceModule::kAdmErrNone), | 137 last_error_(AudioDeviceModule::kAdmErrNone), |
138 last_process_time_(base::TimeTicks::Now()), | 138 last_process_time_(base::TimeTicks::Now()), |
139 session_id_(0), | 139 session_id_(0), |
140 bytes_per_sample_(0), | 140 bytes_per_sample_(0), |
141 initialized_(false), | 141 initialized_(false), |
142 playing_(false), | 142 playing_(false), |
143 recording_(false), | 143 recording_(false), |
144 agc_is_enabled_(false) { | 144 agc_is_enabled_(false) { |
145 DVLOG(1) << "WebRtcAudioDeviceImpl::WebRtcAudioDeviceImpl()"; | 145 DVLOG(1) << "WebRtcAudioDeviceImpl::WebRtcAudioDeviceImpl()"; |
146 // TODO(henrika): remove this restriction when factory is used for the | 146 // TODO(henrika): remove this restriction when factory is used for the |
147 // input side as well. | 147 // input side as well. |
148 DCHECK(RenderThreadImpl::current()) << | 148 DCHECK(RenderThreadImpl::current()) << |
149 "WebRtcAudioDeviceImpl must be constructed on the render thread"; | 149 "WebRtcAudioDeviceImpl must be constructed on the render thread"; |
150 audio_output_device_ = AudioDeviceFactory::NewOutputDevice(); | 150 audio_output_device_ = AudioDeviceFactory::NewOutputDevice(render_view_id); |
151 DCHECK(audio_output_device_); | 151 DCHECK(audio_output_device_); |
152 } | 152 } |
153 | 153 |
154 WebRtcAudioDeviceImpl::~WebRtcAudioDeviceImpl() { | 154 WebRtcAudioDeviceImpl::~WebRtcAudioDeviceImpl() { |
155 DVLOG(1) << "WebRtcAudioDeviceImpl::~WebRtcAudioDeviceImpl()"; | 155 DVLOG(1) << "WebRtcAudioDeviceImpl::~WebRtcAudioDeviceImpl()"; |
156 if (playing_) | 156 if (playing_) |
157 StopPlayout(); | 157 StopPlayout(); |
158 if (recording_) | 158 if (recording_) |
159 StopRecording(); | 159 StopRecording(); |
160 if (initialized_) | 160 if (initialized_) |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 } | 1168 } |
1169 | 1169 |
1170 int32_t WebRtcAudioDeviceImpl::GetLoudspeakerStatus(bool* enabled) const { | 1170 int32_t WebRtcAudioDeviceImpl::GetLoudspeakerStatus(bool* enabled) const { |
1171 NOTIMPLEMENTED(); | 1171 NOTIMPLEMENTED(); |
1172 return -1; | 1172 return -1; |
1173 } | 1173 } |
1174 | 1174 |
1175 void WebRtcAudioDeviceImpl::SetSessionId(int session_id) { | 1175 void WebRtcAudioDeviceImpl::SetSessionId(int session_id) { |
1176 session_id_ = session_id; | 1176 session_id_ = session_id; |
1177 } | 1177 } |
OLD | NEW |