OLD | NEW |
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 // THREAD SAFETY | 5 // THREAD SAFETY |
6 // | 6 // |
7 // AlsaPcmOutputStream object is *not* thread-safe and should only be used | 7 // AlsaPcmOutputStream object is *not* thread-safe and should only be used |
8 // from the audio thread. We DCHECK on this assumption whenever we can. | 8 // from the audio thread. We DCHECK on this assumption whenever we can. |
9 // | 9 // |
10 // SEMANTICS OF Close() | 10 // SEMANTICS OF Close() |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 404 |
405 media::AdjustVolume(packet->GetWritableData(), | 405 media::AdjustVolume(packet->GetWritableData(), |
406 packet_size, | 406 packet_size, |
407 output_bus->channels(), | 407 output_bus->channels(), |
408 bytes_per_sample_, | 408 bytes_per_sample_, |
409 volume_); | 409 volume_); |
410 | 410 |
411 if (packet_size > 0) { | 411 if (packet_size > 0) { |
412 packet->SetDataSize(packet_size); | 412 packet->SetDataSize(packet_size); |
413 // Add the packet to the buffer. | 413 // Add the packet to the buffer. |
414 buffer_->Append(packet); | 414 buffer_->Append(packet.get()); |
415 } else { | 415 } else { |
416 *source_exhausted = true; | 416 *source_exhausted = true; |
417 } | 417 } |
418 } | 418 } |
419 } | 419 } |
420 | 420 |
421 void AlsaPcmOutputStream::WritePacket() { | 421 void AlsaPcmOutputStream::WritePacket() { |
422 DCHECK(IsOnAudioThread()); | 422 DCHECK(IsOnAudioThread()); |
423 | 423 |
424 // If the device is in error, just eat the bytes. | 424 // If the device is in error, just eat the bytes. |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 } | 798 } |
799 | 799 |
800 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 800 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
801 // release ownership of the currently registered callback. | 801 // release ownership of the currently registered callback. |
802 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { | 802 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { |
803 DCHECK(IsOnAudioThread()); | 803 DCHECK(IsOnAudioThread()); |
804 source_callback_ = callback; | 804 source_callback_ = callback; |
805 } | 805 } |
806 | 806 |
807 } // namespace media | 807 } // namespace media |
OLD | NEW |