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

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

Issue 2624403002: Refactor AudioInputController and related interfaces. (Closed)
Patch Set: Address comments Created 3 years, 11 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
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_renderer_host.h" 5 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 void AudioInputRendererHost::OnError(media::AudioInputController* controller, 151 void AudioInputRendererHost::OnError(media::AudioInputController* controller,
152 media::AudioInputController::ErrorCode error_code) { 152 media::AudioInputController::ErrorCode error_code) {
153 BrowserThread::PostTask( 153 BrowserThread::PostTask(
154 BrowserThread::IO, FROM_HERE, 154 BrowserThread::IO, FROM_HERE,
155 base::Bind(&AudioInputRendererHost::DoHandleError, this, 155 base::Bind(&AudioInputRendererHost::DoHandleError, this,
156 base::RetainedRef(controller), error_code)); 156 base::RetainedRef(controller), error_code));
157 } 157 }
158 158
159 void AudioInputRendererHost::OnData(media::AudioInputController* controller,
160 const media::AudioBus* data) {
161 NOTREACHED() << "Only low-latency mode is supported.";
162 }
163
164 void AudioInputRendererHost::OnLog(media::AudioInputController* controller, 159 void AudioInputRendererHost::OnLog(media::AudioInputController* controller,
165 const std::string& message) { 160 const std::string& message) {
166 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 161 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
167 base::Bind(&AudioInputRendererHost::DoLog, this, 162 base::Bind(&AudioInputRendererHost::DoLog, this,
168 base::RetainedRef(controller), message)); 163 base::RetainedRef(controller), message));
169 } 164 }
170 165
171 void AudioInputRendererHost::set_renderer_pid(int32_t renderer_pid) { 166 void AudioInputRendererHost::set_renderer_pid(int32_t renderer_pid) {
172 DCHECK_CURRENTLY_ON(BrowserThread::IO); 167 DCHECK_CURRENTLY_ON(BrowserThread::IO);
173 renderer_pid_ = renderer_pid; 168 renderer_pid_ = renderer_pid;
174 } 169 }
175 170
176 void AudioInputRendererHost::DoCompleteCreation( 171 void AudioInputRendererHost::DoCompleteCreation(
177 media::AudioInputController* controller) { 172 media::AudioInputController* controller) {
178 DCHECK_CURRENTLY_ON(BrowserThread::IO); 173 DCHECK_CURRENTLY_ON(BrowserThread::IO);
179 174
180 AudioEntry* entry = LookupByController(controller); 175 AudioEntry* entry = LookupByController(controller);
181 DCHECK(entry); 176 DCHECK(entry);
182 DCHECK(PeerHandle()); 177 DCHECK(PeerHandle());
183 DCHECK(entry->controller->SharedMemoryAndSyncSocketMode());
184 178
185 // Once the audio stream is created then complete the creation process by 179 // Once the audio stream is created then complete the creation process by
186 // mapping shared memory and sharing with the renderer process. 180 // mapping shared memory and sharing with the renderer process.
187 base::SharedMemoryHandle foreign_memory_handle; 181 base::SharedMemoryHandle foreign_memory_handle;
188 if (!entry->shared_memory.ShareToProcess(PeerHandle(), 182 if (!entry->shared_memory.ShareToProcess(PeerHandle(),
189 &foreign_memory_handle)) { 183 &foreign_memory_handle)) {
190 // If we failed to map and share the shared memory then close the audio 184 // If we failed to map and share the shared memory then close the audio
191 // stream and send an error message. 185 // stream and send an error message.
192 DeleteEntryOnError(entry, MEMORY_SHARING_FAILED); 186 DeleteEntryOnError(entry, MEMORY_SHARING_FAILED);
193 return; 187 return;
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 entry->controller->EnableDebugRecording( 600 entry->controller->EnableDebugRecording(
607 file_name.AddExtension(IntToStringType(stream_id)) 601 file_name.AddExtension(IntToStringType(stream_id))
608 .AddExtension(kDebugRecordingFileNameExtension)); 602 .AddExtension(kDebugRecordingFileNameExtension));
609 } 603 }
610 604
611 #undef IntToStringType 605 #undef IntToStringType
612 606
613 #endif // BUILDFLAG(ENABLE_WEBRTC) 607 #endif // BUILDFLAG(ENABLE_WEBRTC)
614 608
615 } // namespace content 609 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698