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/renderer/pepper/pepper_platform_audio_input.h" | 5 #include "content/renderer/pepper/pepper_platform_audio_input.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 void PepperPlatformAudioInput::OnStreamCreated( | 81 void PepperPlatformAudioInput::OnStreamCreated( |
82 base::SharedMemoryHandle handle, | 82 base::SharedMemoryHandle handle, |
83 base::SyncSocket::Handle socket_handle, | 83 base::SyncSocket::Handle socket_handle, |
84 int length, | 84 int length, |
85 int total_segments) { | 85 int total_segments) { |
86 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
87 DCHECK(handle); | 87 DCHECK(handle); |
88 DCHECK(socket_handle); | 88 DCHECK(socket_handle); |
89 #else | 89 #else |
90 DCHECK_NE(-1, handle.fd); | 90 DCHECK(base::SharedMemory::IsHandleValid(handle)); |
91 DCHECK_NE(-1, socket_handle); | 91 DCHECK_NE(-1, socket_handle); |
92 #endif | 92 #endif |
93 DCHECK(length); | 93 DCHECK(length); |
94 // TODO(yzshen): Make use of circular buffer scheme. crbug.com/181449. | 94 // TODO(yzshen): Make use of circular buffer scheme. crbug.com/181449. |
95 DCHECK_EQ(1, total_segments); | 95 DCHECK_EQ(1, total_segments); |
96 | 96 |
97 if (base::ThreadTaskRunnerHandle::Get().get() != main_task_runner_.get()) { | 97 if (base::ThreadTaskRunnerHandle::Get().get() != main_task_runner_.get()) { |
98 // If shutdown has occurred, |client_| will be NULL and the handles will be | 98 // If shutdown has occurred, |client_| will be NULL and the handles will be |
99 // cleaned up on the main thread. | 99 // cleaned up on the main thread. |
100 main_task_runner_->PostTask( | 100 main_task_runner_->PostTask( |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 PepperMediaDeviceManager* PepperPlatformAudioInput::GetMediaDeviceManager() { | 281 PepperMediaDeviceManager* PepperPlatformAudioInput::GetMediaDeviceManager() { |
282 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 282 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
283 | 283 |
284 RenderFrameImpl* const render_frame = | 284 RenderFrameImpl* const render_frame = |
285 RenderFrameImpl::FromRoutingID(render_frame_id_); | 285 RenderFrameImpl::FromRoutingID(render_frame_id_); |
286 return render_frame ? | 286 return render_frame ? |
287 PepperMediaDeviceManager::GetForRenderFrame(render_frame).get() : NULL; | 287 PepperMediaDeviceManager::GetForRenderFrame(render_frame).get() : NULL; |
288 } | 288 } |
289 | 289 |
290 } // namespace content | 290 } // namespace content |
OLD | NEW |