Index: media/audio/audio_output_dispatcher_impl.cc |
diff --git a/media/audio/audio_output_dispatcher_impl.cc b/media/audio/audio_output_dispatcher_impl.cc |
index b538acde82cdb67b8a9117f0ba4b530091a2ddcc..1498bec35d93f8e9ce5484172ebbbf79b89cbf2d 100644 |
--- a/media/audio/audio_output_dispatcher_impl.cc |
+++ b/media/audio/audio_output_dispatcher_impl.cc |
@@ -34,13 +34,20 @@ AudioOutputDispatcherImpl::AudioOutputDispatcherImpl( |
AudioOutputDispatcherImpl::~AudioOutputDispatcherImpl() { |
CHECK(task_runner_->BelongsToCurrentThread()); |
+ // Stop all active streams. |
+ for (auto iter = proxy_to_physical_map_.begin(); |
+ iter != proxy_to_physical_map_.end();) { |
+ // Note: Stopping the stream will invalidate the iterator. |
+ // Increment the iterator before stopping the stream. |
+ AudioOutputProxy* stream_proxy = iter->first; |
+ ++iter; |
+ StopStream(stream_proxy); |
alokp
2017/01/10 20:33:59
Do you think it is worthwhile to trigger AudioSour
DaleCurtis
2017/01/10 20:54:41
No, this should be fine. Also, just use a for each
alokp
2017/01/10 22:51:26
I cannot use the for-each style because StopStream
DaleCurtis
2017/01/10 22:59:05
Hmm, for some reason I thought for-each is immune
alokp
2017/01/10 23:31:53
AFAICT none - for_each or c++11 range-based for-lo
|
+ } |
+ |
// Close all idle streams immediately. The |close_timer_| will handle |
// invalidating any outstanding tasks upon its destruction. |
CloseAllIdleStreams(); |
- // There must be no idle proxy streams. |
- CHECK_EQ(idle_proxies_, 0u); |
- |
// There must be no active proxy streams. |
CHECK(proxy_to_physical_map_.empty()); |