Unified · Split
| @@ -1291,6 +1291,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi · 1290 unmodified lines | ||
| 1291 | 1291 | } else |
| 1292 | 1292 | ret = 0; |
| 1293 | 1293 | |
| 1294 | + /* many decoders assign whole AVFrames, thus overwriting extended_data; | |
| 1295 | + * make sure it's set correctly */ | |
| 1296 | + picture->extended_data = picture->data; | |
| 1297 | + | |
| 1294 | 1298 | return ret; |
| 1295 | 1299 | } |
| 1296 | 1300 | |
| @@ -1347,6 +1351,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, · 50 unmodified lines | ||
| 1347 | 1351 | int *got_frame_ptr, |
| 1348 | 1352 | AVPacket *avpkt) |
| 1349 | 1353 | { |
| 1354 | + int planar, channels; | |
| 1350 | 1355 | int ret = 0; |
| 1351 | 1356 | |
| 1352 | 1357 | *got_frame_ptr = 0; |
| @@ -1369,6 +1374,15 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, · 16 unmodified lines | ||
| 1369 | 1374 | frame->format = avctx->sample_fmt; |
| 1370 | 1375 | } |
| 1371 | 1376 | } |
| 1377 | + | |
| 1378 | + /* many decoders assign whole AVFrames, thus overwriting extended_data; | |
| 1379 | + * make sure it's set correctly; assume decoders that actually use | |
| 1380 | + * extended_data are doing it correctly */ | |
| 1381 | + planar = av_sample_fmt_is_planar(frame->format); | |
| 1382 | + channels = av_get_channel_layout_nb_channels(frame->channel_layout); | |
| 1383 | + if (!(planar && channels > AV_NUM_DATA_POINTERS)) | |
| 1384 | + frame->extended_data = frame->data; | |
| 1385 | + | |
| 1372 | 1386 | return ret; |
| 1373 | 1387 | } |
| 1374 | 1388 | |