Skip to content

Instantly share code, notes, and snippets.

@rcombs

rcombs/stdin Secret

Created June 24, 2015 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcombs/c4a7a17b7c05a07a216c to your computer and use it in GitHub Desktop.
Save rcombs/c4a7a17b7c05a07a216c to your computer and use it in GitHub Desktop.
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 3b525ad..37d9caa 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1568,7 +1568,8 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration,
keyframe != 0);
if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 &&
- (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
+ (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1) &&
+ pkt->data)
ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
else if (codec->codec_id == AV_CODEC_ID_HEVC && codec->extradata_size > 6 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment