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

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: 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"
11 #include "base/callback_helpers.h" 11 #include "base/callback_helpers.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/default_clock.h"
13 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
14 #include "base/message_loop.h" 15 #include "base/message_loop.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
17 #include "base/string_util.h" 18 #include "base/string_util.h"
18 #include "base/synchronization/condition_variable.h" 19 #include "base/synchronization/condition_variable.h"
19 #include "media/base/audio_decoder.h" 20 #include "media/base/audio_decoder.h"
20 #include "media/base/audio_renderer.h" 21 #include "media/base/audio_renderer.h"
21 #include "media/base/clock.h" 22 #include "media/base/clock.h"
22 #include "media/base/filter_collection.h" 23 #include "media/base/filter_collection.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 Pipeline::Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, 66 Pipeline::Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop,
66 MediaLog* media_log) 67 MediaLog* media_log)
67 : message_loop_(message_loop), 68 : message_loop_(message_loop),
68 media_log_(media_log), 69 media_log_(media_log),
69 running_(false), 70 running_(false),
70 did_loading_progress_(false), 71 did_loading_progress_(false),
71 total_bytes_(0), 72 total_bytes_(0),
72 natural_size_(0, 0), 73 natural_size_(0, 0),
73 volume_(1.0f), 74 volume_(1.0f),
74 playback_rate_(0.0f), 75 playback_rate_(0.0f),
75 clock_(new Clock(&base::Time::Now)), 76 clock_(new Clock(base::DefaultClock::Get())),
76 waiting_for_clock_update_(false), 77 waiting_for_clock_update_(false),
77 status_(PIPELINE_OK), 78 status_(PIPELINE_OK),
78 has_audio_(false), 79 has_audio_(false),
79 has_video_(false), 80 has_video_(false),
80 state_(kCreated), 81 state_(kCreated),
81 audio_ended_(false), 82 audio_ended_(false),
82 video_ended_(false), 83 video_ended_(false),
83 audio_disabled_(false), 84 audio_disabled_(false),
84 creation_time_(base::Time::Now()) { 85 creation_time_(base::Time::Now()) {
85 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated)); 86 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated));
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { 946 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() {
946 lock_.AssertAcquired(); 947 lock_.AssertAcquired();
947 if (!waiting_for_clock_update_) 948 if (!waiting_for_clock_update_)
948 return; 949 return;
949 950
950 waiting_for_clock_update_ = false; 951 waiting_for_clock_update_ = false;
951 clock_->Play(); 952 clock_->Play();
952 } 953 }
953 954
954 } // namespace media 955 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698