lavd: use AVFrame.duration instead of AVFrame.pkt_duration

This commit is contained in:
Anton Khirnov 2022-07-11 10:31:47 +02:00
parent 7d9ee6741c
commit 2d90fc89f2
2 changed files with 16 additions and 2 deletions

View File

@ -131,7 +131,14 @@ static int audio_write_frame(AVFormatContext *s1, int stream_index,
pkt.data = (*frame)->data[0];
pkt.size = (*frame)->nb_samples * s->frame_size;
pkt.dts = (*frame)->pkt_dts;
pkt.duration = (*frame)->pkt_duration;
#if FF_API_PKT_DURATION
FF_DISABLE_DEPRECATION_WARNINGS
if ((*frame)->pkt_duration)
pkt.duration = (*frame)->pkt_duration;
else
FF_ENABLE_DEPRECATION_WARNINGS
#endif
pkt.duration = (*frame)->duration;
return audio_write_packet(s1, &pkt);
}

View File

@ -686,7 +686,14 @@ static int pulse_write_frame(AVFormatContext *h, int stream_index,
pkt.data = (*frame)->data[0];
pkt.size = (*frame)->nb_samples * av_get_bytes_per_sample((*frame)->format) * (*frame)->ch_layout.nb_channels;
pkt.dts = (*frame)->pkt_dts;
pkt.duration = (*frame)->pkt_duration;
#if FF_API_PKT_DURATION
FF_DISABLE_DEPRECATION_WARNINGS
if ((*frame)->pkt_duration)
pkt.duration = (*frame)->pkt_duration;
else
FF_ENABLE_DEPRECATION_WARNINGS
#endif
pkt.duration = (*frame)->duration;
return pulse_write_packet(h, &pkt);
}