aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_slice.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-04 16:08:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-04 17:00:12 +0200
commit98c5db89bb7a6b1236124c27da7d1a8812d17a5b (patch)
treeccb861b4efdfaa82283546b615f2b0ebe19eccfc /libavcodec/h264_slice.c
parent514d9bb55d4f00a4babc25e3a9817521c0502a47 (diff)
downloadffmpeg-98c5db89bb7a6b1236124c27da7d1a8812d17a5b.tar.gz
avcodec/h264_slice: make current_slice reset code more strict
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264_slice.c')
-rw-r--r--libavcodec/h264_slice.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 3f400def34..ac3c50ce51 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1206,11 +1206,21 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
first_mb_in_slice = get_ue_golomb_long(&sl->gb);
if (first_mb_in_slice == 0) { // FIXME better field boundary detection
- if (h->current_slice && h->cur_pic_ptr && FIELD_PICTURE(h)) {
- ff_h264_field_end(h, sl, 1);
+ if (h->current_slice) {
+ if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) {
+ ff_h264_field_end(h, sl, 1);
+ h->current_slice = 0;
+ } else if (h->cur_pic_ptr && !FIELD_PICTURE(h) && !h->first_field && h->nal_unit_type == NAL_IDR_SLICE) {
+ av_log(h, AV_LOG_WARNING, "Broken frame packetizing\n");
+ ff_h264_field_end(h, sl, 1);
+ h->current_slice = 0;
+ ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0);
+ ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1);
+ h->cur_pic_ptr = NULL;
+ } else
+ return AVERROR_INVALIDDATA;
}
- h->current_slice = 0;
if (!h->first_field) {
if (h->cur_pic_ptr && !h->droppable) {
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,