[FFmpeg-cvslog] fftools/ffmpeg_enc: set AV_PKT_FLAG_TRUSTED on encoded packets

Anton Khirnov git at videolan.org
Wed Mar 13 09:27:26 EET 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Mar  1 14:57:04 2024 +0100| [8996945d459cee6623eacb5952fc685134a97c3f] | committer: Anton Khirnov

fftools/ffmpeg_enc: set AV_PKT_FLAG_TRUSTED on encoded packets

This allows using WRAPPED_AVFRAME encoders with loopback decoders in
order to connect multiple filtergraphs together.

Clear the flag in muxers, since lavf does not need it for anything and
it would change the results of framecrc FATE tests.

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

 fftools/ffmpeg_enc.c | 2 ++
 fftools/ffmpeg_mux.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index d1dae558e1..c9a12af139 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -706,6 +706,8 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame,
                 return ret;
         }
 
+        pkt->flags |= AV_PKT_FLAG_TRUSTED;
+
         if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
             ret = update_video_stats(ost, pkt, !!vstats_filename);
             if (ret < 0)
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 59befefab2..e8e5c677b8 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -433,6 +433,7 @@ int muxer_thread(void *arg)
 
         ost = of->streams[mux->sch_stream_idx[stream_idx]];
         mt.pkt->stream_index = ost->index;
+        mt.pkt->flags       &= ~AV_PKT_FLAG_TRUSTED;
 
         ret = mux_packet_filter(mux, &mt, ost, ret < 0 ? NULL : mt.pkt, &stream_eof);
         av_packet_unref(mt.pkt);



More information about the ffmpeg-cvslog mailing list