Commit 8015150f authored by Hendrik Leppkes's avatar Hendrik Leppkes

Merge commit '9469370f'

* commit '9469370f':
  h264: Use AVERROR return codes instead of -1

Only partially merged, as the first hunk is not correct and would result
in endless log spam.
Merged-by: 's avatarHendrik Leppkes <h.leppkes@gmail.com>
parents 3d2d6728 9469370f
...@@ -1191,15 +1191,16 @@ static inline int get_avc_nalsize(H264Context *h, const uint8_t *buf, ...@@ -1191,15 +1191,16 @@ static inline int get_avc_nalsize(H264Context *h, const uint8_t *buf,
{ {
int i, nalsize = 0; int i, nalsize = 0;
if (*buf_index >= buf_size - h->nal_length_size) if (*buf_index >= buf_size - h->nal_length_size) {
return -1; return AVERROR(EAGAIN);
}
for (i = 0; i < h->nal_length_size; i++) for (i = 0; i < h->nal_length_size; i++)
nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++]; nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
if (nalsize <= 0 || nalsize > buf_size - *buf_index) { if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
av_log(h->avctx, AV_LOG_ERROR, av_log(h->avctx, AV_LOG_ERROR,
"AVC: nal size %d\n", nalsize); "AVC: nal size %d\n", nalsize);
return -1; return AVERROR_INVALIDDATA;
} }
return nalsize; return nalsize;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment