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

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

Issue 1703473002: Make AudioOutputDevice restartable and reinitializable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_mixing
Patch Set: Created 4 years, 10 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 #include "content/renderer/media/webaudio_capturer_source.h" 5 #include "content/renderer/media/webaudio_capturer_source.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "content/renderer/media/webrtc_local_audio_track.h" 9 #include "content/renderer/media/webrtc_local_audio_track.h"
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 track_ = NULL; 78 track_ = NULL;
79 } 79 }
80 // removeFromBlinkSource() should not be called while |lock_| is acquired, 80 // removeFromBlinkSource() should not be called while |lock_| is acquired,
81 // as it could result in a deadlock. 81 // as it could result in a deadlock.
82 removeFromBlinkSource(); 82 removeFromBlinkSource();
83 } 83 }
84 84
85 void WebAudioCapturerSource::consumeAudio( 85 void WebAudioCapturerSource::consumeAudio(
86 const blink::WebVector<const float*>& audio_data, 86 const blink::WebVector<const float*>& audio_data,
87 size_t number_of_frames) { 87 size_t number_of_frames) {
88
88 base::AutoLock auto_lock(lock_); 89 base::AutoLock auto_lock(lock_);
89 if (!track_) 90 if (!track_)
90 return; 91 return;
91 92
92 // Update the downstream client if the audio format has been changed. 93 // Update the downstream client if the audio format has been changed.
93 if (audio_format_changed_) { 94 if (audio_format_changed_) {
94 track_->OnSetFormat(params_); 95 track_->OnSetFormat(params_);
95 audio_format_changed_ = false; 96 audio_format_changed_ = false;
96 } 97 }
97 98
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // WebAudioCapturerSource reference still registered as an audio consumer on 135 // WebAudioCapturerSource reference still registered as an audio consumer on
135 // the blink side. 136 // the blink side.
136 void WebAudioCapturerSource::removeFromBlinkSource() { 137 void WebAudioCapturerSource::removeFromBlinkSource() {
137 if (!blink_source_.isNull()) { 138 if (!blink_source_.isNull()) {
138 blink_source_.removeAudioConsumer(this); 139 blink_source_.removeAudioConsumer(this);
139 blink_source_.reset(); 140 blink_source_.reset();
140 } 141 }
141 } 142 }
142 143
143 } // namespace content 144 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698