Chromium Code Reviews

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

Issue 740663002: Relanding 'Ignore seek operations to the current time in pause state' patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 319 matching lines...)
330 pending_seek_ = true; 330 pending_seek_ = true;
331 pending_seek_seconds_ = seconds; 331 pending_seek_seconds_ = seconds;
332 if (chunk_demuxer_) 332 if (chunk_demuxer_)
333 chunk_demuxer_->CancelPendingSeek(seek_time); 333 chunk_demuxer_->CancelPendingSeek(seek_time);
334 return; 334 return;
335 } 335 }
336 336
337 media_log_->AddEvent(media_log_->CreateSeekEvent(seconds)); 337 media_log_->AddEvent(media_log_->CreateSeekEvent(seconds));
338 338
339 // Update our paused time. 339 // Update our paused time.
340 if (paused_) 340 // In paused state ignore the seek operations to current time and generate
341 paused_time_ = seek_time; 341 // buffer state change event to eventually fire seeking and seeked events
342 if (paused_) {
343 if (paused_time_ != seek_time) {
344 paused_time_ = seek_time;
345 } else {
346 main_task_runner_->PostTask(
347 FROM_HERE,
348 base::Bind(&WebMediaPlayerImpl::OnPipelineBufferingStateChanged,
349 AsWeakPtr(),
350 BUFFERING_HAVE_ENOUGH));
351 return;
352 }
353 }
342 354
343 seeking_ = true; 355 seeking_ = true;
344 356
345 if (chunk_demuxer_) 357 if (chunk_demuxer_)
346 chunk_demuxer_->StartWaitingForSeek(seek_time); 358 chunk_demuxer_->StartWaitingForSeek(seek_time);
347 359
348 // Kick off the asynchronous seek! 360 // Kick off the asynchronous seek!
349 pipeline_.Seek( 361 pipeline_.Seek(
350 seek_time, 362 seek_time,
351 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, true)); 363 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, true));
(...skipping 674 matching lines...)
1026 compositor_task_runner_->PostTask(FROM_HERE, 1038 compositor_task_runner_->PostTask(FROM_HERE,
1027 base::Bind(&GetCurrentFrameAndSignal, 1039 base::Bind(&GetCurrentFrameAndSignal,
1028 base::Unretained(compositor_), 1040 base::Unretained(compositor_),
1029 &video_frame, 1041 &video_frame,
1030 &event)); 1042 &event));
1031 event.Wait(); 1043 event.Wait();
1032 return video_frame; 1044 return video_frame;
1033 } 1045 }
1034 1046
1035 } // namespace media 1047 } // namespace media
OLDNEW
« media/base/pipeline_unittest.cc ('K') | « media/base/pipeline_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine