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

Side by Side Diff: media/filters/audio_renderer_base.cc

Issue 42635: Lots of files touched for a very simple change. Everywhere we used a const M... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « media/filters/audio_renderer_base.h ('k') | media/filters/audio_renderer_impl.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/filter_host.h" 5 #include "media/base/filter_host.h"
6 #include "media/filters/audio_renderer_base.h" 6 #include "media/filters/audio_renderer_base.h"
7 7
8 namespace media { 8 namespace media {
9 9
10 // The maximum size of the queue, which also acts as the number of initial reads 10 // The maximum size of the queue, which also acts as the number of initial reads
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 bool AudioRendererBase::Initialize(AudioDecoder* decoder) { 45 bool AudioRendererBase::Initialize(AudioDecoder* decoder) {
46 DCHECK(decoder); 46 DCHECK(decoder);
47 decoder_ = decoder; 47 decoder_ = decoder;
48 48
49 // Schedule our initial reads. 49 // Schedule our initial reads.
50 for (size_t i = 0; i < max_queue_size_; ++i) { 50 for (size_t i = 0; i < max_queue_size_; ++i) {
51 ScheduleRead(); 51 ScheduleRead();
52 } 52 }
53 53
54 // Defer initialization until all scheduled reads have completed. 54 // Defer initialization until all scheduled reads have completed.
55 return OnInitialize(decoder_->GetMediaFormat()); 55 return OnInitialize(decoder_->media_format());
56 } 56 }
57 57
58 void AudioRendererBase::OnAssignment(Buffer* buffer_in) { 58 void AudioRendererBase::OnAssignment(Buffer* buffer_in) {
59 bool initialization_complete = false; 59 bool initialization_complete = false;
60 { 60 {
61 AutoLock auto_lock(lock_); 61 AutoLock auto_lock(lock_);
62 if (!stopped_) { 62 if (!stopped_) {
63 buffer_in->AddRef(); 63 buffer_in->AddRef();
64 queue_.push_back(buffer_in); 64 queue_.push_back(buffer_in);
65 DCHECK(queue_.size() <= max_queue_size_); 65 DCHECK(queue_.size() <= max_queue_size_);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 return result; 132 return result;
133 } 133 }
134 134
135 void AudioRendererBase::ScheduleRead() { 135 void AudioRendererBase::ScheduleRead() {
136 host_->PostTask(NewRunnableMethod(decoder_, &AudioDecoder::Read, 136 host_->PostTask(NewRunnableMethod(decoder_, &AudioDecoder::Read,
137 new AssignableBuffer<AudioRendererBase, Buffer>(this))); 137 new AssignableBuffer<AudioRendererBase, Buffer>(this)));
138 } 138 }
139 139
140 // static 140 // static
141 bool AudioRendererBase::ParseMediaFormat(const MediaFormat* media_format, 141 bool AudioRendererBase::ParseMediaFormat(const MediaFormat& media_format,
142 int* channels_out, 142 int* channels_out,
143 int* sample_rate_out, 143 int* sample_rate_out,
144 int* sample_bits_out) { 144 int* sample_bits_out) {
145 // TODO(scherkus): might be handy to support NULL parameters. 145 // TODO(scherkus): might be handy to support NULL parameters.
146 std::string mime_type; 146 std::string mime_type;
147 return media_format->GetAsString(MediaFormat::kMimeType, &mime_type) && 147 return media_format.GetAsString(MediaFormat::kMimeType, &mime_type) &&
148 media_format->GetAsInteger(MediaFormat::kChannels, channels_out) && 148 media_format.GetAsInteger(MediaFormat::kChannels, channels_out) &&
149 media_format->GetAsInteger(MediaFormat::kSampleRate, sample_rate_out) && 149 media_format.GetAsInteger(MediaFormat::kSampleRate, sample_rate_out) &&
150 media_format->GetAsInteger(MediaFormat::kSampleBits, sample_bits_out) && 150 media_format.GetAsInteger(MediaFormat::kSampleBits, sample_bits_out) &&
151 mime_type.compare(mime_type::kUncompressedAudio) == 0; 151 mime_type.compare(mime_type::kUncompressedAudio) == 0;
152 } 152 }
153 153
154 } // namespace media 154 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/audio_renderer_base.h ('k') | media/filters/audio_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698