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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_SYNC_READER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_SYNC_READER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_SYNC_READER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_SYNC_READER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/file_descriptor_posix.h" | 9 #include "base/file_descriptor_posix.h" |
10 #include "base/process.h" | 10 #include "base/process.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // is used by AudioOutputController to provide a low latency data source for | 21 // is used by AudioOutputController to provide a low latency data source for |
22 // transmitting audio packets between the browser process and the renderer | 22 // transmitting audio packets between the browser process and the renderer |
23 // process. | 23 // process. |
24 class AudioSyncReader : public media::AudioOutputController::SyncReader { | 24 class AudioSyncReader : public media::AudioOutputController::SyncReader { |
25 public: | 25 public: |
26 explicit AudioSyncReader(base::SharedMemory* shared_memory); | 26 explicit AudioSyncReader(base::SharedMemory* shared_memory); |
27 | 27 |
28 virtual ~AudioSyncReader(); | 28 virtual ~AudioSyncReader(); |
29 | 29 |
30 // media::AudioOutputController::SyncReader implementations. | 30 // media::AudioOutputController::SyncReader implementations. |
31 virtual void UpdatePendingBytes(uint32 bytes); | 31 virtual void UpdatePendingBytes(uint32 bytes) OVERRIDE; |
32 virtual uint32 Read(void* data, uint32 size); | 32 virtual uint32 Read(void* data, uint32 size) OVERRIDE; |
33 virtual void Close(); | 33 virtual void Close() OVERRIDE; |
34 virtual bool DataReady(); | 34 virtual bool DataReady() OVERRIDE; |
35 | 35 |
36 bool Init(); | 36 bool Init(); |
37 bool PrepareForeignSocketHandle(base::ProcessHandle process_handle, | 37 bool PrepareForeignSocketHandle(base::ProcessHandle process_handle, |
38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
39 base::SyncSocket::Handle* foreign_handle); | 39 base::SyncSocket::Handle* foreign_handle); |
40 #else | 40 #else |
41 base::FileDescriptor* foreign_handle); | 41 base::FileDescriptor* foreign_handle); |
42 #endif | 42 #endif |
43 | 43 |
44 private: | 44 private: |
(...skipping 10 matching lines...) Expand all Loading... |
55 // Protect socket_ access by lock to prevent race condition when audio | 55 // Protect socket_ access by lock to prevent race condition when audio |
56 // controller thread closes the reader and hardware audio thread is reading | 56 // controller thread closes the reader and hardware audio thread is reading |
57 // data. This way we know that socket would not be deleted while we are | 57 // data. This way we know that socket would not be deleted while we are |
58 // writing data to it. | 58 // writing data to it. |
59 base::Lock lock_; | 59 base::Lock lock_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(AudioSyncReader); | 61 DISALLOW_COPY_AND_ASSIGN(AudioSyncReader); |
62 }; | 62 }; |
63 | 63 |
64 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_SYNC_READER_H_ | 64 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_SYNC_READER_H_ |
OLD | NEW |