提交 6568b7df 编写于 作者: X Xinzheng Zhang

ios/videotoolbox: fix error checking for size of extra_data

上级 cb49cf1a
......@@ -447,7 +447,8 @@ static int feed_input_buffer(JNIEnv *env, IJKFF_Pipenode *node, int64_t timeUs,
int size_data_size = 0;
AVPacket *avpkt = &d->pkt_temp;
size_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &size_data_size);
if (size_data && size_data_size > AV_INPUT_BUFFER_PADDING_SIZE) {
// minimum avcC(sps,pps) = 7
if (size_data && size_data_size >= 7) {
int got_picture = 0;
AVFrame *frame = av_frame_alloc();
AVDictionary *codec_opts = NULL;
......
......@@ -760,7 +760,8 @@ static int decode_video(VideoToolBoxContext* context, AVCodecContext *avctx, AVP
if (context->ffp->vtb_handle_resolution_change &&
context->codecpar->codec_id == AV_CODEC_ID_H264) {
size_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &size_data_size);
if (size_data && size_data_size > AV_INPUT_BUFFER_PADDING_SIZE) {
// avcC(sps,pps) of size, minimum is 7
if (size_data && size_data_size > 7) {
int got_picture = 0;
AVFrame *frame = av_frame_alloc();
AVDictionary *codec_opts = NULL;
......@@ -770,7 +771,7 @@ static int decode_video(VideoToolBoxContext* context, AVCodecContext *avctx, AVP
avcodec_parameters_to_context(new_avctx, context->codecpar);
av_freep(&new_avctx->extradata);
new_avctx->extradata = av_mallocz(size_data_size);
new_avctx->extradata = av_mallocz(size_data_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!new_avctx->extradata)
return AVERROR(ENOMEM);
memcpy(new_avctx->extradata, size_data, size_data_size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册