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

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

Issue 15014019: Merge 198717 "Fixed the crash when the WebRtcAudioCapturer::|buf..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1500/src/
Patch Set: Created 7 years, 7 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 | « no previous file | content/renderer/media/webrtc_local_audio_track.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc_audio_capturer.cc
===================================================================
--- content/renderer/media/webrtc_audio_capturer.cc (revision 199430)
+++ content/renderer/media/webrtc_audio_capturer.cc (working copy)
@@ -201,12 +201,21 @@
void WebRtcAudioCapturer::AddSink(
WebRtcAudioCapturerSink* track) {
DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(track);
DVLOG(1) << "WebRtcAudioCapturer::AddSink()";
base::AutoLock auto_lock(lock_);
// Verify that |track| is not already added to the list.
DCHECK(std::find_if(
tracks_.begin(), tracks_.end(),
WebRtcAudioCapturerSinkOwner::WrapsSink(track)) == tracks_.end());
+
+ if (buffer_.get()) {
+ track->SetCaptureFormat(buffer_->params());
+ } else {
+ DLOG(WARNING) << "The format of the capturer has not been correctly "
+ << "initialized";
+ }
+
// Create (and add to the list) a new WebRtcAudioCapturerSinkOwner which owns
// the |track| and delagates all calls to the WebRtcAudioCapturerSink
// interface.
@@ -379,7 +388,9 @@
media::AudioParameters WebRtcAudioCapturer::audio_parameters() const {
base::AutoLock auto_lock(lock_);
- return buffer_->params();
+ // |buffer_| can be NULL when SetCapturerSource() or Initialize() has not
+ // been called.
+ return buffer_.get() ? buffer_->params() : media::AudioParameters();
}
} // namespace content
« no previous file with comments | « no previous file | content/renderer/media/webrtc_local_audio_track.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698