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

Side by Side Diff: content/renderer/media/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 | « content/renderer/media/audio_renderer_impl.h ('k') | media/audio/audio_parameters.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 "content/renderer/media/audio_renderer_impl.h" 5 #include "content/renderer/media/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 predicted_play_time = base::TimeDelta::FromMicroseconds( 76 predicted_play_time = base::TimeDelta::FromMicroseconds(
77 static_cast<int64>(ceil(predicted_play_time.InMicroseconds() * 77 static_cast<int64>(ceil(predicted_play_time.InMicroseconds() *
78 playback_rate))); 78 playback_rate)));
79 } 79 }
80 earliest_end_time_ = 80 earliest_end_time_ =
81 std::max(earliest_end_time_, 81 std::max(earliest_end_time_,
82 time_now + request_delay + predicted_play_time); 82 time_now + request_delay + predicted_play_time);
83 } 83 }
84 } 84 }
85 85
86 bool AudioRendererImpl::OnInitialize(const media::AudioDecoderConfig& config) { 86 bool AudioRendererImpl::OnInitialize(int bits_per_channel,
87 AudioParameters params(config); 87 ChannelLayout channel_layout,
88 params.format = AudioParameters::AUDIO_PCM_LINEAR; 88 int sample_rate) {
89 AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, channel_layout,
90 sample_rate, bits_per_channel, kSamplesPerBuffer);
89 91
90 bytes_per_second_ = params.GetBytesPerSecond(); 92 bytes_per_second_ = params.GetBytesPerSecond();
91 93
92 ChildProcess::current()->io_message_loop()->PostTask( 94 ChildProcess::current()->io_message_loop()->PostTask(
93 FROM_HERE, 95 FROM_HERE,
94 NewRunnableMethod(this, &AudioRendererImpl::CreateStreamTask, params)); 96 NewRunnableMethod(this, &AudioRendererImpl::CreateStreamTask, params));
95 return true; 97 return true;
96 } 98 }
97 99
98 void AudioRendererImpl::OnStop() { 100 void AudioRendererImpl::OnStop() {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 media::SetActualDataSizeInBytes(shared_memory_.get(), 486 media::SetActualDataSizeInBytes(shared_memory_.get(),
485 shared_memory_size_, 487 shared_memory_size_,
486 size); 488 size);
487 UpdateEarliestEndTime(size, request_delay, time_now); 489 UpdateEarliestEndTime(size, request_delay, time_now);
488 } 490 }
489 } 491 }
490 492
491 void AudioRendererImpl::Send(IPC::Message* message) { 493 void AudioRendererImpl::Send(IPC::Message* message) {
492 filter_->Send(message); 494 filter_->Send(message);
493 } 495 }
OLDNEW
« no previous file with comments | « content/renderer/media/audio_renderer_impl.h ('k') | media/audio/audio_parameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698