OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/clockless_audio_sink.h" | 5 #include "media/audio/clockless_audio_sink.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/threading/simple_thread.h" | 10 #include "base/threading/simple_thread.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 // First time we processed some audio, so record the starting time. | 60 // First time we processed some audio, so record the starting time. |
61 start = base::TimeTicks::Now(); | 61 start = base::TimeTicks::Now(); |
62 } else { | 62 } else { |
63 // Keep track of the last time data was rendered. | 63 // Keep track of the last time data was rendered. |
64 playback_time_ = base::TimeTicks::Now() - start; | 64 playback_time_ = base::TimeTicks::Now() - start; |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 AudioRendererSink::RenderCallback* callback_; | 69 AudioRendererSink::RenderCallback* callback_; |
70 scoped_ptr<AudioBus> audio_bus_; | 70 std::unique_ptr<AudioBus> audio_bus_; |
danakj
2016/04/22 22:47:36
include memory
dcheng
2016/04/22 23:13:20
Related header.
| |
71 scoped_ptr<base::WaitableEvent> stop_event_; | 71 std::unique_ptr<base::WaitableEvent> stop_event_; |
72 scoped_ptr<base::DelegateSimpleThread> thread_; | 72 std::unique_ptr<base::DelegateSimpleThread> thread_; |
73 base::TimeDelta playback_time_; | 73 base::TimeDelta playback_time_; |
74 scoped_ptr<AudioHash> audio_hash_; | 74 std::unique_ptr<AudioHash> audio_hash_; |
75 }; | 75 }; |
76 | 76 |
77 ClocklessAudioSink::ClocklessAudioSink() | 77 ClocklessAudioSink::ClocklessAudioSink() |
78 : initialized_(false), playing_(false), hashing_(false) {} | 78 : initialized_(false), playing_(false), hashing_(false) {} |
79 | 79 |
80 ClocklessAudioSink::~ClocklessAudioSink() {} | 80 ClocklessAudioSink::~ClocklessAudioSink() {} |
81 | 81 |
82 void ClocklessAudioSink::Initialize(const AudioParameters& params, | 82 void ClocklessAudioSink::Initialize(const AudioParameters& params, |
83 RenderCallback* callback) { | 83 RenderCallback* callback) { |
84 DCHECK(!initialized_); | 84 DCHECK(!initialized_); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 void ClocklessAudioSink::StartAudioHashForTesting() { | 128 void ClocklessAudioSink::StartAudioHashForTesting() { |
129 DCHECK(!initialized_); | 129 DCHECK(!initialized_); |
130 hashing_ = true; | 130 hashing_ = true; |
131 } | 131 } |
132 | 132 |
133 std::string ClocklessAudioSink::GetAudioHashForTesting() { | 133 std::string ClocklessAudioSink::GetAudioHashForTesting() { |
134 return thread_ && hashing_ ? thread_->GetAudioHash() : std::string(); | 134 return thread_ && hashing_ ? thread_->GetAudioHash() : std::string(); |
135 } | 135 } |
136 | 136 |
137 } // namespace media | 137 } // namespace media |
OLD | NEW |