aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/ffmpeg_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/ffmpeg_plugin.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index 80cc00a5e..c48918067 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -230,10 +230,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");
@@ -246,6 +242,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,