Fixes h263 mb_info processing. Reported upstream: https://trac.ffmpeg.org/ticket/3586
|
old
|
new
|
|
| 1942 | 1942 | |
| 1943 | 1943 | if (ret < 0 || !*got_packet_ptr) |
| 1944 | 1944 | av_free_packet(avpkt); |
| 1945 | | else |
| 1946 | | av_packet_merge_side_data(avpkt); |
| 1947 | 1945 | |
| 1948 | 1946 | emms_c(); |
| 1949 | 1947 | return ret; |
| … |
… |
|
| 2137 | 2135 | av_frame_unref(picture); |
| 2138 | 2136 | |
| 2139 | 2137 | 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); |
| 2141 | 2138 | ret = apply_param_change(avctx, &tmp); |
| 2142 | 2139 | if (ret < 0) { |
| 2143 | 2140 | av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n"); |
| … |
… |
|
| 2172 | 2169 | emms_c(); //needed to avoid an emms_c() call before every return; |
| 2173 | 2170 | |
| 2174 | 2171 | 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 | | } |
| 2180 | 2172 | |
| 2181 | 2173 | if (*got_picture_ptr) { |
| 2182 | 2174 | if (!avctx->refcounted_frames) { |
| … |
… |
|
| 2284 | 2276 | uint32_t discard_padding = 0; |
| 2285 | 2277 | // copy to ensure we do not change avpkt |
| 2286 | 2278 | AVPacket tmp = *avpkt; |
| 2287 | | int did_split = av_packet_split_side_data(&tmp); |
| 2288 | 2279 | ret = apply_param_change(avctx, &tmp); |
| 2289 | 2280 | if (ret < 0) { |
| 2290 | 2281 | av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n"); |
| … |
… |
|
| 2372 | 2363 | } |
| 2373 | 2364 | fail: |
| 2374 | 2365 | 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 | | } |
| 2380 | 2366 | |
| 2381 | 2367 | if (ret >= 0 && *got_frame_ptr) { |
| 2382 | 2368 | if (!avctx->refcounted_frames) { |
| … |
… |
|
| 2491 | 2477 | if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) { |
| 2492 | 2478 | AVPacket pkt_recoded; |
| 2493 | 2479 | AVPacket tmp = *avpkt; |
| 2494 | | int did_split = av_packet_split_side_data(&tmp); |
| 2495 | 2480 | //apply_param_change(avctx, &tmp); |
| 2496 | 2481 | |
| 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 | | |
| 2507 | 2482 | pkt_recoded = tmp; |
| 2508 | 2483 | ret = recode_subtitle(avctx, &pkt_recoded, &tmp); |
| 2509 | 2484 | if (ret < 0) { |
| … |
… |
|
| 2549 | 2524 | avctx->internal->pkt = NULL; |
| 2550 | 2525 | } |
| 2551 | 2526 | |
| 2552 | | if (did_split) { |
| 2553 | | av_packet_free_side_data(&tmp); |
| 2554 | | if(ret == tmp.size) |
| 2555 | | ret = avpkt->size; |
| 2556 | | } |
| 2557 | | |
| 2558 | 2527 | if (*got_sub_ptr) |
| 2559 | 2528 | avctx->frame_number++; |
| 2560 | 2529 | } |