OLD | NEW |
---|---|
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/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "content/renderer/media/webrtc/processed_local_audio_source.h" | 10 #include "content/renderer/media/webrtc/processed_local_audio_source.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 if (ret == 0) { | 55 if (ret == 0) { |
56 delete this; | 56 delete this; |
57 } | 57 } |
58 return ret; | 58 return ret; |
59 } | 59 } |
60 | 60 |
61 void WebRtcAudioDeviceImpl::RenderData(media::AudioBus* audio_bus, | 61 void WebRtcAudioDeviceImpl::RenderData(media::AudioBus* audio_bus, |
62 int sample_rate, | 62 int sample_rate, |
63 int audio_delay_milliseconds, | 63 int audio_delay_milliseconds, |
64 base::TimeDelta* current_time) { | 64 base::TimeDelta* current_time) { |
65 DCHECK(audio_renderer_thread_checker_.CalledOnValidThread()); | 65 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) |
66 { | |
67 base::AutoLock auto_lock(lock_); | |
tommi (sloooow) - chröme
2016/06/13 14:15:20
we grab this lock right after this block. Can we
Henrik Grunell
2016/06/13 20:38:35
Yeah, that's better locking wise (in builds with D
Henrik Grunell
2016/06/14 11:30:00
Done.
| |
68 bool on_rendering_thread = renderer_->BelongsToRenderingThread(); | |
69 DCHECK(on_rendering_thread); | |
tommi (sloooow) - chröme
2016/06/13 14:15:20
doesn't look like you need this variable. Just do
Henrik Grunell
2016/06/14 11:30:00
Oops, left by mistake. Done.
| |
70 if (!audio_renderer_thread_checker_.CalledOnValidThread()) { | |
71 for (PlayoutDataSinkList::const_iterator it = playout_sinks_.begin(); | |
tommi (sloooow) - chröme
2016/06/13 14:15:21
range based loop?
Henrik Grunell
2016/06/14 11:30:00
Done.
| |
72 it != playout_sinks_.end(); ++it) { | |
73 (*it)->OnRenderThreadChanged(); | |
74 } | |
75 } | |
76 } | |
77 #endif | |
78 | |
66 { | 79 { |
67 base::AutoLock auto_lock(lock_); | 80 base::AutoLock auto_lock(lock_); |
68 if (!playing_) { | 81 if (!playing_) { |
69 // Force silence to AudioBus after stopping playout in case | 82 // Force silence to AudioBus after stopping playout in case |
70 // there is lingering audio data in AudioBus. | 83 // there is lingering audio data in AudioBus. |
71 audio_bus->Zero(); | 84 audio_bus->Zero(); |
72 return; | 85 return; |
73 } | 86 } |
74 DCHECK(audio_transport_callback_); | 87 DCHECK(audio_transport_callback_); |
75 // Store the reported audio delay locally. | 88 // Store the reported audio delay locally. |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 | 493 |
481 *session_id = device_info.session_id; | 494 *session_id = device_info.session_id; |
482 *output_sample_rate = device_info.device.matched_output.sample_rate; | 495 *output_sample_rate = device_info.device.matched_output.sample_rate; |
483 *output_frames_per_buffer = | 496 *output_frames_per_buffer = |
484 device_info.device.matched_output.frames_per_buffer; | 497 device_info.device.matched_output.frames_per_buffer; |
485 | 498 |
486 return true; | 499 return true; |
487 } | 500 } |
488 | 501 |
489 } // namespace content | 502 } // namespace content |
OLD | NEW |