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

Side by Side Diff: media/base/audio_converter.h

Issue 1211203006: Fixes issue where Web Speech API drops a frame every 5.1 seconds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 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
« no previous file with comments | « content/browser/speech/speech_recognizer_impl.cc ('k') | media/base/audio_converter.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 (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 // AudioConverter is a complete mixing, resampling, buffering, and channel 5 // AudioConverter is a complete mixing, resampling, buffering, and channel
6 // mixing solution for converting data from one set of AudioParameters to 6 // mixing solution for converting data from one set of AudioParameters to
7 // another. 7 // another.
8 // 8 //
9 // For efficiency, pieces are only invoked when necessary; i.e., 9 // For efficiency, pieces are only invoked when necessary; i.e.,
10 // - The resampler is only used if sample rates differ. 10 // - The resampler is only used if sample rates differ.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void AddInput(InputCallback* input); 83 void AddInput(InputCallback* input);
84 void RemoveInput(InputCallback* input); 84 void RemoveInput(InputCallback* input);
85 85
86 // Flushes all buffered data. 86 // Flushes all buffered data.
87 void Reset(); 87 void Reset();
88 88
89 // The maximum size in frames that guarantees we will only make a single call 89 // The maximum size in frames that guarantees we will only make a single call
90 // to each input's ProvideInput for more data. 90 // to each input's ProvideInput for more data.
91 int ChunkSize() const; 91 int ChunkSize() const;
92 92
93 // See SincResampler::PrimeWithSilence.
94 void PrimeWithSilence();
95
93 bool empty() const { return transform_inputs_.empty(); } 96 bool empty() const { return transform_inputs_.empty(); }
94 97
95 private: 98 private:
96 // Provides input to the MultiChannelResampler. Called by the resampler when 99 // Provides input to the MultiChannelResampler. Called by the resampler when
97 // more data is necessary. 100 // more data is necessary.
98 void ProvideInput(int resampler_frame_delay, AudioBus* audio_bus); 101 void ProvideInput(int resampler_frame_delay, AudioBus* audio_bus);
99 102
100 // Provides input to the AudioPullFifo. Called by the fifo when more data is 103 // Provides input to the AudioPullFifo. Called by the fifo when more data is
101 // necessary. 104 // necessary.
102 void SourceCallback(int fifo_frame_delay, AudioBus* audio_bus); 105 void SourceCallback(int fifo_frame_delay, AudioBus* audio_bus);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // value from the input AudioParameters class. Preserved to recreate internal 141 // value from the input AudioParameters class. Preserved to recreate internal
139 // AudioBus structures on demand in response to varying frame size requests. 142 // AudioBus structures on demand in response to varying frame size requests.
140 const int input_channel_count_; 143 const int input_channel_count_;
141 144
142 DISALLOW_COPY_AND_ASSIGN(AudioConverter); 145 DISALLOW_COPY_AND_ASSIGN(AudioConverter);
143 }; 146 };
144 147
145 } // namespace media 148 } // namespace media
146 149
147 #endif // MEDIA_BASE_AUDIO_CONVERTER_H_ 150 #endif // MEDIA_BASE_AUDIO_CONVERTER_H_
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer_impl.cc ('k') | media/base/audio_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698