Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2017-11-28 19:49:21 +0300
committerAman Gupta <aman@tmm1.net>2017-11-28 19:50:13 +0300
commitb5d56d8ef1ef17487d827f1e35d02501f55218de (patch)
treedae8a42b86ed0bd4130a6e57c8bf242486e3296a /libavcodec/videotoolbox.c
parentd5d2632e3a0f1709290834fd35457cd05cf48bc8 (diff)
avcodec/videotoolbox: fix SEGV when hwaccel decoding h264 with ffmpeg.c
Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'libavcodec/videotoolbox.c')
-rw-r--r--libavcodec/videotoolbox.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index c275e0111e..afec1edf3f 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -119,7 +119,8 @@ CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
// save sps header (profile/level) used to create decoder session,
// so we can detect changes and recreate it.
- memcpy(vtctx->sps, h->ps.sps->data + 1, 3);
+ if (vtctx)
+ memcpy(vtctx->sps, h->ps.sps->data + 1, 3);
data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size);
av_free(vt_extradata);
@@ -323,6 +324,11 @@ static int videotoolbox_h264_decode_params(AVCodecContext *avctx,
uint32_t size)
{
VTContext *vtctx = avctx->internal->hwaccel_priv_data;
+ H264Context *h = avctx->priv_data;
+
+ // save sps header (profile/level) used to create decoder session
+ if (!vtctx->sps[0])
+ memcpy(vtctx->sps, h->ps.sps->data + 1, 3);
if (type == H264_NAL_SPS) {
if (size > 4 && memcmp(vtctx->sps, buffer + 1, 3) != 0) {