Chromium Code Reviews| 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..450ffa803b0b2316a1dab396dfc4cb0b6aed79fa 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,17 @@ void MediaSourceDelegate::NotifyDemuxerReady() { |
| is_video_encrypted_ = configs->is_video_encrypted; |
| } |
| -int MediaSourceDelegate::GetDurationMs() { |
| +base::TimeDelta MediaSourceDelegate::GetDuration() { |
| 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(); |
| + double duration_seconds = chunk_demuxer_->GetDuration(); |
| + if (duration_seconds == std::numeric_limits<double>::infinity()) { |
| + return media::kInfiniteDuration(); |
| } |
| - return duration_ms; |
| + |
| + return base::TimeDelta::FromSeconds(duration_seconds); |
|
damienv1
2014/04/16 21:57:52
By doing that you have only a "1 second" accuracy
gunsch
2014/04/16 22:01:05
Good catch, I missed the int cast. Fixed.
|
| } |
| void MediaSourceDelegate::OnDemuxerOpened() { |