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/media/audio_message_filter.h" | 5 #include "content/renderer/media/audio_message_filter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "content/common/media/audio_messages.h" | 10 #include "content/common/media/audio_messages.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 | 159 |
160 IDMap<media::AudioOutputIPCDelegate>::iterator it(&delegates_); | 160 IDMap<media::AudioOutputIPCDelegate>::iterator it(&delegates_); |
161 while (!it.IsAtEnd()) { | 161 while (!it.IsAtEnd()) { |
162 it.GetCurrentValue()->OnIPCClosed(); | 162 it.GetCurrentValue()->OnIPCClosed(); |
163 delegates_.Remove(it.GetCurrentKey()); | 163 delegates_.Remove(it.GetCurrentKey()); |
164 it.Advance(); | 164 it.Advance(); |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 void AudioMessageFilter::OnStreamCreated( | 168 void AudioMessageFilter::OnStreamCreated( |
169 int stream_id, | 169 int stream_id, base::SharedMemoryHandle handle, |
170 base::SharedMemoryHandle handle, | 170 base::SyncSocket::TransitDescriptor socket_descriptor, uint32 length) { |
nasko
2014/09/05 17:31:52
style: all parameters must be on their own line
burnik
2014/09/06 18:17:10
Done.
| |
171 #if defined(OS_WIN) | |
172 base::SyncSocket::Handle socket_handle, | |
173 #else | |
174 base::FileDescriptor socket_descriptor, | |
175 #endif | |
176 uint32 length) { | |
177 DCHECK(io_message_loop_->BelongsToCurrentThread()); | 171 DCHECK(io_message_loop_->BelongsToCurrentThread()); |
178 | 172 |
179 WebRtcLogMessage(base::StringPrintf( | 173 WebRtcLogMessage(base::StringPrintf( |
180 "AMF::OnStreamCreated. stream_id=%d", | 174 "AMF::OnStreamCreated. stream_id=%d", |
181 stream_id)); | 175 stream_id)); |
182 | 176 |
183 #if !defined(OS_WIN) | 177 base::SyncSocket::Handle socket_handle = |
184 base::SyncSocket::Handle socket_handle = socket_descriptor.fd; | 178 base::SyncSocket::UnwrapHandle(socket_descriptor); |
185 #endif | |
186 | 179 |
187 media::AudioOutputIPCDelegate* delegate = delegates_.Lookup(stream_id); | 180 media::AudioOutputIPCDelegate* delegate = delegates_.Lookup(stream_id); |
188 if (!delegate) { | 181 if (!delegate) { |
189 DLOG(WARNING) << "Got OnStreamCreated() event for a non-existent or removed" | 182 DLOG(WARNING) << "Got OnStreamCreated() event for a non-existent or removed" |
190 << " audio renderer. (stream_id=" << stream_id << ")."; | 183 << " audio renderer. (stream_id=" << stream_id << ")."; |
191 base::SharedMemory::CloseHandle(handle); | 184 base::SharedMemory::CloseHandle(handle); |
192 base::SyncSocket socket(socket_handle); | 185 base::SyncSocket socket(socket_handle); |
193 return; | 186 return; |
194 } | 187 } |
195 delegate->OnStreamCreated(handle, socket_handle, length); | 188 delegate->OnStreamCreated(handle, socket_handle, length); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 audio_hardware_config_->UpdateOutputConfig(output_params); | 234 audio_hardware_config_->UpdateOutputConfig(output_params); |
242 } | 235 } |
243 | 236 |
244 void AudioMessageFilter::SetAudioHardwareConfig( | 237 void AudioMessageFilter::SetAudioHardwareConfig( |
245 media::AudioHardwareConfig* config) { | 238 media::AudioHardwareConfig* config) { |
246 base::AutoLock auto_lock(lock_); | 239 base::AutoLock auto_lock(lock_); |
247 audio_hardware_config_ = config; | 240 audio_hardware_config_ = config; |
248 } | 241 } |
249 | 242 |
250 } // namespace content | 243 } // namespace content |
OLD | NEW |