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

Unified Diff: media/filters/ffmpeg_video_decoder.cc

Issue 10832087: Remove VideoDecoderConfig.frame_rate_xxx() & VideoFrame:Get/SetDuration() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address more CR comments. Created 8 years, 5 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
« no previous file with comments | « media/filters/ffmpeg_demuxer_unittest.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_video_decoder.cc
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index 7cd2c7a95b36b234824feb0f3709d5a6f45072de..c2d34c28d0b77d57d31f5a8121c75ca587c6ef7e 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -60,8 +60,6 @@ FFmpegVideoDecoder::FFmpegVideoDecoder(
state_(kUninitialized),
codec_context_(NULL),
av_frame_(NULL),
- frame_rate_numerator_(0),
- frame_rate_denominator_(0),
decryptor_(NULL) {
}
@@ -84,8 +82,7 @@ int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context,
return ret;
scoped_refptr<VideoFrame> video_frame =
- VideoFrame::CreateFrame(format, width, height,
- kNoTimestamp(), kNoTimestamp());
+ VideoFrame::CreateFrame(format, width, height, kNoTimestamp());
for (int i = 0; i < 3; i++) {
frame->base[i] = video_frame->data(i);
@@ -189,8 +186,6 @@ void FFmpegVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream,
state_ = kNormal;
av_frame_ = avcodec_alloc_frame();
natural_size_ = config.natural_size();
- frame_rate_numerator_ = config.frame_rate_numerator();
- frame_rate_denominator_ = config.frame_rate_denominator();
status_cb.Run(PIPELINE_OK);
}
@@ -505,31 +500,8 @@ bool FFmpegVideoDecoder::Decode(
}
*video_frame = static_cast<VideoFrame*>(av_frame_->opaque);
- if (frame_rate_numerator_ == 0) {
- // A framerate of zero indicates that no timing information was available
- // during initial stream demuxing, and that the framerate should be inferred
- // from the first frame's duration.
- frame_rate_numerator_ = buffer->GetDuration().InMicroseconds();
- frame_rate_denominator_ = base::Time::kMicrosecondsPerSecond;
- }
-
- // Determine timestamp and calculate the duration based on the repeat
- // picture count. According to FFmpeg docs, the total duration can be
- // calculated as follows:
- // fps = 1 / time_base
- //
- // duration = (1 / fps) + (repeat_pict) / (2 * fps)
- // = (2 + repeat_pict) / (2 * fps)
- // = (2 + repeat_pict) / (2 * (1 / time_base))
- DCHECK_LE(av_frame_->repeat_pict, 2); // Sanity check.
- AVRational doubled_time_base;
- doubled_time_base.num = frame_rate_denominator_;
- doubled_time_base.den = frame_rate_numerator_ * 2;
-
(*video_frame)->SetTimestamp(
base::TimeDelta::FromMicroseconds(av_frame_->reordered_opaque));
- (*video_frame)->SetDuration(
- ConvertFromTimeBase(doubled_time_base, 2 + av_frame_->repeat_pict));
return true;
}
« no previous file with comments | « media/filters/ffmpeg_demuxer_unittest.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698