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 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 base::SharedMemory* shared_memory_; | 45 base::SharedMemory* shared_memory_; |
46 base::Time previous_call_time_; | 46 base::Time previous_call_time_; |
47 | 47 |
48 // Socket for transmitting audio data. | 48 // Socket for transmitting audio data. |
49 scoped_ptr<base::CancelableSyncSocket> socket_; | 49 scoped_ptr<base::CancelableSyncSocket> socket_; |
50 | 50 |
51 // Socket to be used by the renderer. The reference is released after | 51 // Socket to be used by the renderer. The reference is released after |
52 // PrepareForeignSocketHandle() is called and ran successfully. | 52 // PrepareForeignSocketHandle() is called and ran successfully. |
53 scoped_ptr<base::CancelableSyncSocket> foreign_socket_; | 53 scoped_ptr<base::CancelableSyncSocket> foreign_socket_; |
54 | 54 |
| 55 // Protect socket_ access by lock to prevent race condition when audio |
| 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 |
| 58 // writing data to it. |
| 59 base::Lock lock_; |
| 60 |
55 DISALLOW_COPY_AND_ASSIGN(AudioSyncReader); | 61 DISALLOW_COPY_AND_ASSIGN(AudioSyncReader); |
56 }; | 62 }; |
57 | 63 |
58 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_SYNC_READER_H_ | 64 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_SYNC_READER_H_ |
OLD | NEW |