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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 1094783002: Switch to double for time calculations using playback rate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Making changes at chromecast side to fix trybots Created 5 years, 8 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
« no previous file with comments | « media/blink/buffered_resource_loader_unittest.cc ('k') | media/filters/audio_clock_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), 115 ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
116 preload_(BufferedDataSource::AUTO), 116 preload_(BufferedDataSource::AUTO),
117 main_task_runner_(base::MessageLoopProxy::current()), 117 main_task_runner_(base::MessageLoopProxy::current()),
118 media_task_runner_(params.media_task_runner()), 118 media_task_runner_(params.media_task_runner()),
119 media_log_(params.media_log()), 119 media_log_(params.media_log()),
120 pipeline_(media_task_runner_, media_log_.get()), 120 pipeline_(media_task_runner_, media_log_.get()),
121 load_type_(LoadTypeURL), 121 load_type_(LoadTypeURL),
122 opaque_(false), 122 opaque_(false),
123 paused_(true), 123 paused_(true),
124 seeking_(false), 124 seeking_(false),
125 playback_rate_(0.0f), 125 playback_rate_(0.0),
126 ended_(false), 126 ended_(false),
127 pending_seek_(false), 127 pending_seek_(false),
128 pending_seek_seconds_(0.0f), 128 pending_seek_seconds_(0.0f),
129 should_notify_time_changed_(false), 129 should_notify_time_changed_(false),
130 client_(client), 130 client_(client),
131 delegate_(delegate), 131 delegate_(delegate),
132 defer_load_cb_(params.defer_load_cb()), 132 defer_load_cb_(params.defer_load_cb()),
133 context_3d_cb_(params.context_3d_cb()), 133 context_3d_cb_(params.context_3d_cb()),
134 supports_save_(true), 134 supports_save_(true),
135 chunk_demuxer_(NULL), 135 chunk_demuxer_(NULL),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 if (delegate_ && playback_rate_ > 0) 261 if (delegate_ && playback_rate_ > 0)
262 delegate_->DidPlay(this); 262 delegate_->DidPlay(this);
263 } 263 }
264 264
265 void WebMediaPlayerImpl::pause() { 265 void WebMediaPlayerImpl::pause() {
266 DVLOG(1) << __FUNCTION__; 266 DVLOG(1) << __FUNCTION__;
267 DCHECK(main_task_runner_->BelongsToCurrentThread()); 267 DCHECK(main_task_runner_->BelongsToCurrentThread());
268 268
269 const bool was_already_paused = paused_ || playback_rate_ == 0; 269 const bool was_already_paused = paused_ || playback_rate_ == 0;
270 paused_ = true; 270 paused_ = true;
271 pipeline_.SetPlaybackRate(0.0f); 271 pipeline_.SetPlaybackRate(0.0);
272 if (data_source_) 272 if (data_source_)
273 data_source_->MediaIsPaused(); 273 data_source_->MediaIsPaused();
274 UpdatePausedTime(); 274 UpdatePausedTime();
275 275
276 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PAUSE)); 276 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PAUSE));
277 277
278 if (!was_already_paused && delegate_) 278 if (!was_already_paused && delegate_)
279 delegate_->DidPause(this); 279 delegate_->DidPause(this);
280 } 280 }
281 281
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 1022
1023 // pause() may be called after playback has ended and the HTMLMediaElement 1023 // pause() may be called after playback has ended and the HTMLMediaElement
1024 // requires that currentTime() == duration() after ending. We want to ensure 1024 // requires that currentTime() == duration() after ending. We want to ensure
1025 // |paused_time_| matches currentTime() in this case or a future seek() may 1025 // |paused_time_| matches currentTime() in this case or a future seek() may
1026 // incorrectly discard what it thinks is a seek to the existing time. 1026 // incorrectly discard what it thinks is a seek to the existing time.
1027 paused_time_ = 1027 paused_time_ =
1028 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); 1028 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
1029 } 1029 }
1030 1030
1031 } // namespace media 1031 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/buffered_resource_loader_unittest.cc ('k') | media/filters/audio_clock_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698