28 std::function<
void()> on_seek,
const util::Clock* clock)
29 : mutex_(
"PipelineManager"),
30 on_status_changed_(
std::move(on_status_changed)),
31 on_seek_(
std::move(on_seek)),
39 std::unique_lock<SharedMutex> lock(mutex_);
51 std::unique_lock<SharedMutex> lock(mutex_);
61 on_status_changed_(new_status);
77 std::unique_lock<SharedMutex> lock(mutex_);
82 if (!std::isnan(duration) && GetTimeFor(wall_time) > duration) {
88 prev_media_time_ = duration;
89 prev_wall_time_ = wall_time;
103 on_status_changed_(new_status);
114 std::unique_lock<SharedMutex> lock(mutex_);
122 std::isnan(duration_) ? time : std::min(duration_, time);
142 on_status_changed_(new_status);
147 return playback_rate_;
151 std::unique_lock<SharedMutex> lock(mutex_);
153 playback_rate_ = rate;
159 std::unique_lock<SharedMutex> lock(mutex_);
171 prev_media_time_ = 0;
176 on_status_changed_(new_status);
182 std::unique_lock<SharedMutex> lock(mutex_);
192 on_status_changed_(new_status);
196 bool status_changed =
false;
198 std::unique_lock<SharedMutex> lock(mutex_);
202 status_changed =
true;
212 std::unique_lock<SharedMutex> lock(mutex_);
224 on_status_changed_(new_status);
230 std::unique_lock<SharedMutex> lock(mutex_);
234 DCHECK(!std::isnan(duration_));
235 prev_wall_time_ = wall_time;
236 prev_media_time_ = duration_;
241 on_status_changed_(new_status);
245 bool fire_event =
false;
247 std::unique_lock<SharedMutex> lock(mutex_);
258 double PipelineManager::GetTimeFor(uint64_t wall_time)
const {
260 return prev_media_time_;
262 const uint64_t wall_diff = wall_time - prev_wall_time_;
263 const double time = prev_media_time_ + (wall_diff * playback_rate_ / 1000.0);
264 return std::isnan(duration_) ? time : std::min(duration_, time);
267 void PipelineManager::SyncPoint() {
269 prev_media_time_ = GetTimeFor(wall_time);
270 prev_wall_time_ = wall_time;
virtual uint64_t GetMonotonicTime() const