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

Unified Diff: content/renderer/media/webrtc_local_audio_track.cc

Issue 25062005: Add ability to determine if a capture sink is a renderer. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/webrtc_local_audio_renderer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc_local_audio_track.cc
diff --git a/content/renderer/media/webrtc_local_audio_track.cc b/content/renderer/media/webrtc_local_audio_track.cc
index 37846335e8531270c5c6c66658c400137b82bcf4..832f3ec9d3e2b21a507e549b553dfa8570d7e9be 100644
--- a/content/renderer/media/webrtc_local_audio_track.cc
+++ b/content/renderer/media/webrtc_local_audio_track.cc
@@ -154,13 +154,10 @@ void WebRtcLocalAudioTrack::Capture(media::AudioBus* audio_source,
int number_of_frames = 0;
SinkList sinks;
scoped_refptr<ConfiguredBuffer> current_buffer;
+ bool is_enabled = true;
{
base::AutoLock auto_lock(lock_);
- // When the track is disabled, we simply return here.
- // TODO(xians): Figure out if we should feed zero to sinks instead, in
- // order to inject VAD data in such case.
- if (!enabled())
- return;
+ is_enabled = enabled();
capturer = capturer_;
voe_channels = voe_channels_;
@@ -180,7 +177,16 @@ void WebRtcLocalAudioTrack::Capture(media::AudioBus* audio_source,
int current_volume = volume;
while (current_buffer->Consume()) {
// Feed the data to the sinks.
- for (SinkList::const_iterator it = sinks.begin(); it != sinks.end(); ++it) {
+ SinkList::iterator first = sinks.begin();
+ SinkList::iterator last = sinks.begin();
+ if (!is_enabled) {
+ // Don't call capture sinks which are actually renderers.
+ last = std::remove_if(first, last,
ajm 2013/09/28 01:52:22 Not sure if this will do the right thing; I haven'
+ [](const scoped_refptr<WebRtcAudioCapturerSinkOwner>& owner) {
+ return owner->HasRenderer();
+ });
+ }
+ for (SinkList::const_iterator it = first; it != last; ++it) {
int new_volume = (*it)->CaptureData(voe_channels,
current_buffer->buffer(),
sample_rate,
« no previous file with comments | « content/renderer/media/webrtc_local_audio_renderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698