| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 PepperMediaStreamAudioTrackHost::AudioSink::AudioSink( | 66 PepperMediaStreamAudioTrackHost::AudioSink::AudioSink( |
| 67 PepperMediaStreamAudioTrackHost* host) | 67 PepperMediaStreamAudioTrackHost* host) |
| 68 : host_(host), | 68 : host_(host), |
| 69 buffer_data_size_(0), | 69 buffer_data_size_(0), |
| 70 active_buffer_index_(-1), | 70 active_buffer_index_(-1), |
| 71 active_buffers_generation_(0), | 71 active_buffers_generation_(0), |
| 72 active_buffer_offset_(0), | 72 active_buffer_offset_(0), |
| 73 buffers_generation_(0), | 73 buffers_generation_(0), |
| 74 main_message_loop_proxy_(base::MessageLoopProxy::current()), | 74 main_message_loop_proxy_(base::MessageLoopProxy::current()), |
| 75 weak_factory_(this), | |
| 76 number_of_buffers_(kDefaultNumberOfBuffers), | 75 number_of_buffers_(kDefaultNumberOfBuffers), |
| 77 bytes_per_second_(0), | 76 bytes_per_second_(0), |
| 78 user_buffer_duration_(kDefaultDuration) {} | 77 user_buffer_duration_(kDefaultDuration), |
| 78 weak_factory_(this) {} |
| 79 | 79 |
| 80 PepperMediaStreamAudioTrackHost::AudioSink::~AudioSink() { | 80 PepperMediaStreamAudioTrackHost::AudioSink::~AudioSink() { |
| 81 DCHECK_EQ(main_message_loop_proxy_, base::MessageLoopProxy::current()); | 81 DCHECK_EQ(main_message_loop_proxy_, base::MessageLoopProxy::current()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void PepperMediaStreamAudioTrackHost::AudioSink::EnqueueBuffer(int32_t index) { | 84 void PepperMediaStreamAudioTrackHost::AudioSink::EnqueueBuffer(int32_t index) { |
| 85 DCHECK_EQ(main_message_loop_proxy_, base::MessageLoopProxy::current()); | 85 DCHECK_EQ(main_message_loop_proxy_, base::MessageLoopProxy::current()); |
| 86 DCHECK_GE(index, 0); | 86 DCHECK_GE(index, 0); |
| 87 DCHECK_LT(index, host_->buffer_manager()->number_of_buffers()); | 87 DCHECK_LT(index, host_->buffer_manager()->number_of_buffers()); |
| 88 base::AutoLock lock(lock_); | 88 base::AutoLock lock(lock_); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 368 } |
| 369 | 369 |
| 370 void PepperMediaStreamAudioTrackHost::DidConnectPendingHostToResource() { | 370 void PepperMediaStreamAudioTrackHost::DidConnectPendingHostToResource() { |
| 371 if (!connected_) { | 371 if (!connected_) { |
| 372 MediaStreamAudioSink::AddToAudioTrack(&audio_sink_, track_); | 372 MediaStreamAudioSink::AddToAudioTrack(&audio_sink_, track_); |
| 373 connected_ = true; | 373 connected_ = true; |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 | 376 |
| 377 } // namespace content | 377 } // namespace content |
| OLD | NEW |