[FFmpeg-cvslog] lavd: use AVFrame.duration instead of AVFrame.pkt_duration

Anton Khirnov git at videolan.org
Tue Jul 19 13:36:48 EEST 2022


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Jul 11 10:31:47 2022 +0200| [2d90fc89f2a804a096ff092797c14432b63c8120] | committer: Anton Khirnov

lavd: use AVFrame.duration instead of AVFrame.pkt_duration

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2d90fc89f2a804a096ff092797c14432b63c8120
---

 libavdevice/alsa_enc.c        | 9 ++++++++-
 libavdevice/pulse_audio_enc.c | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavdevice/alsa_enc.c b/libavdevice/alsa_enc.c
index ac09e33c49..e461829d03 100644
--- a/libavdevice/alsa_enc.c
+++ b/libavdevice/alsa_enc.c
@@ -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);
 }
 
diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c
index d5928e2b3f..038401c680 100644
--- a/libavdevice/pulse_audio_enc.c
+++ b/libavdevice/pulse_audio_enc.c
@@ -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);
 }
 



More information about the ffmpeg-cvslog mailing list