Chromium Code Reviews| Index: media/formats/webm/webm_cluster_parser.cc |
| diff --git a/media/formats/webm/webm_cluster_parser.cc b/media/formats/webm/webm_cluster_parser.cc |
| index 6e2424b101efc6a78fae978553bb96c21254085a..04264ed7d20096f371b0f7852e60f849cdc687ff 100644 |
| --- a/media/formats/webm/webm_cluster_parser.cc |
| +++ b/media/formats/webm/webm_cluster_parser.cc |
| @@ -113,13 +113,13 @@ int WebMClusterParser::Parse(const uint8* buf, int size) { |
| const WebMClusterParser::BufferQueue& WebMClusterParser::GetAudioBuffers() { |
| if (cluster_ended_) |
| - audio_.ApplyDurationDefaultOrEstimateIfNeeded(); |
| + audio_.ApplyDurationEstimateIfNeeded(); |
| return audio_.buffers(); |
| } |
| const WebMClusterParser::BufferQueue& WebMClusterParser::GetVideoBuffers() { |
| if (cluster_ended_) |
| - video_.ApplyDurationDefaultOrEstimateIfNeeded(); |
| + video_.ApplyDurationEstimateIfNeeded(); |
| return video_.buffers(); |
| } |
| @@ -133,7 +133,7 @@ WebMClusterParser::GetTextBuffers() { |
| ++itr) { |
| // Per OnBlock(), all text buffers should already have valid durations, so |
| // there is no need to call |
| - // itr->second.ApplyDurationDefaultOrEstimateIfNeeded() here. |
| + // itr->second.ApplyDurationEstimateIfNeeded() here. |
| const BufferQueue& text_buffers = itr->second.buffers(); |
| if (!text_buffers.empty()) |
| text_buffers_map_.insert(std::make_pair(itr->first, text_buffers)); |
| @@ -407,6 +407,8 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, int track_num, |
| if (block_duration >= 0) { |
| buffer->set_duration(base::TimeDelta::FromMicroseconds( |
| block_duration * timecode_multiplier_)); |
| + } else { |
| + buffer->set_duration(track->default_duration()); |
|
wolenetz
2014/04/09 21:53:47
nit: DCHECK_NE(DemuxerStream::TEXT, buffer_type) t
Sergey Ulanov
2014/04/10 02:00:49
Done.
|
| } |
| if (discard_padding != 0) { |
| @@ -465,14 +467,13 @@ bool WebMClusterParser::Track::AddBuffer( |
| return QueueBuffer(buffer); |
| } |
| -void WebMClusterParser::Track::ApplyDurationDefaultOrEstimateIfNeeded() { |
| +void WebMClusterParser::Track::ApplyDurationEstimateIfNeeded() { |
| if (!last_added_buffer_missing_duration_) |
| return; |
| - last_added_buffer_missing_duration_->set_duration( |
| - GetDurationDefaultOrEstimate()); |
| + last_added_buffer_missing_duration_->set_duration(GetDurationEstimate()); |
| - DVLOG(2) << "ApplyDurationDefaultOrEstimateIfNeeded() : new dur : " |
| + DVLOG(2) << "ApplyDurationEstimateIfNeeded() : new dur : " |
| << " ts " |
| << last_added_buffer_missing_duration_->timestamp().InSecondsF() |
| << " dur " |
| @@ -536,13 +537,10 @@ bool WebMClusterParser::Track::QueueBuffer( |
| return true; |
| } |
| -base::TimeDelta WebMClusterParser::Track::GetDurationDefaultOrEstimate() { |
| - base::TimeDelta duration = default_duration_; |
| +base::TimeDelta WebMClusterParser::Track::GetDurationEstimate() { |
| + base::TimeDelta duration = estimated_next_frame_duration_; |
| if (duration != kNoTimestamp()) { |
| - DVLOG(3) << __FUNCTION__ << " : using TrackEntry DefaultDuration"; |
| - } else if (estimated_next_frame_duration_ != kNoTimestamp()) { |
| DVLOG(3) << __FUNCTION__ << " : using estimated duration"; |
| - duration = estimated_next_frame_duration_; |
| } else { |
| DVLOG(3) << __FUNCTION__ << " : using hardcoded default duration"; |
| if (is_video_) { |