| OLD | NEW |
| 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 Loading... |
| 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. |
| 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 |
| OLD | NEW |