Merge commit '897d5c3a4296f3da80b8699d1487328ca2de8e55'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 7 Nov 2014 22:19:28 +0000 (23:19 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 7 Nov 2014 22:22:10 +0000 (23:22 +0100)
* commit '897d5c3a4296f3da80b8699d1487328ca2de8e55':
  lavf: Print a warning if failed to avoid negative timestamps when requested

Conflicts:
libavformat/mux.c

See: ec6a5fc6cca22e4eb0a91cc8fba786d41ade2032
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/mux.c

@@@ -576,33 -342,19 +576,34 @@@ static int write_packet(AVFormatContex
          if (pkt->pts != AV_NOPTS_VALUE)
              pkt->pts += offset;
  
 +        av_assert2(pkt->dts == AV_NOPTS_VALUE || pkt->dts >= 0 || s->max_interleave_delta > 0);
          if (pkt->dts != AV_NOPTS_VALUE && pkt->dts < 0) {
              av_log(s, AV_LOG_WARNING,
-                    "Packets poorly interleaved, failed to avoid negative timestamp %s in stream %d\n"
-                    "try -max_interleave_delta 0 as a possible workaround\n",
+                    "Packets poorly interleaved, failed to avoid negative "
 -                   "timestamp %"PRId64" in stream %d.\n"
++                   "timestamp %s in stream %d.\n"
+                    "Try -max_interleave_delta 0 as a possible workaround.\n",
 -                   pkt->dts, pkt->stream_index);
 +                   av_ts2str(pkt->dts),
 +                   pkt->stream_index
 +            );
          }
      }
 -    ret = s->oformat->write_packet(s, pkt);
  
 -    if (s->pb && ret >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
 +    did_split = av_packet_split_side_data(pkt);
 +    if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) {
 +        AVFrame *frame = (AVFrame *)pkt->data;
 +        av_assert0(pkt->size == UNCODED_FRAME_PACKET_SIZE);
 +        ret = s->oformat->write_uncoded_frame(s, pkt->stream_index, &frame, 0);
 +        av_frame_free(&frame);
 +    } else {
 +        ret = s->oformat->write_packet(s, pkt);
 +    }
 +
 +    if (s->flush_packets && s->pb && ret >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
          avio_flush(s->pb);
  
 +    if (did_split)
 +        av_packet_merge_side_data(pkt);
 +
      return ret;
  }