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

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

Issue 11607003: Add a Clock and TickClock interface for mocking out time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 Pipeline::Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, 65 Pipeline::Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop,
66 MediaLog* media_log) 66 MediaLog* media_log)
67 : message_loop_(message_loop), 67 : message_loop_(message_loop),
68 media_log_(media_log), 68 media_log_(media_log),
69 running_(false), 69 running_(false),
70 did_loading_progress_(false), 70 did_loading_progress_(false),
71 total_bytes_(0), 71 total_bytes_(0),
72 natural_size_(0, 0), 72 natural_size_(0, 0),
73 volume_(1.0f), 73 volume_(1.0f),
74 playback_rate_(0.0f), 74 playback_rate_(0.0f),
75 clock_(new Clock(&base::Time::Now)), 75 clock_(new Clock(&default_clock_)),
76 waiting_for_clock_update_(false), 76 waiting_for_clock_update_(false),
77 status_(PIPELINE_OK), 77 status_(PIPELINE_OK),
78 has_audio_(false), 78 has_audio_(false),
79 has_video_(false), 79 has_video_(false),
80 state_(kCreated), 80 state_(kCreated),
81 audio_ended_(false), 81 audio_ended_(false),
82 video_ended_(false), 82 video_ended_(false),
83 audio_disabled_(false), 83 audio_disabled_(false),
84 creation_time_(base::Time::Now()) { 84 creation_time_(base::Time::Now()) {
85 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated)); 85 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated));
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { 945 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() {
946 lock_.AssertAcquired(); 946 lock_.AssertAcquired();
947 if (!waiting_for_clock_update_) 947 if (!waiting_for_clock_update_)
948 return; 948 return;
949 949
950 waiting_for_clock_update_ = false; 950 waiting_for_clock_update_ = false;
951 clock_->Play(); 951 clock_->Play();
952 } 952 }
953 953
954 } // namespace media 954 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698