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

Side by Side Diff: content/renderer/pepper/pepper_media_stream_audio_track_host.cc

Issue 857093002: Set audio format before adding pepper sink to audio track. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/pepper/pepper_media_stream_audio_track_host.h" 5 #include "content/renderer/pepper/pepper_media_stream_audio_track_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 358
359 void PepperMediaStreamAudioTrackHost::OnNewBufferEnqueued() { 359 void PepperMediaStreamAudioTrackHost::OnNewBufferEnqueued() {
360 int32_t index = buffer_manager()->DequeueBuffer(); 360 int32_t index = buffer_manager()->DequeueBuffer();
361 DCHECK_GE(index, 0); 361 DCHECK_GE(index, 0);
362 audio_sink_.EnqueueBuffer(index); 362 audio_sink_.EnqueueBuffer(index);
363 } 363 }
364 364
365 void PepperMediaStreamAudioTrackHost::DidConnectPendingHostToResource() { 365 void PepperMediaStreamAudioTrackHost::DidConnectPendingHostToResource() {
366 if (!connected_) { 366 if (!connected_) {
367 media::AudioParameters format =
368 MediaStreamAudioSink::GetFormatFromAudioTrack(track_);
369 // Although this should only be called on the audio capture thread, that
370 // can't happen until the sink is added to the audio track below.
dmichael (off chromium) 2015/01/20 17:07:03 This seems kind of dangerous. Is there any way for
DaleCurtis 2015/01/20 18:46:56 Yeah the API contract should document this. I'm no
Anand Mistry (off Chromium) 2015/01/27 02:12:10 Nope. The audio capture thread is a real-time thre
371 if (format.IsValid())
372 audio_sink_.OnSetFormat(format);
373
367 MediaStreamAudioSink::AddToAudioTrack(&audio_sink_, track_); 374 MediaStreamAudioSink::AddToAudioTrack(&audio_sink_, track_);
368 connected_ = true; 375 connected_ = true;
369 } 376 }
370 } 377 }
371 378
372 } // namespace content 379 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698