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

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

Issue 684473002: Revert unintended prevention of seeks on infinite duration media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove header. Created 6 years, 1 month 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 | « content/renderer/media/android/webmediaplayer_android.cc ('k') | 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 if (duration != kInfiniteDuration()) { 488 if (duration != kInfiniteDuration()) {
489 buffered_data_source_host_.AddBufferedTimeRanges( 489 buffered_data_source_host_.AddBufferedTimeRanges(
490 &buffered_time_ranges, duration); 490 &buffered_time_ranges, duration);
491 } 491 }
492 return ConvertToWebTimeRanges(buffered_time_ranges); 492 return ConvertToWebTimeRanges(buffered_time_ranges);
493 } 493 }
494 494
495 blink::WebTimeRanges WebMediaPlayerImpl::seekable() const { 495 blink::WebTimeRanges WebMediaPlayerImpl::seekable() const {
496 DCHECK(main_task_runner_->BelongsToCurrentThread()); 496 DCHECK(main_task_runner_->BelongsToCurrentThread());
497 497
498 // Media without duration are considered streaming and should not be seekable. 498 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
499 const double seekable_end = duration();
500 if (!base::IsFinite(seekable_end))
501 return blink::WebTimeRanges(); 499 return blink::WebTimeRanges();
502 500
503 // If we have a finite duration then use [0, duration] as the seekable range; 501 const double seekable_end = duration();
504 // unless it's a streaming source, in which case only allow a seek to zero. 502
505 blink::WebTimeRange seekable_range( 503 // Allow a special exception for seeks to zero for streaming sources with a
506 0.0, data_source_ && data_source_->IsStreaming() ? 0.0 : seekable_end); 504 // finite duration; this allows looping to work.
505 const bool allow_seek_to_zero = data_source_ && data_source_->IsStreaming() &&
506 base::IsFinite(seekable_end);
507
508 // TODO(dalecurtis): Technically this allows seeking on media which return an
509 // infinite duration so long as DataSource::IsStreaming() is false. While not
510 // expected, disabling this breaks semi-live players, http://crbug.com/427412.
511 const blink::WebTimeRange seekable_range(
512 0.0, allow_seek_to_zero ? 0.0 : seekable_end);
507 return blink::WebTimeRanges(&seekable_range, 1); 513 return blink::WebTimeRanges(&seekable_range, 1);
508 } 514 }
509 515
510 bool WebMediaPlayerImpl::didLoadingProgress() { 516 bool WebMediaPlayerImpl::didLoadingProgress() {
511 DCHECK(main_task_runner_->BelongsToCurrentThread()); 517 DCHECK(main_task_runner_->BelongsToCurrentThread());
512 bool pipeline_progress = pipeline_.DidLoadingProgress(); 518 bool pipeline_progress = pipeline_.DidLoadingProgress();
513 bool data_progress = buffered_data_source_host_.DidLoadingProgress(); 519 bool data_progress = buffered_data_source_host_.DidLoadingProgress();
514 return pipeline_progress || data_progress; 520 return pipeline_progress || data_progress;
515 } 521 }
516 522
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 compositor_task_runner_->PostTask(FROM_HERE, 1032 compositor_task_runner_->PostTask(FROM_HERE,
1027 base::Bind(&GetCurrentFrameAndSignal, 1033 base::Bind(&GetCurrentFrameAndSignal,
1028 base::Unretained(compositor_), 1034 base::Unretained(compositor_),
1029 &video_frame, 1035 &video_frame,
1030 &event)); 1036 &event));
1031 event.Wait(); 1037 event.Wait();
1032 return video_frame; 1038 return video_frame;
1033 } 1039 }
1034 1040
1035 } // namespace media 1041 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698