OLD | NEW |
---|---|
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/base/audio_renderer_mixer.h" | 5 #include "media/base/audio_renderer_mixer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 audio_converter_.RemoveInput(input); | 51 audio_converter_.RemoveInput(input); |
52 } | 52 } |
53 | 53 |
54 void AudioRendererMixer::AddErrorCallback(const base::Closure& error_cb) { | 54 void AudioRendererMixer::AddErrorCallback(const base::Closure& error_cb) { |
55 base::AutoLock auto_lock(lock_); | 55 base::AutoLock auto_lock(lock_); |
56 error_callbacks_.push_back(error_cb); | 56 error_callbacks_.push_back(error_cb); |
57 } | 57 } |
58 | 58 |
59 void AudioRendererMixer::RemoveErrorCallback(const base::Closure& error_cb) { | 59 void AudioRendererMixer::RemoveErrorCallback(const base::Closure& error_cb) { |
60 base::AutoLock auto_lock(lock_); | 60 base::AutoLock auto_lock(lock_); |
61 for (ErrorCallbackList::iterator it = error_callbacks_.begin(); | 61 for (ErrorCallbackList::iterator it = error_callbacks_.begin(); |
wolenetz
2014/09/26 01:22:31
I wish for a range-based equivalent here, but we n
Peter Kasting
2014/09/26 01:52:32
The only thing I can think of is something like th
wolenetz
2014/09/26 07:23:15
Bring on the lambdas :). Thanks for the insight -
DaleCurtis
2014/09/26 20:39:51
It should never not find the callback, hence the N
| |
62 it != error_callbacks_.end(); | 62 it != error_callbacks_.end(); |
63 ++it) { | 63 ++it) { |
64 if (it->Equals(error_cb)) { | 64 if (it->Equals(error_cb)) { |
65 error_callbacks_.erase(it); | 65 error_callbacks_.erase(it); |
66 return; | 66 return; |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 // An error callback should always exist when called. | 70 // An error callback should always exist when called. |
71 NOTREACHED(); | 71 NOTREACHED(); |
(...skipping 15 matching lines...) Expand all Loading... | |
87 } | 87 } |
88 | 88 |
89 audio_converter_.ConvertWithDelay( | 89 audio_converter_.ConvertWithDelay( |
90 base::TimeDelta::FromMilliseconds(audio_delay_milliseconds), audio_bus); | 90 base::TimeDelta::FromMilliseconds(audio_delay_milliseconds), audio_bus); |
91 return audio_bus->frames(); | 91 return audio_bus->frames(); |
92 } | 92 } |
93 | 93 |
94 void AudioRendererMixer::OnRenderError() { | 94 void AudioRendererMixer::OnRenderError() { |
95 // Call each mixer input and signal an error. | 95 // Call each mixer input and signal an error. |
96 base::AutoLock auto_lock(lock_); | 96 base::AutoLock auto_lock(lock_); |
97 for (ErrorCallbackList::const_iterator it = error_callbacks_.begin(); | 97 for (const auto& cb : error_callbacks_) |
wolenetz
2014/09/26 01:22:31
aside (I'm filing a crbug): rietveld's lint doesn'
| |
98 it != error_callbacks_.end(); | 98 cb.Run(); |
99 ++it) { | |
100 it->Run(); | |
101 } | |
102 } | 99 } |
103 | 100 |
104 } // namespace media | 101 } // namespace media |
OLD | NEW |