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

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

Issue 599103003: Switch from WebMediaPlayer::maxTimeSeekable() to seekable() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 pipeline_.GetBufferedTimeRanges(); 477 pipeline_.GetBufferedTimeRanges();
478 478
479 const base::TimeDelta duration = pipeline_.GetMediaDuration(); 479 const base::TimeDelta duration = pipeline_.GetMediaDuration();
480 if (duration != kInfiniteDuration()) { 480 if (duration != kInfiniteDuration()) {
481 buffered_data_source_host_.AddBufferedTimeRanges( 481 buffered_data_source_host_.AddBufferedTimeRanges(
482 &buffered_time_ranges, duration); 482 &buffered_time_ranges, duration);
483 } 483 }
484 return ConvertToWebTimeRanges(buffered_time_ranges); 484 return ConvertToWebTimeRanges(buffered_time_ranges);
485 } 485 }
486 486
487 double WebMediaPlayerImpl::maxTimeSeekable() const { 487 blink::WebTimeRanges WebMediaPlayerImpl::seekable() const {
488 DCHECK(main_task_runner_->BelongsToCurrentThread()); 488 DCHECK(main_task_runner_->BelongsToCurrentThread());
489 489
490 // If we haven't even gotten to ReadyStateHaveMetadata yet then just 490 // If we haven't even gotten to ReadyStateHaveMetadata yet then there
491 // return 0 so that the seekable range is empty. 491 // are no seekable ranges.
492 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) 492 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
493 return 0.0; 493 return blink::WebTimeRanges();
494 494
495 // We don't support seeking in streaming media. 495 // We don't support seeking in streaming media.
496 if (data_source_ && data_source_->IsStreaming()) 496 if (data_source_ && data_source_->IsStreaming())
497 return 0.0; 497 return blink::WebTimeRanges();
498 return duration(); 498
DaleCurtis 2014/09/26 20:45:24 Ditto.
499 // If we have a duration then use [0, duration] as the seekable range.
scherkus (not reviewing) 2014/09/26 18:53:27 ditto
500 if (double range_end = duration()) {
501 blink::WebTimeRanges ranges(static_cast<size_t>(1));
502 ranges[0].start = 0.0;
503 ranges[0].end = range_end;
504 return ranges;
505 }
506
507 return blink::WebTimeRanges();
499 } 508 }
500 509
501 bool WebMediaPlayerImpl::didLoadingProgress() { 510 bool WebMediaPlayerImpl::didLoadingProgress() {
502 DCHECK(main_task_runner_->BelongsToCurrentThread()); 511 DCHECK(main_task_runner_->BelongsToCurrentThread());
503 bool pipeline_progress = pipeline_.DidLoadingProgress(); 512 bool pipeline_progress = pipeline_.DidLoadingProgress();
504 bool data_progress = buffered_data_source_host_.DidLoadingProgress(); 513 bool data_progress = buffered_data_source_host_.DidLoadingProgress();
505 return pipeline_progress || data_progress; 514 return pipeline_progress || data_progress;
506 } 515 }
507 516
508 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, 517 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas,
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 compositor_task_runner_->PostTask(FROM_HERE, 1031 compositor_task_runner_->PostTask(FROM_HERE,
1023 base::Bind(&GetCurrentFrameAndSignal, 1032 base::Bind(&GetCurrentFrameAndSignal,
1024 base::Unretained(compositor_), 1033 base::Unretained(compositor_),
1025 &video_frame, 1034 &video_frame,
1026 &event)); 1035 &event));
1027 event.Wait(); 1036 event.Wait();
1028 return video_frame; 1037 return video_frame;
1029 } 1038 }
1030 1039
1031 } // namespace media 1040 } // namespace media
OLDNEW
« content/renderer/media/android/webmediaplayer_android.cc ('K') | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698