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 #include "content/browser/renderer_host/media/audio_sync_reader.h" | 5 #include "content/browser/renderer_host/media/audio_sync_reader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
11 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
12 #include "media/audio/audio_buffers_state.h" | 12 #include "media/audio/audio_buffers_state.h" |
13 #include "media/audio/audio_parameters.h" | 13 #include "media/audio/audio_parameters.h" |
14 #include "media/audio/shared_memory_util.h" | 14 #include "media/audio/shared_memory_util.h" |
15 | 15 |
16 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
17 const int kMinIntervalBetweenReadCallsInMs = 10; | 17 const int kMinIntervalBetweenReadCallsInMs = 10; |
18 #endif | 18 #endif |
19 | 19 |
20 using media::AudioBus; | 20 using media::AudioBus; |
21 | 21 |
| 22 namespace content { |
| 23 |
22 AudioSyncReader::AudioSyncReader(base::SharedMemory* shared_memory, | 24 AudioSyncReader::AudioSyncReader(base::SharedMemory* shared_memory, |
23 const media::AudioParameters& params, | 25 const media::AudioParameters& params, |
24 int input_channels) | 26 int input_channels) |
25 : shared_memory_(shared_memory), | 27 : shared_memory_(shared_memory), |
26 input_channels_(input_channels) { | 28 input_channels_(input_channels) { |
27 packet_size_ = media::PacketSizeInBytes(shared_memory_->created_size()); | 29 packet_size_ = media::PacketSizeInBytes(shared_memory_->created_size()); |
28 int input_memory_size = 0; | 30 int input_memory_size = 0; |
29 int output_memory_size = AudioBus::CalculateMemorySize(params); | 31 int output_memory_size = AudioBus::CalculateMemorySize(params); |
30 if (input_channels_ > 0) { | 32 if (input_channels_ > 0) { |
31 // The input storage is after the output storage. | 33 // The input storage is after the output storage. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 bool AudioSyncReader::PrepareForeignSocketHandle( | 151 bool AudioSyncReader::PrepareForeignSocketHandle( |
150 base::ProcessHandle process_handle, | 152 base::ProcessHandle process_handle, |
151 base::FileDescriptor* foreign_handle) { | 153 base::FileDescriptor* foreign_handle) { |
152 foreign_handle->fd = foreign_socket_->handle(); | 154 foreign_handle->fd = foreign_socket_->handle(); |
153 foreign_handle->auto_close = false; | 155 foreign_handle->auto_close = false; |
154 if (foreign_handle->fd != -1) | 156 if (foreign_handle->fd != -1) |
155 return true; | 157 return true; |
156 return false; | 158 return false; |
157 } | 159 } |
158 #endif | 160 #endif |
| 161 |
| 162 } // namespace content |
OLD | NEW |