ext/ffmpeg/gstffmpegdec.c: Prevent division by zero (#155212).

Original commit message from CVS:
Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_chain):
Prevent division by zero (#155212).
This commit is contained in:
Ronald S. Bultje 2004-10-29 12:00:34 +00:00
parent 0e41db4c65
commit 46d853ba99
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2004-10-29 Sebastien Cote <sc5@hermes.usherb.ca>
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_chain):
Prevent division by zero (#155212).
2004-10-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2004-10-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill): * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):

View file

@ -425,12 +425,15 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data)
ffmpegdec->context->width, ffmpegdec->context->height); ffmpegdec->context->width, ffmpegdec->context->height);
/* note that ffmpeg sometimes gets the FPS wrong */ /* note that ffmpeg sometimes gets the FPS wrong */
if (GST_CLOCK_TIME_IS_VALID (expected_ts)) { if (GST_CLOCK_TIME_IS_VALID (expected_ts) &&
ffmpegdec->context->frame_rate > 0) {
GST_BUFFER_TIMESTAMP (outbuf) = expected_ts; GST_BUFFER_TIMESTAMP (outbuf) = expected_ts;
GST_BUFFER_DURATION (outbuf) = GST_SECOND * GST_BUFFER_DURATION (outbuf) = GST_SECOND *
ffmpegdec->context->frame_rate_base / ffmpegdec->context->frame_rate_base /
ffmpegdec->context->frame_rate; ffmpegdec->context->frame_rate;
expected_ts += GST_BUFFER_DURATION (outbuf); expected_ts += GST_BUFFER_DURATION (outbuf);
} else {
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf);
} }
} }
break; break;