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_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 DLOG(WARNING) << "Renderer process handle is invalid."; | 106 DLOG(WARNING) << "Renderer process handle is invalid."; |
107 OnStreamError(stream_id); | 107 OnStreamError(stream_id); |
108 return; | 108 return; |
109 } | 109 } |
110 | 110 |
111 if (!LookupById(stream_id)) { | 111 if (!LookupById(stream_id)) { |
112 OnStreamError(stream_id); | 112 OnStreamError(stream_id); |
113 return; | 113 return; |
114 } | 114 } |
115 | 115 |
116 base::SharedMemoryHandle foreign_memory_handle; | |
117 base::SyncSocket::TransitDescriptor socket_descriptor; | 116 base::SyncSocket::TransitDescriptor socket_descriptor; |
118 size_t shared_memory_size = shared_memory->requested_size(); | 117 size_t shared_memory_size = shared_memory->requested_size(); |
119 | 118 |
120 if (!(shared_memory->ShareToProcess(PeerHandle(), &foreign_memory_handle) && | 119 base::SharedMemoryHandle foreign_memory_handle = |
| 120 shared_memory->handle().Duplicate(); |
| 121 if (!(foreign_memory_handle.IsValid() && |
121 foreign_socket->PrepareTransitDescriptor(PeerHandle(), | 122 foreign_socket->PrepareTransitDescriptor(PeerHandle(), |
122 &socket_descriptor))) { | 123 &socket_descriptor))) { |
123 // Something went wrong in preparing the IPC handles. | 124 // Something went wrong in preparing the IPC handles. |
124 OnStreamError(stream_id); | 125 OnStreamError(stream_id); |
125 return; | 126 return; |
126 } | 127 } |
127 | 128 |
128 Send(new AudioMsg_NotifyStreamCreated( | 129 Send(new AudioMsg_NotifyStreamCreated( |
129 stream_id, foreign_memory_handle, socket_descriptor, | 130 stream_id, foreign_memory_handle, socket_descriptor, |
130 base::checked_cast<uint32_t>(shared_memory_size))); | 131 base::checked_cast<uint32_t>(shared_memory_size))); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 377 |
377 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { | 378 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { |
378 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 379 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
379 return authorizations_.find(stream_id) != authorizations_.end(); | 380 return authorizations_.find(stream_id) != authorizations_.end(); |
380 } | 381 } |
381 | 382 |
382 void AudioRendererHost::OverrideDevicePermissionsForTesting(bool has_access) { | 383 void AudioRendererHost::OverrideDevicePermissionsForTesting(bool has_access) { |
383 authorization_handler_.OverridePermissionsForTesting(has_access); | 384 authorization_handler_.OverridePermissionsForTesting(has_access); |
384 } | 385 } |
385 } // namespace content | 386 } // namespace content |
OLD | NEW |