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

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 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 | « no previous file | no next file » | 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) 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(); 72 close_timer_.Reset();
Sergey Ulanov 2011/11/23 18:07:57 I think you should also remove this line, as it is
Reid Kleckner (google) 2011/11/23 18:40:44 Done.
73 73
74 // Don't recycle stream until two buffers worth of time has elapsed. 74 // Don't recycle stream until two buffers worth of time has elapsed.
75 message_loop_->PostDelayedTask( 75 message_loop_->PostDelayedTask(
76 FROM_HERE, 76 FROM_HERE,
77 base::Bind(&AudioOutputDispatcher::StopStreamTask, this), 77 base::Bind(&AudioOutputDispatcher::StopStreamTask, this),
78 pause_delay_milliseconds_); 78 pause_delay_milliseconds_);
79 } 79 }
80 80
81 void AudioOutputDispatcher::StopStreamTask() { 81 void AudioOutputDispatcher::StopStreamTask() {
82 if (pausing_streams_.empty()) 82 if (pausing_streams_.empty())
83 return; 83 return;
84 AudioOutputStream* stream = pausing_streams_.back(); 84 AudioOutputStream* stream = pausing_streams_.back();
85 pausing_streams_.pop_back(); 85 pausing_streams_.pop_back();
86 idle_streams_.push_back(stream); 86 idle_streams_.push_back(stream);
87 close_timer_.Reset();
87 } 88 }
88 89
89 void AudioOutputDispatcher::StreamClosed() { 90 void AudioOutputDispatcher::StreamClosed() {
90 DCHECK_EQ(MessageLoop::current(), message_loop_); 91 DCHECK_EQ(MessageLoop::current(), message_loop_);
91 92
92 while (!pausing_streams_.empty()) { 93 while (!pausing_streams_.empty()) {
93 idle_streams_.push_back(pausing_streams_.back()); 94 idle_streams_.push_back(pausing_streams_.back());
94 pausing_streams_.pop_back(); 95 pausing_streams_.pop_back();
95 } 96 }
96 97
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 close_timer_.Reset(); 133 close_timer_.Reset();
133 } 134 }
134 135
135 // This method is called by |close_timer_|. 136 // This method is called by |close_timer_|.
136 void AudioOutputDispatcher::ClosePendingStreams() { 137 void AudioOutputDispatcher::ClosePendingStreams() {
137 while (!idle_streams_.empty()) { 138 while (!idle_streams_.empty()) {
138 idle_streams_.back()->Close(); 139 idle_streams_.back()->Close();
139 idle_streams_.pop_back(); 140 idle_streams_.pop_back();
140 } 141 }
141 } 142 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698