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

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

Issue 7796033: Replace AudioDecoderConfig with simple accessors on AudioDecoder. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase Created 9 years, 3 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_impl.h ('k') | media/filters/ffmpeg_audio_decoder.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/filters/audio_renderer_impl.h" 5 #include "media/filters/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/filter_host.h" 10 #include "media/base/filter_host.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 void AudioRendererImpl::OnClose(AudioOutputStream* stream) { 65 void AudioRendererImpl::OnClose(AudioOutputStream* stream) {
66 // TODO(scherkus): implement OnClose. 66 // TODO(scherkus): implement OnClose.
67 NOTIMPLEMENTED(); 67 NOTIMPLEMENTED();
68 } 68 }
69 69
70 void AudioRendererImpl::OnError(AudioOutputStream* stream, int code) { 70 void AudioRendererImpl::OnError(AudioOutputStream* stream, int code) {
71 // TODO(scherkus): implement OnError. 71 // TODO(scherkus): implement OnError.
72 NOTIMPLEMENTED(); 72 NOTIMPLEMENTED();
73 } 73 }
74 74
75 bool AudioRendererImpl::OnInitialize(const AudioDecoderConfig& config) { 75 bool AudioRendererImpl::OnInitialize(int bits_per_channel,
76 AudioParameters params(config); 76 ChannelLayout channel_layout,
77 params.samples_per_packet = kSamplesPerBuffer; 77 int sample_rate) {
78 AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, channel_layout,
79 sample_rate, bits_per_channel, kSamplesPerBuffer);
78 80
79 bytes_per_second_ = params.GetBytesPerSecond(); 81 bytes_per_second_ = params.GetBytesPerSecond();
80 82
81 // Create our audio stream. 83 // Create our audio stream.
82 stream_ = AudioManager::GetAudioManager()->MakeAudioOutputStream(params); 84 stream_ = AudioManager::GetAudioManager()->MakeAudioOutputStream(params);
83 if (!stream_) 85 if (!stream_)
84 return false; 86 return false;
85 87
86 if (!stream_->Open()) { 88 if (!stream_->Open()) {
87 stream_->Close(); 89 stream_->Close();
88 stream_ = NULL; 90 stream_ = NULL;
89 } 91 }
90 return true; 92 return true;
91 } 93 }
92 94
93 void AudioRendererImpl::OnStop() { 95 void AudioRendererImpl::OnStop() {
94 if (stream_) 96 if (stream_)
95 stream_->Stop(); 97 stream_->Stop();
96 } 98 }
97 99
98 } // namespace media 100 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/audio_renderer_impl.h ('k') | media/filters/ffmpeg_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698