Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / renderer / media / android / media_source_delegate.cc
index bd32e70..eb4f5c3 100644 (file)
@@ -114,6 +114,14 @@ bool MediaSourceDelegate::IsVideoEncrypted() {
   return is_video_encrypted_;
 }
 
+base::Time MediaSourceDelegate::GetTimelineOffset() const {
+  DCHECK(main_loop_->BelongsToCurrentThread());
+  if (!chunk_demuxer_)
+    return base::Time();
+
+  return chunk_demuxer_->GetTimelineOffset();
+}
+
 void MediaSourceDelegate::StopDemuxer() {
   DCHECK(media_loop_->BelongsToCurrentThread());
   DCHECK(chunk_demuxer_);
@@ -300,14 +308,6 @@ void MediaSourceDelegate::SeekInternal(const base::TimeDelta& seek_time) {
       media_weak_factory_.GetWeakPtr()));
 }
 
-void MediaSourceDelegate::SetTotalBytes(int64 total_bytes) {
-  NOTIMPLEMENTED();
-}
-
-void MediaSourceDelegate::AddBufferedByteRange(int64 start, int64 end) {
-  NOTIMPLEMENTED();
-}
-
 void MediaSourceDelegate::AddBufferedTimeRange(base::TimeDelta start,
                                                base::TimeDelta end) {
   buffered_time_ranges_.Add(start, end);
@@ -685,7 +685,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);
@@ -694,18 +694,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() {