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

Side by Side Diff: media/base/pipeline.cc

Issue 10832197: Add a lot of Pipeline tests to cover stopping/error handling while in a variety of states. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: blah Created 8 years, 4 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 | Annotate | Revision Log
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/base/pipeline.h" 5 #include "media/base/pipeline.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 PipelineStatistics Pipeline::GetStatistics() const { 252 PipelineStatistics Pipeline::GetStatistics() const {
253 base::AutoLock auto_lock(lock_); 253 base::AutoLock auto_lock(lock_);
254 return statistics_; 254 return statistics_;
255 } 255 }
256 256
257 void Pipeline::SetClockForTesting(Clock* clock) { 257 void Pipeline::SetClockForTesting(Clock* clock) {
258 clock_.reset(clock); 258 clock_.reset(clock);
259 } 259 }
260 260
261 void Pipeline::SetErrorForTesting(PipelineStatus status) {
262 SetError(status);
263 }
264
261 void Pipeline::SetState(State next_state) { 265 void Pipeline::SetState(State next_state) {
262 if (state_ != kStarted && next_state == kStarted && 266 if (state_ != kStarted && next_state == kStarted &&
263 !creation_time_.is_null()) { 267 !creation_time_.is_null()) {
264 UMA_HISTOGRAM_TIMES( 268 UMA_HISTOGRAM_TIMES(
265 "Media.TimeToPipelineStarted", base::Time::Now() - creation_time_); 269 "Media.TimeToPipelineStarted", base::Time::Now() - creation_time_);
266 creation_time_ = base::Time(); 270 creation_time_ = base::Time();
267 } 271 }
268 state_ = next_state; 272 state_ = next_state;
269 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(next_state)); 273 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(next_state));
270 } 274 }
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { 1272 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() {
1269 lock_.AssertAcquired(); 1273 lock_.AssertAcquired();
1270 if (!waiting_for_clock_update_) 1274 if (!waiting_for_clock_update_)
1271 return; 1275 return;
1272 1276
1273 waiting_for_clock_update_ = false; 1277 waiting_for_clock_update_ = false;
1274 clock_->Play(); 1278 clock_->Play();
1275 } 1279 }
1276 1280
1277 } // namespace media 1281 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698