OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 774 |
775 bool AlsaPcmOutputStream::IsOnAudioThread() const { | 775 bool AlsaPcmOutputStream::IsOnAudioThread() const { |
776 return message_loop_ && message_loop_ == base::MessageLoop::current(); | 776 return message_loop_ && message_loop_ == base::MessageLoop::current(); |
777 } | 777 } |
778 | 778 |
779 int AlsaPcmOutputStream::RunDataCallback(AudioBus* audio_bus, | 779 int AlsaPcmOutputStream::RunDataCallback(AudioBus* audio_bus, |
780 uint32 total_bytes_delay) { | 780 uint32 total_bytes_delay) { |
781 TRACE_EVENT0("audio", "AlsaPcmOutputStream::RunDataCallback"); | 781 TRACE_EVENT0("audio", "AlsaPcmOutputStream::RunDataCallback"); |
782 | 782 |
783 if (source_callback_) | 783 if (source_callback_) |
784 return source_callback_->OnMoreData(audio_bus, total_bytes_delay); | 784 return source_callback_->OnMoreData(audio_bus, total_bytes_delay, 0); |
785 | 785 |
786 return 0; | 786 return 0; |
787 } | 787 } |
788 | 788 |
789 void AlsaPcmOutputStream::RunErrorCallback(int code) { | 789 void AlsaPcmOutputStream::RunErrorCallback(int code) { |
790 if (source_callback_) | 790 if (source_callback_) |
791 source_callback_->OnError(this); | 791 source_callback_->OnError(this); |
792 } | 792 } |
793 | 793 |
794 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 794 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
795 // release ownership of the currently registered callback. | 795 // release ownership of the currently registered callback. |
796 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { | 796 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { |
797 DCHECK(IsOnAudioThread()); | 797 DCHECK(IsOnAudioThread()); |
798 source_callback_ = callback; | 798 source_callback_ = callback; |
799 } | 799 } |
800 | 800 |
801 } // namespace media | 801 } // namespace media |
OLD | NEW |