ffmpeg: check if the time stamp is valid

When ffmpeg cannot estimate the elapsed time, it sets
AVPacket.pts=AV_NOPTS_VALUE.  Our ffmpeg decoder plugin did not check
for that special value.
This commit is contained in:
Max Kellermann 2009-02-03 21:55:28 +01:00
parent 81b6c0d77b
commit f3b73b824f
2 changed files with 6 additions and 4 deletions

1
NEWS
View File

@ -38,6 +38,7 @@ ver 0.14.2 (2009/??/??)
* decoders: * decoders:
- ffmpeg: added support for the tags comment, genre, year - ffmpeg: added support for the tags comment, genre, year
- ffmpeg: don't warn of empty packet output - ffmpeg: don't warn of empty packet output
- ffmpeg: check if the time stamp is valid
- wavpack: pass NULL if the .wvc file fails to open - wavpack: pass NULL if the .wvc file fails to open
- mikmod: call MikMod_Exit() only in the finish() method - mikmod: call MikMod_Exit() only in the finish() method
* audio outputs: * audio outputs:

View File

@ -230,10 +230,6 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
&audio_size, &audio_size,
packet_data, packet_size); packet_data, packet_size);
position = av_rescale_q(packet->pts, *time_base,
(AVRational){1, 1});
if (len < 0) { if (len < 0) {
/* if error, we skip the frame */ /* if error, we skip the frame */
g_message("decoding failed\n"); g_message("decoding failed\n");
@ -246,6 +242,11 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
if (audio_size <= 0) if (audio_size <= 0)
continue; continue;
position = packet->pts != (int64_t)AV_NOPTS_VALUE
? av_rescale_q(packet->pts, *time_base,
(AVRational){1, 1})
: 0;
cmd = decoder_data(decoder, is, cmd = decoder_data(decoder, is,
audio_buf, audio_size, audio_buf, audio_size,
position, position,