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

Unified Diff: content/renderer/media/android/media_source_delegate.cc

Issue 239743005: Updates WebMediaPlayerAndroid and MediaSourceDelegate to respect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/android/media_source_delegate.cc
diff --git a/content/renderer/media/android/media_source_delegate.cc b/content/renderer/media/android/media_source_delegate.cc
index 58514be19423f6e957b90ac5e33b84a937a85b1a..324ee80b47a1b2f74b8072c73b02e4833d602846 100644
--- a/content/renderer/media/android/media_source_delegate.cc
+++ b/content/renderer/media/android/media_source_delegate.cc
@@ -677,7 +677,7 @@ void MediaSourceDelegate::NotifyDemuxerReady() {
configs->video_extra_data = std::vector<uint8>(
config.extra_data(), config.extra_data() + config.extra_data_size());
}
- configs->duration_ms = GetDurationMs();
+ configs->duration = GetDuration();
if (demuxer_client_)
demuxer_client_->DemuxerReady(demuxer_client_id_, *configs);
@@ -686,18 +686,16 @@ void MediaSourceDelegate::NotifyDemuxerReady() {
is_video_encrypted_ = configs->is_video_encrypted;
}
-int MediaSourceDelegate::GetDurationMs() {
+base::TimeDelta MediaSourceDelegate::GetDuration() const {
DCHECK(media_loop_->BelongsToCurrentThread());
if (!chunk_demuxer_)
- return -1;
+ return media::kNoTimestamp();
- double duration_ms = chunk_demuxer_->GetDuration() * 1000;
- if (duration_ms > std::numeric_limits<int32>::max()) {
- LOG(WARNING) << "Duration from ChunkDemuxer is too large; probably "
- "something has gone wrong.";
- return std::numeric_limits<int32>::max();
- }
- return duration_ms;
+ double duration = chunk_demuxer_->GetDuration();
+ if (duration == std::numeric_limits<double>::infinity())
+ return media::kInfiniteDuration();
+
+ return ConvertSecondsToTimestamp(duration);
}
void MediaSourceDelegate::OnDemuxerOpened() {
« no previous file with comments | « content/renderer/media/android/media_source_delegate.h ('k') | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698