diff options
author | Max Kellermann <max@duempel.org> | 2009-02-03 21:55:28 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-03 21:55:28 +0100 |
commit | 2c3fab848a048d6b1cdb80a3dbf98df57b5e9921 (patch) | |
tree | 1c820edc0d81c5690d3d2216f43772f5d9f4f484 /src/decoder | |
parent | e3ca024b0f65e512c738f9acdc56fc371616c9f8 (diff) | |
download | mpd-2c3fab848a048d6b1cdb80a3dbf98df57b5e9921.tar.gz mpd-2c3fab848a048d6b1cdb80a3dbf98df57b5e9921.tar.xz mpd-2c3fab848a048d6b1cdb80a3dbf98df57b5e9921.zip |
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.
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/ffmpeg_plugin.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index 127b75c26..68994ac31 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -228,10 +228,6 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is, &audio_size, packet_data, packet_size); - - position = av_rescale_q(packet->pts, *time_base, - (AVRational){1, 1}); - if (len < 0) { /* if error, we skip the frame */ g_message("decoding failed\n"); @@ -244,6 +240,11 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is, if (audio_size <= 0) 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, audio_buf, audio_size, position, |