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

Side by Side Diff: media/audio/audio_output_dispatcher.cc

Issue 8680009: Call close_timer_.Reset() from StopStreamTask. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
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 "media/audio/audio_output_dispatcher.h" 5 #include "media/audio/audio_output_dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 return stream; 63 return stream;
64 } 64 }
65 65
66 void AudioOutputDispatcher::StreamStopped(AudioOutputStream* stream) { 66 void AudioOutputDispatcher::StreamStopped(AudioOutputStream* stream) {
67 DCHECK_EQ(MessageLoop::current(), message_loop_); 67 DCHECK_EQ(MessageLoop::current(), message_loop_);
68 68
69 paused_proxies_++; 69 paused_proxies_++;
70 70
71 pausing_streams_.push_front(stream); 71 pausing_streams_.push_front(stream);
72 close_timer_.Reset();
73 72
74 // Don't recycle stream until two buffers worth of time has elapsed. 73 // Don't recycle stream until two buffers worth of time has elapsed.
75 message_loop_->PostDelayedTask( 74 message_loop_->PostDelayedTask(
76 FROM_HERE, 75 FROM_HERE,
77 base::Bind(&AudioOutputDispatcher::StopStreamTask, this), 76 base::Bind(&AudioOutputDispatcher::StopStreamTask, this),
78 pause_delay_milliseconds_); 77 pause_delay_milliseconds_);
79 } 78 }
80 79
81 void AudioOutputDispatcher::StopStreamTask() { 80 void AudioOutputDispatcher::StopStreamTask() {
82 if (pausing_streams_.empty()) 81 if (pausing_streams_.empty())
83 return; 82 return;
84 AudioOutputStream* stream = pausing_streams_.back(); 83 AudioOutputStream* stream = pausing_streams_.back();
85 pausing_streams_.pop_back(); 84 pausing_streams_.pop_back();
86 idle_streams_.push_back(stream); 85 idle_streams_.push_back(stream);
86 close_timer_.Reset();
87 } 87 }
88 88
89 void AudioOutputDispatcher::StreamClosed() { 89 void AudioOutputDispatcher::StreamClosed() {
90 DCHECK_EQ(MessageLoop::current(), message_loop_); 90 DCHECK_EQ(MessageLoop::current(), message_loop_);
91 91
92 while (!pausing_streams_.empty()) { 92 while (!pausing_streams_.empty()) {
93 idle_streams_.push_back(pausing_streams_.back()); 93 idle_streams_.push_back(pausing_streams_.back());
94 pausing_streams_.pop_back(); 94 pausing_streams_.pop_back();
95 } 95 }
96 96
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 close_timer_.Reset(); 132 close_timer_.Reset();
133 } 133 }
134 134
135 // This method is called by |close_timer_|. 135 // This method is called by |close_timer_|.
136 void AudioOutputDispatcher::ClosePendingStreams() { 136 void AudioOutputDispatcher::ClosePendingStreams() {
137 while (!idle_streams_.empty()) { 137 while (!idle_streams_.empty()) {
138 idle_streams_.back()->Close(); 138 idle_streams_.back()->Close();
139 idle_streams_.pop_back(); 139 idle_streams_.pop_back();
140 } 140 }
141 } 141 }
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_output_proxy_unittest.cc » ('j') | media/audio/audio_output_proxy_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698