]> git.sesse.net Git - ffmpeg/commitdiff
ffplay, avcodec, avformat: Don't initialize before av_packet_ref()
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 1 Dec 2019 09:04:02 +0000 (10:04 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 28 Mar 2020 03:17:20 +0000 (04:17 +0100)
It already initializes the packet.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
fftools/ffplay.c
libavcodec/qsvdec_h2645.c
libavcodec/qsvdec_other.c
libavformat/fifo.c
libavformat/img2enc.c
libavformat/tee.c

index f6511e4afdfab96ba9e60fd754fa7f5186421750..2ed4b22d3e0b465cfd2b1b6c54127f1542208a18 100644 (file)
@@ -2977,7 +2977,7 @@ static int read_thread(void *arg)
         }
         if (is->queue_attachments_req) {
             if (is->video_st && is->video_st->disposition & AV_DISPOSITION_ATTACHED_PIC) {
-                AVPacket copy = { 0 };
+                AVPacket copy;
                 if ((ret = av_packet_ref(&copy, &is->video_st->attached_pic)) < 0)
                     goto fail;
                 packet_queue_put(&is->videoq, &copy);
index 730feed20a69dc2a0dc9dd031b7b4001f845509f..02c41883b6ab7ea4c85ac380efcaccf0cc250acb 100644 (file)
@@ -125,7 +125,7 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data,
 
     /* buffer the input packet */
     if (avpkt->size) {
-        AVPacket input_ref = { 0 };
+        AVPacket input_ref;
 
         if (av_fifo_space(s->packet_fifo) < sizeof(input_ref)) {
             ret = av_fifo_realloc2(s->packet_fifo,
index ff2834c20bad0b86e77496e650952398a3e7e9a8..b4df76739cdc92eb85fe4af0b737e89a2c0c6763 100644 (file)
@@ -123,7 +123,7 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data,
 
     /* buffer the input packet */
     if (avpkt->size) {
-        AVPacket input_ref = { 0 };
+        AVPacket input_ref;
 
         if (av_fifo_space(s->packet_fifo) < sizeof(input_ref)) {
             ret = av_fifo_realloc2(s->packet_fifo,
index 7b37fff6da119c170098dafbacfa37a5f4855ecb..d11dc6626c7d81566f8dc9284122bde26c3eb34f 100644 (file)
@@ -536,7 +536,6 @@ static int fifo_write_packet(AVFormatContext *avf, AVPacket *pkt)
     int ret;
 
     if (pkt) {
-        av_init_packet(&msg.pkt);
         ret = av_packet_ref(&msg.pkt,pkt);
         if (ret < 0)
             return ret;
index a2786ec6f858f55470c371251800f3cefd39862c..b303d382398fcc370f83af012b45aa16dc76590f 100644 (file)
@@ -78,7 +78,7 @@ static int write_muxed_file(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
     VideoMuxData *img = s->priv_data;
     AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
     AVStream *st;
-    AVPacket pkt2 = {0};
+    AVPacket pkt2;
     AVFormatContext *fmt = NULL;
     int ret;
 
@@ -88,8 +88,8 @@ static int write_muxed_file(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
         return ret;
     st = avformat_new_stream(fmt, NULL);
     if (!st) {
-        avformat_free_context(fmt);
-        return AVERROR(ENOMEM);
+        ret = AVERROR(ENOMEM);
+        goto out;
     }
     st->id = pkt->stream_index;
 
@@ -105,8 +105,8 @@ static int write_muxed_file(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
         (ret = av_interleaved_write_frame(fmt, &pkt2))         < 0 ||
         (ret = av_write_trailer(fmt))) {}
 
-out:
     av_packet_unref(&pkt2);
+out:
     avformat_free_context(fmt);
     return ret;
 }
index 56669d9d8e4f8d088607968781a0010a5c0d2c7f..f2b11fcb359afcf5198fc7eefe5e6483170473d6 100644 (file)
@@ -564,7 +564,6 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt)
         if (s2 < 0)
             continue;
 
-        memset(&pkt2, 0, sizeof(AVPacket));
         if ((ret = av_packet_ref(&pkt2, pkt)) < 0)
             if (!ret_all) {
                 ret_all = ret;