Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: content/browser/renderer_host/media/audio_input_sync_writer.cc

Issue 9317001: Revert 119769 - Switch AudioDevice classes from SyncSocket to CancelableSyncSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_input_sync_writer.h" 5 #include "content/browser/renderer_host/media/audio_input_sync_writer.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"
(...skipping 13 matching lines...) Expand all
24 // Copy audio input samples from recorded data to shared memory. 24 // Copy audio input samples from recorded data to shared memory.
25 memcpy(shared_memory_->memory(), data, write_size); 25 memcpy(shared_memory_->memory(), data, write_size);
26 return write_size; 26 return write_size;
27 } 27 }
28 28
29 void AudioInputSyncWriter::Close() { 29 void AudioInputSyncWriter::Close() {
30 socket_->Close(); 30 socket_->Close();
31 } 31 }
32 32
33 bool AudioInputSyncWriter::Init() { 33 bool AudioInputSyncWriter::Init() {
34 socket_.reset(new base::CancelableSyncSocket()); 34 socket_.reset(new base::SyncSocket());
35 foreign_socket_.reset(new base::CancelableSyncSocket()); 35 foreign_socket_.reset(new base::SyncSocket());
36 return base::CancelableSyncSocket::CreatePair(socket_.get(), 36 return base::SyncSocket::CreatePair(socket_.get(), foreign_socket_.get());
37 foreign_socket_.get());
38 } 37 }
39 38
40 #if defined(OS_WIN) 39 #if defined(OS_WIN)
41 40
42 bool AudioInputSyncWriter::PrepareForeignSocketHandle( 41 bool AudioInputSyncWriter::PrepareForeignSocketHandle(
43 base::ProcessHandle process_handle, 42 base::ProcessHandle process_handle,
44 base::SyncSocket::Handle* foreign_handle) { 43 base::SyncSocket::Handle* foreign_handle) {
45 ::DuplicateHandle(GetCurrentProcess(), foreign_socket_->handle(), 44 ::DuplicateHandle(GetCurrentProcess(), foreign_socket_->handle(),
46 process_handle, foreign_handle, 45 process_handle, foreign_handle,
47 0, FALSE, DUPLICATE_SAME_ACCESS); 46 0, FALSE, DUPLICATE_SAME_ACCESS);
48 return (*foreign_handle != 0); 47 return (*foreign_handle != 0);
49 } 48 }
50 49
51 #else 50 #else
52 51
53 bool AudioInputSyncWriter::PrepareForeignSocketHandle( 52 bool AudioInputSyncWriter::PrepareForeignSocketHandle(
54 base::ProcessHandle process_handle, 53 base::ProcessHandle process_handle,
55 base::FileDescriptor* foreign_handle) { 54 base::FileDescriptor* foreign_handle) {
56 foreign_handle->fd = foreign_socket_->handle(); 55 foreign_handle->fd = foreign_socket_->handle();
57 foreign_handle->auto_close = false; 56 foreign_handle->auto_close = false;
58 return (foreign_handle->fd != -1); 57 return (foreign_handle->fd != -1);
59 } 58 }
60 59
61 #endif 60 #endif
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/audio_input_sync_writer.h ('k') | content/browser/renderer_host/media/audio_sync_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698