diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index 77a3ce40be..240f1a918c 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -34,7 +34,8 @@
 #include "libavcodec/get_bits.h"
 
 struct PayloadContext {
-    AVPacket pkt;
+    uint8_t *data;
+    int size, flags;
     int bytes_per_frame, remaining;
     uint32_t timestamp;
 };
@@ -51,18 +52,18 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
         keyframe;
 
     if (qt->remaining) {
-        int num = qt->pkt.size / qt->bytes_per_frame;
+        int num = qt->size / qt->bytes_per_frame;
 
         if (av_new_packet(pkt, qt->bytes_per_frame))
             return AVERROR(ENOMEM);
         pkt->stream_index = st->index;
-        pkt->flags        = qt->pkt.flags;
+        pkt->flags        = qt->flags;
         memcpy(pkt->data,
-               &qt->pkt.data[(num - qt->remaining) * qt->bytes_per_frame],
+               &qt->data[(num - qt->remaining) * qt->bytes_per_frame],
                qt->bytes_per_frame);
         if (--qt->remaining == 0) {
-            av_freep(&qt->pkt.data);
-            qt->pkt.size = 0;
+            av_freep(&qt->data);
+            qt->size = 0;
         }
         return qt->remaining > 0;
     }
@@ -171,31 +172,31 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
 
     switch (packing_scheme) {
     case 3: /* one data packet spread over 1 or multiple RTP packets */
-        if (qt->pkt.size > 0 && qt->timestamp == *timestamp) {
+        if (qt->size > 0 && qt->timestamp == *timestamp) {
             int err;
-            if ((err = av_reallocp(&qt->pkt.data, qt->pkt.size + alen +
+            if ((err = av_reallocp(&qt->data, qt->size + alen +
                                    AV_INPUT_BUFFER_PADDING_SIZE)) < 0) {
-                qt->pkt.size = 0;
+                qt->size = 0;
                 return err;
             }
         } else {
-            av_freep(&qt->pkt.data);
-            av_init_packet(&qt->pkt);
-            qt->pkt.data = av_realloc(NULL, alen + AV_INPUT_BUFFER_PADDING_SIZE);
-            if (!qt->pkt.data)
+            av_freep(&qt->data);
+            qt->flags = 0;
+            qt->data  = av_realloc(NULL, alen + AV_INPUT_BUFFER_PADDING_SIZE);
+            if (!qt->data)
                 return AVERROR(ENOMEM);
-            qt->pkt.size = 0;
+            qt->size  = 0;
             qt->timestamp = *timestamp;
         }
-        memcpy(qt->pkt.data + qt->pkt.size, buf + avio_tell(&pb), alen);
-        qt->pkt.size += alen;
+        memcpy(qt->data + qt->size, buf + avio_tell(&pb), alen);
+        qt->size += alen;
         if (has_marker_bit) {
-            int ret = av_packet_from_data(pkt, qt->pkt.data, qt->pkt.size);
+            int ret = av_packet_from_data(pkt, qt->data, qt->size);
             if (ret < 0)
                 return ret;
 
-            qt->pkt.size = 0;
-            qt->pkt.data = NULL;
+            qt->size = 0;
+            qt->data = NULL;
             pkt->flags        = keyframe ? AV_PKT_FLAG_KEY : 0;
             pkt->stream_index = st->index;
             memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
@@ -214,17 +215,17 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
         pkt->flags = keyframe ? AV_PKT_FLAG_KEY : 0;
         pkt->stream_index = st->index;
         if (qt->remaining > 0) {
-            av_freep(&qt->pkt.data);
-            qt->pkt.data = av_realloc(NULL, qt->remaining * qt->bytes_per_frame);
-            if (!qt->pkt.data) {
+            av_freep(&qt->data);
+            qt->data = av_realloc(NULL, qt->remaining * qt->bytes_per_frame);
+            if (!qt->data) {
                 av_packet_unref(pkt);
                 return AVERROR(ENOMEM);
             }
-            qt->pkt.size = qt->remaining * qt->bytes_per_frame;
-            memcpy(qt->pkt.data,
+            qt->size = qt->remaining * qt->bytes_per_frame;
+            memcpy(qt->data,
                    buf + avio_tell(&pb) + qt->bytes_per_frame,
                    qt->remaining * qt->bytes_per_frame);
-            qt->pkt.flags = pkt->flags;
+            qt->flags = pkt->flags;
             return 1;
         }
         return 0;
@@ -237,7 +238,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
 
 static void qt_rtp_close(PayloadContext *qt)
 {
-    av_freep(&qt->pkt.data);
+    av_freep(&qt->data);
 }
 
 #define RTP_QT_HANDLER(m, n, s, t) \
