You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/cbs_h2645: create a reference to the existing buffer when decomposing slice units
Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -776,15 +776,10 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
slice->data_size = len - pos / 8;
|
slice->data_size = len - pos / 8;
|
||||||
slice->data_ref = av_buffer_alloc(slice->data_size +
|
slice->data_ref = av_buffer_ref(unit->data_ref);
|
||||||
AV_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
if (!slice->data_ref)
|
if (!slice->data_ref)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
slice->data = slice->data_ref->data;
|
slice->data = unit->data + pos / 8;
|
||||||
memcpy(slice->data,
|
|
||||||
unit->data + pos / 8, slice->data_size);
|
|
||||||
memset(slice->data + slice->data_size, 0,
|
|
||||||
AV_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
slice->data_bit_start = pos % 8;
|
slice->data_bit_start = pos % 8;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -946,15 +941,10 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
slice->data_size = len - pos / 8;
|
slice->data_size = len - pos / 8;
|
||||||
slice->data_ref = av_buffer_alloc(slice->data_size +
|
slice->data_ref = av_buffer_ref(unit->data_ref);
|
||||||
AV_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
if (!slice->data_ref)
|
if (!slice->data_ref)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
slice->data = slice->data_ref->data;
|
slice->data = unit->data + pos / 8;
|
||||||
memcpy(slice->data,
|
|
||||||
unit->data + pos / 8, slice->data_size);
|
|
||||||
memset(slice->data + slice->data_size, 0,
|
|
||||||
AV_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
slice->data_bit_start = pos % 8;
|
slice->data_bit_start = pos % 8;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user