OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 -- we assume that | 7 // AlsaPcmOutputStream object is *not* thread-safe -- we assume that |
8 // client thread - creates the object and calls the public APIs. | 8 // client thread - creates the object and calls the public APIs. |
9 // message loop thread - executes all the internal tasks including querying | 9 // message loop thread - executes all the internal tasks including querying |
10 // the data source for more data, writing to the alsa device, and closing | 10 // the data source for more data, writing to the alsa device, and closing |
(...skipping 25 matching lines...) Expand all Loading... |
36 // ALSA device, and playback will effectively stop. From the client's point of | 36 // ALSA device, and playback will effectively stop. From the client's point of |
37 // view, it will seem that the device has just clogged and stopped requesting | 37 // view, it will seem that the device has just clogged and stopped requesting |
38 // data. | 38 // data. |
39 | 39 |
40 #include "media/audio/linux/alsa_output.h" | 40 #include "media/audio/linux/alsa_output.h" |
41 | 41 |
42 #include <algorithm> | 42 #include <algorithm> |
43 | 43 |
44 #include "base/logging.h" | 44 #include "base/logging.h" |
45 #include "base/message_loop.h" | 45 #include "base/message_loop.h" |
46 #include "base/stl_util-inl.h" | 46 #include "base/stl_util.h" |
47 #include "base/time.h" | 47 #include "base/time.h" |
48 #include "media/audio/audio_util.h" | 48 #include "media/audio/audio_util.h" |
49 #include "media/audio/linux/alsa_util.h" | 49 #include "media/audio/linux/alsa_util.h" |
50 #include "media/audio/linux/alsa_wrapper.h" | 50 #include "media/audio/linux/alsa_wrapper.h" |
51 #include "media/audio/linux/audio_manager_linux.h" | 51 #include "media/audio/linux/audio_manager_linux.h" |
52 #include "media/base/data_buffer.h" | 52 #include "media/base/data_buffer.h" |
53 #include "media/base/seekable_buffer.h" | 53 #include "media/base/seekable_buffer.h" |
54 | 54 |
55 // Amount of time to wait if we've exhausted the data source. This is to avoid | 55 // Amount of time to wait if we've exhausted the data source. This is to avoid |
56 // busy looping. | 56 // busy looping. |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 source_callback_->OnError(this, code); | 868 source_callback_->OnError(this, code); |
869 } | 869 } |
870 } | 870 } |
871 | 871 |
872 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 872 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
873 // release ownership of the currently registered callback. | 873 // release ownership of the currently registered callback. |
874 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { | 874 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { |
875 DCHECK_EQ(MessageLoop::current(), message_loop_); | 875 DCHECK_EQ(MessageLoop::current(), message_loop_); |
876 source_callback_ = callback; | 876 source_callback_ = callback; |
877 } | 877 } |
OLD | NEW |