]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hls: Use av_init_pkt() directly
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 14 Aug 2020 20:59:57 +0000 (22:59 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 18 Aug 2020 05:03:00 +0000 (07:03 +0200)
and remove reset_packet(). The packet's data pointer is already zeroed,
so the only thing that reset_packet() does that av_init_pkt() doesn't is
redundant.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/hls.c

index 8217c5ede49dcb504541a409b5edea3af9157082..3ab07f1b3f26691d6ecf8b19b17b7338f77c75e7 100644 (file)
@@ -293,28 +293,18 @@ static void free_rendition_list(HLSContext *c)
     c->n_renditions = 0;
 }
 
-/*
- * Used to reset a statically allocated AVPacket to a clean state,
- * containing no data.
- */
-static void reset_packet(AVPacket *pkt)
-{
-    av_init_packet(pkt);
-    pkt->data = NULL;
-}
-
 static struct playlist *new_playlist(HLSContext *c, const char *url,
                                      const char *base)
 {
     struct playlist *pls = av_mallocz(sizeof(struct playlist));
     if (!pls)
         return NULL;
-    reset_packet(&pls->pkt);
     ff_make_absolute_url(pls->url, sizeof(pls->url), base, url);
     if (!pls->url[0]) {
         av_free(pls);
         return NULL;
     }
+    av_init_packet(&pls->pkt);
     pls->seek_timestamp = AV_NOPTS_VALUE;
 
     pls->is_id3_timestamped = -1;