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..e6f3435e84380bfed71ed2c640700678ee757496 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(); |
|
damienv1
2014/04/17 15:56:56
nit: Naming: would just use "duration" as seconds
gunsch
2014/04/17 18:05:54
Done.
|
| + if (duration_seconds == std::numeric_limits<double>::infinity()) { |
|
damienv1
2014/04/17 15:56:56
nit: Should use the same convention as the one in
gunsch
2014/04/17 18:05:54
Done.
|
| + return media::kInfiniteDuration(); |
| } |
| - return duration_ms; |
| + |
| + return base::TimeDelta::FromMilliseconds(duration_seconds * 1000); |
|
damienv1
2014/04/17 15:56:56
Why not using the full resolution of a TimeDelta ?
gunsch
2014/04/17 18:05:54
Better: discovered ConvertSecondsToTimestamp(doubl
|
| } |
| void MediaSourceDelegate::OnDemuxerOpened() { |