| 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 #ifndef MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ | 6 #define MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 13 #include "base/sync_socket.h" | 13 #include "base/sync_socket.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "base/threading/thread_checker.h" |
| 15 #include "media/base/audio_parameters.h" | 16 #include "media/base/audio_parameters.h" |
| 16 #include "media/base/media_export.h" | 17 #include "media/base/media_export.h" |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class MessageLoop; | 20 class MessageLoop; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace media { | 23 namespace media { |
| 23 class AudioBus; | 24 class AudioBus; |
| 24 | 25 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const AudioParameters audio_parameters_; | 62 const AudioParameters audio_parameters_; |
| 62 const double samples_per_ms_; | 63 const double samples_per_ms_; |
| 63 const double bytes_per_ms_; | 64 const double bytes_per_ms_; |
| 64 const uint32_t bytes_per_frame_; | 65 const uint32_t bytes_per_frame_; |
| 65 | 66 |
| 66 base::SharedMemory shared_memory_; | 67 base::SharedMemory shared_memory_; |
| 67 const int memory_length_; | 68 const int memory_length_; |
| 68 const int total_segments_; | 69 const int total_segments_; |
| 69 int segment_length_; | 70 int segment_length_; |
| 70 | 71 |
| 72 // Detached in constructor and attached in InitializeOnAudioThread() which |
| 73 // is called on the audio device thread. Sub-classes can then use it for |
| 74 // various thread checking purposes. |
| 75 base::ThreadChecker thread_checker_; |
| 76 |
| 71 private: | 77 private: |
| 72 DISALLOW_COPY_AND_ASSIGN(Callback); | 78 DISALLOW_COPY_AND_ASSIGN(Callback); |
| 73 }; | 79 }; |
| 74 | 80 |
| 75 AudioDeviceThread(); | 81 AudioDeviceThread(); |
| 76 ~AudioDeviceThread(); | 82 ~AudioDeviceThread(); |
| 77 | 83 |
| 78 // Starts the audio thread. The thread must not already be running. If | 84 // Starts the audio thread. The thread must not already be running. If |
| 79 // |sychronized_buffers| is set, the browser expects to be notified via the | 85 // |sychronized_buffers| is set, the browser expects to be notified via the |
| 80 // |socket| every time AudioDeviceThread::Process() completes. | 86 // |socket| every time AudioDeviceThread::Process() completes. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 109 | 115 |
| 110 base::Lock thread_lock_; | 116 base::Lock thread_lock_; |
| 111 scoped_refptr<AudioDeviceThread::Thread> thread_; | 117 scoped_refptr<AudioDeviceThread::Thread> thread_; |
| 112 | 118 |
| 113 DISALLOW_COPY_AND_ASSIGN(AudioDeviceThread); | 119 DISALLOW_COPY_AND_ASSIGN(AudioDeviceThread); |
| 114 }; | 120 }; |
| 115 | 121 |
| 116 } // namespace media. | 122 } // namespace media. |
| 117 | 123 |
| 118 #endif // MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ | 124 #endif // MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ |
| OLD | NEW |