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

Side by Side Diff: content/renderer/media/media_stream_audio_processor.cc

Issue 308643004: changed MSAP to work with 96000KHZ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed the comment. Created 6 years, 6 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 | content/renderer/media/media_stream_audio_processor_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/media_stream_audio_processor.h" 5 #include "content/renderer/media/media_stream_audio_processor.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 MediaStreamAudioConverter(const media::AudioParameters& source_params, 57 MediaStreamAudioConverter(const media::AudioParameters& source_params,
58 const media::AudioParameters& sink_params) 58 const media::AudioParameters& sink_params)
59 : source_params_(source_params), 59 : source_params_(source_params),
60 sink_params_(sink_params), 60 sink_params_(sink_params),
61 audio_converter_(source_params, sink_params_, false) { 61 audio_converter_(source_params, sink_params_, false) {
62 // An instance of MediaStreamAudioConverter may be created in the main 62 // An instance of MediaStreamAudioConverter may be created in the main
63 // render thread and used in the audio thread, for example, the 63 // render thread and used in the audio thread, for example, the
64 // |MediaStreamAudioProcessor::capture_converter_|. 64 // |MediaStreamAudioProcessor::capture_converter_|.
65 thread_checker_.DetachFromThread(); 65 thread_checker_.DetachFromThread();
66 audio_converter_.AddInput(this); 66 audio_converter_.AddInput(this);
67
67 // Create and initialize audio fifo and audio bus wrapper. 68 // Create and initialize audio fifo and audio bus wrapper.
68 // The size of the FIFO should be at least twice of the source buffer size 69 // The size of the FIFO should be at least twice of the source buffer size
69 // or twice of the sink buffer size. 70 // or twice of the sink buffer size. Also, FIFO needs to have enough space
71 // to store pre-processed data before passing the data to
72 // webrtc::AudioProcessing, which requires 10ms as packet size.
73 int max_frame_size = std::max(source_params_.frames_per_buffer(),
74 sink_params_.frames_per_buffer());
70 int buffer_size = std::max( 75 int buffer_size = std::max(
71 kMaxNumberOfBuffersInFifo * source_params_.frames_per_buffer(), 76 kMaxNumberOfBuffersInFifo * max_frame_size,
72 kMaxNumberOfBuffersInFifo * sink_params_.frames_per_buffer()); 77 kMaxNumberOfBuffersInFifo * source_params_.sample_rate() / 100);
73 fifo_.reset(new media::AudioFifo(source_params_.channels(), buffer_size)); 78 fifo_.reset(new media::AudioFifo(source_params_.channels(), buffer_size));
79
74 // TODO(xians): Use CreateWrapper to save one memcpy. 80 // TODO(xians): Use CreateWrapper to save one memcpy.
75 audio_wrapper_ = media::AudioBus::Create(sink_params_.channels(), 81 audio_wrapper_ = media::AudioBus::Create(sink_params_.channels(),
76 sink_params_.frames_per_buffer()); 82 sink_params_.frames_per_buffer());
77 } 83 }
78 84
79 virtual ~MediaStreamAudioConverter() { 85 virtual ~MediaStreamAudioConverter() {
80 audio_converter_.RemoveInput(this); 86 audio_converter_.RemoveInput(this);
81 } 87 }
82 88
83 void Push(media::AudioBus* audio_source) { 89 void Push(media::AudioBus* audio_source) {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 497
492 StopAecDump(); 498 StopAecDump();
493 499
494 if (playout_data_source_) 500 if (playout_data_source_)
495 playout_data_source_->RemovePlayoutSink(this); 501 playout_data_source_->RemovePlayoutSink(this);
496 502
497 audio_processing_.reset(); 503 audio_processing_.reset();
498 } 504 }
499 505
500 } // namespace content 506 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_stream_audio_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698