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

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

Issue 503053007: Revert of media: Introduce Renderer interface and RendererImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/base/renderer.cc ('k') | media/filters/pipeline_integration_test_base.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/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 <algorithm> 9 #include <algorithm>
10 10
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 DCHECK(!statistics_cb.is_null()); 251 DCHECK(!statistics_cb.is_null());
252 DCHECK(!time_cb.is_null()); 252 DCHECK(!time_cb.is_null());
253 DCHECK(!buffering_state_cb.is_null()); 253 DCHECK(!buffering_state_cb.is_null());
254 DCHECK(!ended_cb.is_null()); 254 DCHECK(!ended_cb.is_null());
255 DCHECK(!error_cb.is_null()); 255 DCHECK(!error_cb.is_null());
256 DCHECK_EQ(kUninitialized, state_); 256 DCHECK_EQ(kUninitialized, state_);
257 DCHECK(sink_); 257 DCHECK(sink_);
258 258
259 state_ = kInitializing; 259 state_ = kInitializing;
260 260
261 // Always post |init_cb_| because |this| could be destroyed if initialization 261 init_cb_ = init_cb;
262 // failed.
263 init_cb_ = BindToCurrentLoop(init_cb);
264
265 time_cb_ = time_cb; 262 time_cb_ = time_cb;
266 buffering_state_cb_ = buffering_state_cb; 263 buffering_state_cb_ = buffering_state_cb;
267 ended_cb_ = ended_cb; 264 ended_cb_ = ended_cb;
268 error_cb_ = error_cb; 265 error_cb_ = error_cb;
269 266
270 expecting_config_changes_ = stream->SupportsConfigChanges(); 267 expecting_config_changes_ = stream->SupportsConfigChanges();
271 if (!expecting_config_changes_) { 268 if (!expecting_config_changes_) {
272 // The actual buffer size is controlled via the size of the AudioBus 269 // The actual buffer size is controlled via the size of the AudioBus
273 // provided to Render(), so just choose something reasonable here for looks. 270 // provided to Render(), so just choose something reasonable here for looks.
274 int buffer_size = stream->audio_decoder_config().samples_per_second() / 100; 271 int buffer_size = stream->audio_decoder_config().samples_per_second() / 100;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 { 341 {
345 base::AutoUnlock auto_unlock(lock_); 342 base::AutoUnlock auto_unlock(lock_);
346 sink_->Initialize(audio_parameters_, this); 343 sink_->Initialize(audio_parameters_, this);
347 sink_->Start(); 344 sink_->Start();
348 345
349 // Some sinks play on start... 346 // Some sinks play on start...
350 sink_->Pause(); 347 sink_->Pause();
351 } 348 }
352 349
353 DCHECK(!sink_playing_); 350 DCHECK(!sink_playing_);
351
354 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); 352 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
355 } 353 }
356 354
357 void AudioRendererImpl::SetVolume(float volume) { 355 void AudioRendererImpl::SetVolume(float volume) {
358 DCHECK(task_runner_->BelongsToCurrentThread()); 356 DCHECK(task_runner_->BelongsToCurrentThread());
359 DCHECK(sink_); 357 DCHECK(sink_);
360 sink_->SetVolume(volume); 358 sink_->SetVolume(volume);
361 } 359 }
362 360
363 void AudioRendererImpl::DecodedAudioReady( 361 void AudioRendererImpl::DecodedAudioReady(
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 << buffering_state; 699 << buffering_state;
702 DCHECK_NE(buffering_state_, buffering_state); 700 DCHECK_NE(buffering_state_, buffering_state);
703 lock_.AssertAcquired(); 701 lock_.AssertAcquired();
704 buffering_state_ = buffering_state; 702 buffering_state_ = buffering_state;
705 703
706 task_runner_->PostTask(FROM_HERE, 704 task_runner_->PostTask(FROM_HERE,
707 base::Bind(buffering_state_cb_, buffering_state_)); 705 base::Bind(buffering_state_cb_, buffering_state_));
708 } 706 }
709 707
710 } // namespace media 708 } // namespace media
OLDNEW
« no previous file with comments | « media/base/renderer.cc ('k') | media/filters/pipeline_integration_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698