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

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

Issue 371273004: Ensures that input Pepper Flash supports the newly added AudioBus interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 5 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
« no previous file with comments | « no previous file | ppapi/proxy/DEPS » ('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_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/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "content/browser/renderer_host/media/media_stream_manager.h" 10 #include "content/browser/renderer_host/media/media_stream_manager.h"
(...skipping 10 matching lines...) Expand all
21 current_segment_id_(0), 21 current_segment_id_(0),
22 creation_time_(base::Time::Now()), 22 creation_time_(base::Time::Now()),
23 audio_bus_memory_size_(AudioBus::CalculateMemorySize(params)) { 23 audio_bus_memory_size_(AudioBus::CalculateMemorySize(params)) {
24 DCHECK_GT(shared_memory_segment_count, 0); 24 DCHECK_GT(shared_memory_segment_count, 0);
25 DCHECK_EQ(shared_memory->requested_size() % shared_memory_segment_count, 0u); 25 DCHECK_EQ(shared_memory->requested_size() % shared_memory_segment_count, 0u);
26 shared_memory_segment_size_ = 26 shared_memory_segment_size_ =
27 shared_memory->requested_size() / shared_memory_segment_count; 27 shared_memory->requested_size() / shared_memory_segment_count;
28 DVLOG(1) << "SharedMemory::requested_size: " 28 DVLOG(1) << "SharedMemory::requested_size: "
29 << shared_memory->requested_size(); 29 << shared_memory->requested_size();
30 DVLOG(1) << "shared_memory_segment_count: " << shared_memory_segment_count; 30 DVLOG(1) << "shared_memory_segment_count: " << shared_memory_segment_count;
31 DVLOG(1) << "audio_bus_memory_size: " << audio_bus_memory_size_;
31 32
32 // Create vector of audio buses by wrapping existing blocks of memory. 33 // Create vector of audio buses by wrapping existing blocks of memory.
33 uint8* ptr = static_cast<uint8*>(shared_memory_->memory()); 34 uint8* ptr = static_cast<uint8*>(shared_memory_->memory());
34 for (int i = 0; i < shared_memory_segment_count; ++i) { 35 for (int i = 0; i < shared_memory_segment_count; ++i) {
35 media::AudioInputBuffer* buffer = 36 media::AudioInputBuffer* buffer =
36 reinterpret_cast<media::AudioInputBuffer*>(ptr); 37 reinterpret_cast<media::AudioInputBuffer*>(ptr);
37 scoped_ptr<media::AudioBus> audio_bus = 38 scoped_ptr<media::AudioBus> audio_bus =
38 media::AudioBus::WrapMemory(params, buffer->audio); 39 media::AudioBus::WrapMemory(params, buffer->audio);
39 audio_buses_.push_back(audio_bus.release()); 40 audio_buses_.push_back(audio_bus.release());
40 ptr += shared_memory_segment_size_; 41 ptr += shared_memory_segment_size_;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 base::ProcessHandle process_handle, 122 base::ProcessHandle process_handle,
122 base::FileDescriptor* foreign_handle) { 123 base::FileDescriptor* foreign_handle) {
123 foreign_handle->fd = foreign_socket_->handle(); 124 foreign_handle->fd = foreign_socket_->handle();
124 foreign_handle->auto_close = false; 125 foreign_handle->auto_close = false;
125 return (foreign_handle->fd != -1); 126 return (foreign_handle->fd != -1);
126 } 127 }
127 128
128 #endif 129 #endif
129 130
130 } // namespace content 131 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698