[FFmpeg-cvslog] Merge commit '113aeee6aed35cb786a9f6d69b0cb210f498b9da'
Clément Bœsch
git at videolan.org
Sun Jun 12 15:58:08 CEST 2016
ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Jun 12 15:37:58 2016 +0200| [65d5f32fd7d234a9b08e3743593de0a72af7c03c] | committer: Clément Bœsch
Merge commit '113aeee6aed35cb786a9f6d69b0cb210f498b9da'
* commit '113aeee6aed35cb786a9f6d69b0cb210f498b9da':
h264_parser: move the H264DSPContext to the parser context
H264Context is kept locally as it is currently needed for logging
(h->avctx as log context) and for is_avc and nal_length_size. These
later fields will later be obtained when the extradata parsing is
decoupled from the decoder. This code will be updated accordingly when
that commit is merged.
Merged-by: Clément Bœsch <u at pkh.me>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65d5f32fd7d234a9b08e3743593de0a72af7c03c
---
libavcodec/h264_parser.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 0913452..51ca9f2 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -48,6 +48,7 @@ typedef struct H264ParseContext {
H264Context h;
ParseContext pc;
H264ParamSets ps;
+ H264DSPContext h264dsp;
int got_first;
} H264ParseContext;
@@ -84,7 +85,7 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
}
if (state == 7) {
- i += h->h264dsp.startcode_find_candidate(buf + i, next_avc - i);
+ i += p->h264dsp.startcode_find_candidate(buf + i, next_avc - i);
if (i < next_avc)
state = 2;
} else if (state <= 2) {
@@ -684,7 +685,7 @@ static av_cold int init(AVCodecParserContext *s)
h->nb_slice_ctx = 1;
h->slice_context_count = 1;
- ff_h264dsp_init(&h->h264dsp, 8, 1);
+ ff_h264dsp_init(&p->h264dsp, 8, 1);
return 0;
}
======================================================================
diff --cc libavcodec/h264_parser.c
index 0913452,d62eb73..51ca9f2
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@@ -66,26 -62,10 +67,26 @@@ static int h264_find_frame_end(H264Pars
if (state > 13)
state = 7;
+ if (h->is_avc && !h->nal_length_size)
+ av_log(h->avctx, AV_LOG_ERROR, "AVC-parser: nal length size invalid\n");
+
for (i = 0; i < buf_size; i++) {
+ if (i >= next_avc) {
+ int nalsize = 0;
+ i = next_avc;
+ for (j = 0; j < h->nal_length_size; j++)
+ nalsize = (nalsize << 8) | buf[i++];
+ if (nalsize <= 0 || nalsize > buf_size - i) {
+ av_log(h->avctx, AV_LOG_ERROR, "AVC-parser: nal size %d remaining %d\n", nalsize, buf_size - i);
+ return buf_size;
+ }
+ next_avc = i + nalsize;
+ state = 5;
+ }
+
if (state == 7) {
- i += h->h264dsp.startcode_find_candidate(buf + i, next_avc - i);
- i += p->h264dsp.startcode_find_candidate(buf + i, buf_size - i);
- if (i < buf_size)
++ i += p->h264dsp.startcode_find_candidate(buf + i, next_avc - i);
+ if (i < next_avc)
state = 2;
} else if (state <= 2) {
if (buf[i] == 1)
More information about the ffmpeg-cvslog
mailing list