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

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

Issue 1302423006: Ensure that data is not overwritten in the audio input shared memory ring buffer that sits on the b… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed log call expectations for Android in unit test. Rebase. Created 5 years, 3 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
« no previous file with comments | « base/sync_socket.h ('k') | content/browser/renderer_host/media/audio_input_sync_writer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 size *= entry->shared_memory_segment_count; 420 size *= entry->shared_memory_segment_count;
421 if (!size.IsValid() || 421 if (!size.IsValid() ||
422 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) { 422 !entry->shared_memory.CreateAndMapAnonymous(size.ValueOrDie())) {
423 // If creation of shared memory failed then send an error message. 423 // If creation of shared memory failed then send an error message.
424 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED); 424 SendErrorMessage(stream_id, SHARED_MEMORY_CREATE_FAILED);
425 MaybeUnregisterKeyboardMicStream(config); 425 MaybeUnregisterKeyboardMicStream(config);
426 return; 426 return;
427 } 427 }
428 428
429 scoped_ptr<AudioInputSyncWriter> writer(new AudioInputSyncWriter( 429 scoped_ptr<AudioInputSyncWriter> writer(new AudioInputSyncWriter(
430 &entry->shared_memory, entry->shared_memory_segment_count, audio_params)); 430 entry->shared_memory.memory(), entry->shared_memory.requested_size(),
431 entry->shared_memory_segment_count, audio_params));
431 432
432 if (!writer->Init()) { 433 if (!writer->Init()) {
433 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); 434 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED);
434 MaybeUnregisterKeyboardMicStream(config); 435 MaybeUnregisterKeyboardMicStream(config);
435 return; 436 return;
436 } 437 }
437 438
438 // If we have successfully created the SyncWriter then assign it to the 439 // If we have successfully created the SyncWriter then assign it to the
439 // entry and construct an AudioInputController. 440 // entry and construct an AudioInputController.
440 entry->writer.reset(writer.release()); 441 entry->writer.reset(writer.release());
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 BrowserThread::PostTask( 721 BrowserThread::PostTask(
721 BrowserThread::FILE, 722 BrowserThread::FILE,
722 FROM_HERE, 723 FROM_HERE,
723 base::Bind(&DeleteInputDebugWriterOnFileThread, 724 base::Bind(&DeleteInputDebugWriterOnFileThread,
724 base::Passed(entry->input_debug_writer.Pass()))); 725 base::Passed(entry->input_debug_writer.Pass())));
725 } 726 }
726 } 727 }
727 #endif // defined(ENABLE_WEBRTC) 728 #endif // defined(ENABLE_WEBRTC)
728 729
729 } // namespace content 730 } // namespace content
OLDNEW
« no previous file with comments | « base/sync_socket.h ('k') | content/browser/renderer_host/media/audio_input_sync_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698