return FALSE;
}
+ if (priv->prev_ref_frame_num == frame_num) {
+ GST_TRACE_OBJECT (self,
+ "frame_num == PrevRefFrameNum (%d), not a gap", frame_num);
+ return TRUE;
+ }
+
+ if (((priv->prev_ref_frame_num + 1) % priv->max_frame_num) == frame_num) {
+ GST_TRACE_OBJECT (self,
+ "frame_num == (PrevRefFrameNum + 1) %% MaxFrameNum (%d), not a gap",
+ frame_num);
+ return TRUE;
+ }
+
+ if (gst_h264_dpb_get_size (priv->dpb) == 0) {
+ GST_TRACE_OBJECT (self, "DPB is empty, not a gap");
+ return TRUE;
+ }
+
if (!sps->gaps_in_frame_num_value_allowed_flag) {
/* This is likely the case where some frames were dropped.
* then we need to keep decoding without error out */
GST_WARNING_OBJECT (self, "Invalid frame num %d", frame_num);
}
- GST_DEBUG_OBJECT (self, "Handling frame num gap %d -> %d",
- priv->prev_ref_frame_num, frame_num);
+ GST_DEBUG_OBJECT (self, "Handling frame num gap %d -> %d (MaxFrameNum: %d)",
+ priv->prev_ref_frame_num, frame_num, priv->max_frame_num);
/* 7.4.3/7-23 */
unused_short_term_frame_num =
if (priv->current_slice.nalu.idr_pic_flag)
priv->prev_ref_frame_num = 0;
- /* 7.4.3 */
- if (frame_num != priv->prev_ref_frame_num &&
- frame_num != (priv->prev_ref_frame_num + 1) % priv->max_frame_num &&
- gst_h264_dpb_get_size (priv->dpb) > 0) {
- if (!gst_h264_decoder_handle_frame_num_gap (self, frame_num))
- return FALSE;
- }
+ if (!gst_h264_decoder_handle_frame_num_gap (self, frame_num))
+ return FALSE;
if (!gst_h264_decoder_init_current_picture (self))
return FALSE;
other = gst_h264_dpb_get_short_ref_by_pic_num (dpb, pic_num_x);
if (other) {
other->ref = FALSE;
+ GST_TRACE ("MMCO-1: unmark short-term ref picture %p, (poc %d)",
+ other, other->pic_order_cnt);
} else {
GST_WARNING ("Invalid picNumX %d for operation type 1", pic_num_x);
return FALSE;
ref_pic_marking->long_term_pic_num);
if (other) {
other->ref = FALSE;
+ GST_TRACE ("MMCO-2: unmark long-term ref picture %p, (poc %d)",
+ other, other->pic_order_cnt);
} else {
GST_WARNING ("Invalid LongTermPicNum %d for operation type 2",
ref_pic_marking->long_term_pic_num);
if (other->ref && other->long_term && other->long_term_frame_idx ==
ref_pic_marking->long_term_frame_idx) {
- GST_LOG ("Unmark old long-term ref pic %p (poc %d)",
- other, other->pic_order_cnt);
other->ref = FALSE;
other->long_term = FALSE;
+ GST_TRACE ("MMCO-3: unmark old long-term ref pic %p (poc %d)",
+ other, other->pic_order_cnt);
break;
}
}
pic_num_x = get_picNumX (picture, ref_pic_marking);
other = gst_h264_dpb_get_short_ref_by_pic_num (dpb, pic_num_x);
if (other) {
- other->long_term = TRUE;;
+ other->long_term = TRUE;
other->long_term_frame_idx = ref_pic_marking->long_term_frame_idx;
+ GST_TRACE ("MMCO-3: mark long-term ref pic %p, index %d, (poc %d)",
+ other, other->long_term_frame_idx, other->pic_order_cnt);
} else {
GST_WARNING ("Invalid picNumX %d for operation type 3", pic_num_x);
return FALSE;
max_long_term_frame_idx =
ref_pic_marking->max_long_term_frame_idx_plus1 - 1;
+ GST_TRACE ("MMCO-4: max_long_term_frame_idx %d", max_long_term_frame_idx);
+
for (i = 0; i < dpb->pic_list->len; i++) {
other = g_array_index (dpb->pic_list, GstH264Picture *, i);
other->long_term_frame_idx > max_long_term_frame_idx) {
other->ref = FALSE;
other->long_term = FALSE;
+ GST_TRACE ("MMCO-4: unmark long-term ref pic %p, index %d, (poc %d)",
+ other, other->long_term_frame_idx, other->pic_order_cnt);
}
}
break;
if (other->ref && other->long_term && other->long_term_frame_idx ==
ref_pic_marking->long_term_frame_idx) {
- GST_LOG ("Unmark old long-term ref pic %p (poc %d)",
+ GST_TRACE ("MMCO-6: unmark old long-term ref pic %p (poc %d)",
other, other->pic_order_cnt);
other->ref = FALSE;
other->long_term = FALSE;