Ticket #3586: 06_remove_avpacket_side_data_merging.patch

File 06_remove_avpacket_side_data_merging.patch, 4.6 KB (added by Lastique, 5 years ago)

The patch removes side data merging.

  • libavcodec/utils.c

    Fixes h263 mb_info processing. Reported upstream: https://trac.ffmpeg.org/ticket/3586
    
    old new  
    19421942
    19431943    if (ret < 0 || !*got_packet_ptr)
    19441944        av_free_packet(avpkt);
    1945     else
    1946         av_packet_merge_side_data(avpkt);
    19471945
    19481946    emms_c();
    19491947    return ret;
     
    21372135    av_frame_unref(picture);
    21382136
    21392137    if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) {
    2140         int did_split = av_packet_split_side_data(&tmp);
    21412138        ret = apply_param_change(avctx, &tmp);
    21422139        if (ret < 0) {
    21432140            av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n");
     
    21722169        emms_c(); //needed to avoid an emms_c() call before every return;
    21732170
    21742171        avctx->internal->pkt = NULL;
    2175         if (did_split) {
    2176             av_packet_free_side_data(&tmp);
    2177             if(ret == tmp.size)
    2178                 ret = avpkt->size;
    2179         }
    21802172
    21812173        if (*got_picture_ptr) {
    21822174            if (!avctx->refcounted_frames) {
     
    22842276        uint32_t discard_padding = 0;
    22852277        // copy to ensure we do not change avpkt
    22862278        AVPacket tmp = *avpkt;
    2287         int did_split = av_packet_split_side_data(&tmp);
    22882279        ret = apply_param_change(avctx, &tmp);
    22892280        if (ret < 0) {
    22902281            av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n");
     
    23722363        }
    23732364fail:
    23742365        avctx->internal->pkt = NULL;
    2375         if (did_split) {
    2376             av_packet_free_side_data(&tmp);
    2377             if(ret == tmp.size)
    2378                 ret = avpkt->size;
    2379         }
    23802366
    23812367        if (ret >= 0 && *got_frame_ptr) {
    23822368            if (!avctx->refcounted_frames) {
     
    24912477    if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) {
    24922478        AVPacket pkt_recoded;
    24932479        AVPacket tmp = *avpkt;
    2494         int did_split = av_packet_split_side_data(&tmp);
    24952480        //apply_param_change(avctx, &tmp);
    24962481
    2497         if (did_split) {
    2498             /* FFMIN() prevents overflow in case the packet wasn't allocated with
    2499              * proper padding.
    2500              * If the side data is smaller than the buffer padding size, the
    2501              * remaining bytes should have already been filled with zeros by the
    2502              * original packet allocation anyway. */
    2503             memset(tmp.data + tmp.size, 0,
    2504                    FFMIN(avpkt->size - tmp.size, FF_INPUT_BUFFER_PADDING_SIZE));
    2505         }
    2506 
    25072482        pkt_recoded = tmp;
    25082483        ret = recode_subtitle(avctx, &pkt_recoded, &tmp);
    25092484        if (ret < 0) {
     
    25492524            avctx->internal->pkt = NULL;
    25502525        }
    25512526
    2552         if (did_split) {
    2553             av_packet_free_side_data(&tmp);
    2554             if(ret == tmp.size)
    2555                 ret = avpkt->size;
    2556         }
    2557 
    25582527        if (*got_sub_ptr)
    25592528            avctx->frame_number++;
    25602529    }
  • libavformat/mux.c

    old new  
    522522 */
    523523static int write_packet(AVFormatContext *s, AVPacket *pkt)
    524524{
    525     int ret, did_split;
     525    int ret;
    526526
    527527    if (s->output_ts_offset) {
    528528        AVStream *st = s->streams[pkt->stream_index];
     
    559559        av_assert2(pkt->dts == AV_NOPTS_VALUE || pkt->dts >= 0);
    560560    }
    561561
    562     did_split = av_packet_split_side_data(pkt);
    563562    if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) {
    564563        AVFrame *frame = (AVFrame *)pkt->data;
    565564        av_assert0(pkt->size == UNCODED_FRAME_PACKET_SIZE);
     
    572571    if (s->flush_packets && s->pb && ret >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
    573572        avio_flush(s->pb);
    574573
    575     if (did_split)
    576         av_packet_merge_side_data(pkt);
    577 
    578574    return ret;
    579575}
    580576
  • libavformat/utils.c

    old new  
    15281528        }
    15291529    }
    15301530
    1531     if (ret >= 0 && !(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA))
    1532         av_packet_merge_side_data(pkt);
    1533 
    15341531    if (s->debug & FF_FDEBUG_TS)
    15351532        av_log(s, AV_LOG_DEBUG,
    15361533               "read_frame_internal stream=%d, pts=%s, dts=%s, "