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

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

Issue 1083883003: Move BindToCurrentLoop from media/base/ to base/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix media/base/callback_holder.h compile Created 5 years, 8 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
« no previous file with comments | « media/mojo/services/mojo_renderer_impl.cc ('k') | media/renderers/renderer_impl.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/renderers/audio_renderer_impl.h" 5 #include "media/renderers/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_to_current_loop.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/callback_helpers.h" 14 #include "base/callback_helpers.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
17 #include "media/base/audio_buffer.h" 18 #include "media/base/audio_buffer.h"
18 #include "media/base/audio_buffer_converter.h" 19 #include "media/base/audio_buffer_converter.h"
19 #include "media/base/audio_hardware_config.h" 20 #include "media/base/audio_hardware_config.h"
20 #include "media/base/audio_splicer.h" 21 #include "media/base/audio_splicer.h"
21 #include "media/base/bind_to_current_loop.h"
22 #include "media/base/demuxer_stream.h" 22 #include "media/base/demuxer_stream.h"
23 #include "media/filters/audio_clock.h" 23 #include "media/filters/audio_clock.h"
24 #include "media/filters/decrypting_demuxer_stream.h" 24 #include "media/filters/decrypting_demuxer_stream.h"
25 25
26 namespace media { 26 namespace media {
27 27
28 namespace { 28 namespace {
29 29
30 enum AudioRendererEvent { 30 enum AudioRendererEvent {
31 INITIALIZED, 31 INITIALIZED,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 DCHECK(!buffering_state_cb.is_null()); 280 DCHECK(!buffering_state_cb.is_null());
281 DCHECK(!ended_cb.is_null()); 281 DCHECK(!ended_cb.is_null());
282 DCHECK(!error_cb.is_null()); 282 DCHECK(!error_cb.is_null());
283 DCHECK_EQ(kUninitialized, state_); 283 DCHECK_EQ(kUninitialized, state_);
284 DCHECK(sink_.get()); 284 DCHECK(sink_.get());
285 285
286 state_ = kInitializing; 286 state_ = kInitializing;
287 287
288 // Always post |init_cb_| because |this| could be destroyed if initialization 288 // Always post |init_cb_| because |this| could be destroyed if initialization
289 // failed. 289 // failed.
290 init_cb_ = BindToCurrentLoop(init_cb); 290 init_cb_ = base::BindToCurrentLoop(init_cb);
291 291
292 buffering_state_cb_ = buffering_state_cb; 292 buffering_state_cb_ = buffering_state_cb;
293 ended_cb_ = ended_cb; 293 ended_cb_ = ended_cb;
294 error_cb_ = error_cb; 294 error_cb_ = error_cb;
295 295
296 const AudioParameters& hw_params = hardware_config_.GetOutputConfig(); 296 const AudioParameters& hw_params = hardware_config_.GetOutputConfig();
297 expecting_config_changes_ = stream->SupportsConfigChanges(); 297 expecting_config_changes_ = stream->SupportsConfigChanges();
298 if (!expecting_config_changes_ || !hw_params.IsValid()) { 298 if (!expecting_config_changes_ || !hw_params.IsValid()) {
299 // The actual buffer size is controlled via the size of the AudioBus 299 // The actual buffer size is controlled via the size of the AudioBus
300 // provided to Render(), so just choose something reasonable here for looks. 300 // provided to Render(), so just choose something reasonable here for looks.
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 << buffering_state; 750 << buffering_state;
751 DCHECK_NE(buffering_state_, buffering_state); 751 DCHECK_NE(buffering_state_, buffering_state);
752 lock_.AssertAcquired(); 752 lock_.AssertAcquired();
753 buffering_state_ = buffering_state; 753 buffering_state_ = buffering_state;
754 754
755 task_runner_->PostTask(FROM_HERE, 755 task_runner_->PostTask(FROM_HERE,
756 base::Bind(buffering_state_cb_, buffering_state_)); 756 base::Bind(buffering_state_cb_, buffering_state_));
757 } 757 }
758 758
759 } // namespace media 759 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_renderer_impl.cc ('k') | media/renderers/renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698