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

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

Issue 787373008: Pass seek event through pipeline during loading state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified to check for buffering state Created 5 years, 11 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 | « no previous file | no next file » | 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 DCHECK(main_task_runner_->BelongsToCurrentThread()); 303 DCHECK(main_task_runner_->BelongsToCurrentThread());
304 return supports_save_; 304 return supports_save_;
305 } 305 }
306 306
307 void WebMediaPlayerImpl::seek(double seconds) { 307 void WebMediaPlayerImpl::seek(double seconds) {
308 DVLOG(1) << __FUNCTION__ << "(" << seconds << "s)"; 308 DVLOG(1) << __FUNCTION__ << "(" << seconds << "s)";
309 DCHECK(main_task_runner_->BelongsToCurrentThread()); 309 DCHECK(main_task_runner_->BelongsToCurrentThread());
310 310
311 ended_ = false; 311 ended_ = false;
312 312
313 ReadyState old_state = ready_state_;
313 if (ready_state_ > WebMediaPlayer::ReadyStateHaveMetadata) 314 if (ready_state_ > WebMediaPlayer::ReadyStateHaveMetadata)
314 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); 315 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
315 316
316 base::TimeDelta seek_time = ConvertSecondsToTimestamp(seconds); 317 base::TimeDelta seek_time = ConvertSecondsToTimestamp(seconds);
317 318
318 if (seeking_) { 319 if (seeking_) {
319 pending_seek_ = true; 320 pending_seek_ = true;
320 pending_seek_seconds_ = seconds; 321 pending_seek_seconds_ = seconds;
321 if (chunk_demuxer_) 322 if (chunk_demuxer_)
322 chunk_demuxer_->CancelPendingSeek(seek_time); 323 chunk_demuxer_->CancelPendingSeek(seek_time);
323 return; 324 return;
324 } 325 }
325 326
326 media_log_->AddEvent(media_log_->CreateSeekEvent(seconds)); 327 media_log_->AddEvent(media_log_->CreateSeekEvent(seconds));
327 328
328 // Update our paused time. 329 // Update our paused time.
329 // In paused state ignore the seek operations to current time and generate 330 // In paused state ignore the seek operations to current time and generate
330 // OnPipelineSeeked and OnPipelineBufferingStateChanged events 331 // OnPipelineSeeked and OnPipelineBufferingStateChanged events
331 // to eventually fire seeking and seeked events 332 // to eventually fire seeking and seeked events
332 if (paused_) { 333 if (paused_) {
333 if (paused_time_ != seek_time) { 334 if (paused_time_ != seek_time || old_state != ReadyStateHaveEnoughData) {
DaleCurtis 2015/01/06 19:18:55 Can you see if this allows the removal of OnPipeli
334 paused_time_ = seek_time; 335 paused_time_ = seek_time;
335 } else { 336 } else {
336 main_task_runner_->PostTask( 337 main_task_runner_->PostTask(
337 FROM_HERE, base::Bind(&WebMediaPlayerImpl::OnPipelineSeeked, 338 FROM_HERE, base::Bind(&WebMediaPlayerImpl::OnPipelineSeeked,
338 AsWeakPtr(), false, PIPELINE_OK)); 339 AsWeakPtr(), false, PIPELINE_OK));
339 main_task_runner_->PostTask( 340 main_task_runner_->PostTask(
340 FROM_HERE, 341 FROM_HERE,
341 base::Bind(&WebMediaPlayerImpl::OnPipelineBufferingStateChanged, 342 base::Bind(&WebMediaPlayerImpl::OnPipelineBufferingStateChanged,
342 AsWeakPtr(), BUFFERING_HAVE_ENOUGH)); 343 AsWeakPtr(), BUFFERING_HAVE_ENOUGH));
343 return; 344 return;
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 compositor_task_runner_->PostTask(FROM_HERE, 1027 compositor_task_runner_->PostTask(FROM_HERE,
1027 base::Bind(&GetCurrentFrameAndSignal, 1028 base::Bind(&GetCurrentFrameAndSignal,
1028 base::Unretained(compositor_), 1029 base::Unretained(compositor_),
1029 &video_frame, 1030 &video_frame,
1030 &event)); 1031 &event));
1031 event.Wait(); 1032 event.Wait();
1032 return video_frame; 1033 return video_frame;
1033 } 1034 }
1034 1035
1035 } // namespace media 1036 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698