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

Side by Side Diff: content/renderer/media/webrtc_audio_device_impl.cc

Issue 503683003: Remove implicit conversions from scoped_refptr to T* in content/renderer/media/webrtc* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // Pass the render data to the playout sinks. 195 // Pass the render data to the playout sinks.
196 base::AutoLock auto_lock(lock_); 196 base::AutoLock auto_lock(lock_);
197 for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin(); 197 for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin();
198 it != playout_sinks_.end(); ++it) { 198 it != playout_sinks_.end(); ++it) {
199 (*it)->OnPlayoutData(audio_bus, sample_rate, audio_delay_milliseconds); 199 (*it)->OnPlayoutData(audio_bus, sample_rate, audio_delay_milliseconds);
200 } 200 }
201 } 201 }
202 202
203 void WebRtcAudioDeviceImpl::RemoveAudioRenderer(WebRtcAudioRenderer* renderer) { 203 void WebRtcAudioDeviceImpl::RemoveAudioRenderer(WebRtcAudioRenderer* renderer) {
204 DCHECK(thread_checker_.CalledOnValidThread()); 204 DCHECK(thread_checker_.CalledOnValidThread());
205 DCHECK_EQ(renderer, renderer_); 205 DCHECK_EQ(renderer, renderer_.get());
206 base::AutoLock auto_lock(lock_); 206 base::AutoLock auto_lock(lock_);
207 // Notify the playout sink of the change. 207 // Notify the playout sink of the change.
208 for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin(); 208 for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin();
209 it != playout_sinks_.end(); ++it) { 209 it != playout_sinks_.end(); ++it) {
210 (*it)->OnPlayoutDataSourceChanged(); 210 (*it)->OnPlayoutDataSourceChanged();
211 } 211 }
212 212
213 renderer_ = NULL; 213 renderer_ = NULL;
214 playing_ = false; 214 playing_ = false;
215 } 215 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 return 0; 394 return 0;
395 } 395 }
396 396
397 int32_t WebRtcAudioDeviceImpl::MinMicrophoneVolume(uint32_t* min_volume) const { 397 int32_t WebRtcAudioDeviceImpl::MinMicrophoneVolume(uint32_t* min_volume) const {
398 *min_volume = 0; 398 *min_volume = 0;
399 return 0; 399 return 0;
400 } 400 }
401 401
402 int32_t WebRtcAudioDeviceImpl::StereoPlayoutIsAvailable(bool* available) const { 402 int32_t WebRtcAudioDeviceImpl::StereoPlayoutIsAvailable(bool* available) const {
403 DCHECK(initialized_); 403 DCHECK(initialized_);
404 *available = renderer_ && renderer_->channels() == 2; 404 *available = renderer_.get() && renderer_->channels() == 2;
405 return 0; 405 return 0;
406 } 406 }
407 407
408 int32_t WebRtcAudioDeviceImpl::StereoRecordingIsAvailable( 408 int32_t WebRtcAudioDeviceImpl::StereoRecordingIsAvailable(
409 bool* available) const { 409 bool* available) const {
410 DCHECK(initialized_); 410 DCHECK(initialized_);
411 // TODO(xians): These kind of hardware methods do not make much sense since we 411 // TODO(xians): These kind of hardware methods do not make much sense since we
412 // support multiple sources. Remove or figure out new APIs for such methods. 412 // support multiple sources. Remove or figure out new APIs for such methods.
413 scoped_refptr<WebRtcAudioCapturer> capturer(GetDefaultCapturer()); 413 scoped_refptr<WebRtcAudioCapturer> capturer(GetDefaultCapturer());
414 if (!capturer.get()) 414 if (!capturer.get())
(...skipping 22 matching lines...) Expand all
437 if (!capturer.get()) 437 if (!capturer.get())
438 return -1; 438 return -1;
439 439
440 *sample_rate = static_cast<uint32_t>( 440 *sample_rate = static_cast<uint32_t>(
441 capturer->source_audio_parameters().sample_rate()); 441 capturer->source_audio_parameters().sample_rate());
442 return 0; 442 return 0;
443 } 443 }
444 444
445 int32_t WebRtcAudioDeviceImpl::PlayoutSampleRate( 445 int32_t WebRtcAudioDeviceImpl::PlayoutSampleRate(
446 uint32_t* sample_rate) const { 446 uint32_t* sample_rate) const {
447 *sample_rate = renderer_ ? renderer_->sample_rate() : 0; 447 *sample_rate = renderer_.get() ? renderer_->sample_rate() : 0;
448 return 0; 448 return 0;
449 } 449 }
450 450
451 bool WebRtcAudioDeviceImpl::SetAudioRenderer(WebRtcAudioRenderer* renderer) { 451 bool WebRtcAudioDeviceImpl::SetAudioRenderer(WebRtcAudioRenderer* renderer) {
452 DCHECK(thread_checker_.CalledOnValidThread()); 452 DCHECK(thread_checker_.CalledOnValidThread());
453 DCHECK(renderer); 453 DCHECK(renderer);
454 454
455 base::AutoLock auto_lock(lock_); 455 base::AutoLock auto_lock(lock_);
456 if (renderer_.get()) 456 if (renderer_.get())
457 return false; 457 return false;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 // If there is no capturer or there are more than one open capture devices, 520 // If there is no capturer or there are more than one open capture devices,
521 // return false. 521 // return false.
522 if (capturers_.empty() || capturers_.size() > 1) 522 if (capturers_.empty() || capturers_.size() > 1)
523 return false; 523 return false;
524 524
525 return GetDefaultCapturer()->GetPairedOutputParameters( 525 return GetDefaultCapturer()->GetPairedOutputParameters(
526 session_id, output_sample_rate, output_frames_per_buffer); 526 session_id, output_sample_rate, output_frames_per_buffer);
527 } 527 }
528 528
529 } // namespace content 529 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer_unittest.cc ('k') | content/renderer/media/webrtc_audio_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698