lavf/mux: do not pass a copy of the packet to write_packet().
authorClément Bœsch <ubitux@gmail.com>
Tue, 8 Jan 2013 21:39:25 +0000 (22:39 +0100)
committerClément Bœsch <ubitux@gmail.com>
Tue, 8 Jan 2013 22:21:05 +0000 (23:21 +0100)
Sometimes the muxer modifies the packet, like for instance lavf/mp3enc
changing pkt->destruct in order to keep a copy. These changes must be
kept, even though the muxer behaviour is questionable. Regression since
0072116.

Fixes #2124.

libavformat/mux.c

index c7e176a..c34a294 100644 (file)
@@ -490,13 +490,12 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
  */
 static inline int split_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    int ret;
-    AVPacket spkt = *pkt;
+    int ret, did_split;
 
-    av_packet_split_side_data(&spkt);
-    ret = s->oformat->write_packet(s, &spkt);
-    spkt.data = NULL;
-    av_destruct_packet(&spkt);
+    did_split = av_packet_split_side_data(pkt);
+    ret = s->oformat->write_packet(s, pkt);
+    if (did_split)
+        av_packet_merge_side_data(pkt);
     return ret;
 }