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

Side by Side Diff: media/base/audio_pull_fifo.cc

Issue 11410012: Collapse AudioRendererMixer and OnMoreDataResampler into AudioTransform. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename. Comments. Created 8 years 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 | « media/base/audio_pull_fifo.h ('k') | media/base/audio_pull_fifo_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 (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 "media/base/audio_pull_fifo.h" 5 #include "media/base/audio_pull_fifo.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 int write_pos = 0; 27 int write_pos = 0;
28 int remaining_frames_to_provide = frames_to_consume; 28 int remaining_frames_to_provide = frames_to_consume;
29 29
30 // Try to fulfill the request using what's available in the FIFO. 30 // Try to fulfill the request using what's available in the FIFO.
31 ReadFromFifo(destination, &remaining_frames_to_provide, &write_pos); 31 ReadFromFifo(destination, &remaining_frames_to_provide, &write_pos);
32 32
33 // Get the remaining audio frames from the producer using the callback. 33 // Get the remaining audio frames from the producer using the callback.
34 while (remaining_frames_to_provide > 0) { 34 while (remaining_frames_to_provide > 0) {
35 // Fill up the FIFO by acquiring audio data from the producer. 35 // Fill up the FIFO by acquiring audio data from the producer.
36 read_cb_.Run(bus_.get()); 36 read_cb_.Run(write_pos, bus_.get());
37 fifo_->Push(bus_.get()); 37 fifo_->Push(bus_.get());
38 38
39 // Try to fulfill the request using what's available in the FIFO. 39 // Try to fulfill the request using what's available in the FIFO.
40 ReadFromFifo(destination, &remaining_frames_to_provide, &write_pos); 40 ReadFromFifo(destination, &remaining_frames_to_provide, &write_pos);
41 } 41 }
42 } 42 }
43 43
44 void AudioPullFifo::Clear() { 44 void AudioPullFifo::Clear() {
45 fifo_->Clear(); 45 fifo_->Clear();
46 } 46 }
47 47
48 void AudioPullFifo::ReadFromFifo(AudioBus* destination, 48 void AudioPullFifo::ReadFromFifo(AudioBus* destination,
49 int* frames_to_provide, 49 int* frames_to_provide,
50 int* write_pos) { 50 int* write_pos) {
51 DCHECK(frames_to_provide); 51 DCHECK(frames_to_provide);
52 DCHECK(write_pos); 52 DCHECK(write_pos);
53 int frames = std::min(fifo_->frames(), *frames_to_provide); 53 int frames = std::min(fifo_->frames(), *frames_to_provide);
54 fifo_->Consume(destination, *write_pos, frames); 54 fifo_->Consume(destination, *write_pos, frames);
55 *write_pos += frames; 55 *write_pos += frames;
56 *frames_to_provide -= frames; 56 *frames_to_provide -= frames;
57 } 57 }
58 58
59 } // namespace media 59 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_pull_fifo.h ('k') | media/base/audio_pull_fifo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698