Skip to content

Commit bd629d4

Browse files
quariumcmassiot
authored andcommitted
upipe_h264f: remove warnings at startup
Use debug messages before first SPS/PPS activation for early data.
1 parent c8b2987 commit bd629d4

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

lib/upipe-framers/upipe_h264_framer.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ struct upipe_h264f {
142142
/** active picture parameter set, or -1 */
143143
int active_pps;
144144

145+
/** warn on inactive sps */
146+
bool warn_inactive_sps;
147+
/** warn on inactive pps */
148+
bool warn_inactive_pps;
149+
145150
/* parsing results - headers */
146151
/** profile */
147152
uint8_t profile;
@@ -360,6 +365,9 @@ static struct upipe *upipe_h264f_alloc(struct upipe_mgr *mgr,
360365
upipe_h264f->pps[i] = NULL;
361366
upipe_h264f->active_pps = -1;
362367

368+
upipe_h264f->warn_inactive_sps = false;
369+
upipe_h264f->warn_inactive_pps = false;
370+
363371
upipe_h264f->acquired = false;
364372
upipe_throw_ready(upipe);
365373
return upipe;
@@ -1002,6 +1010,7 @@ static bool upipe_h264f_activate_sps(struct upipe *upipe, uint32_t sps_id)
10021010
upipe_throw_fatal(upipe, err);
10031011

10041012
upipe_h264f->active_sps = sps_id;
1013+
upipe_h264f->warn_inactive_sps = true;
10051014
ubuf_block_stream_clean(s);
10061015

10071016
upipe_h264f_store_flow_def(upipe, NULL);
@@ -1054,6 +1063,7 @@ static bool upipe_h264f_activate_pps(struct upipe *upipe, uint32_t pps_id)
10541063
ubuf_block_stream_skip_bits(s, 1);
10551064

10561065
upipe_h264f->active_pps = pps_id;
1066+
upipe_h264f->warn_inactive_pps = true;
10571067
ubuf_block_stream_clean(s);
10581068
return true;
10591069
}
@@ -1223,7 +1233,10 @@ static int upipe_h264f_handle_sei_pic_timing(struct upipe *upipe,
12231233
{
12241234
struct upipe_h264f *upipe_h264f = upipe_h264f_from_upipe(upipe);
12251235
if (unlikely(upipe_h264f->active_sps == -1)) {
1226-
upipe_warn(upipe, "discarding early picture timing SEI");
1236+
if (upipe_h264f->warn_inactive_sps)
1237+
upipe_warn(upipe, "discarding picture timing SEI");
1238+
else
1239+
upipe_dbg(upipe, "discarding early picture timing SEI");
12271240
return UBASE_ERR_NONE;
12281241
}
12291242

@@ -2020,7 +2033,11 @@ static struct uref *upipe_h264f_prepare_annexb(struct upipe *upipe)
20202033
}
20212034
if (upipe_h264f->au_slice_nal == UINT8_MAX ||
20222035
upipe_h264f->active_sps == -1 || upipe_h264f->active_pps == -1) {
2023-
upipe_warn(upipe, "discarding data without SPS/PPS");
2036+
if ((upipe_h264f->active_sps == -1 && upipe_h264f->warn_inactive_sps) ||
2037+
(upipe_h264f->active_pps == -1 && upipe_h264f->warn_inactive_pps))
2038+
upipe_warn(upipe, "discarding data without SPS/PPS");
2039+
else
2040+
upipe_dbg(upipe, "discarding early data without SPS/PPS");
20242041
upipe_h264f_consume_uref_stream(upipe, upipe_h264f->au_size);
20252042
upipe_h264f->au_size = 0;
20262043
upipe_h264f->au_nal_units = 0;
@@ -2189,7 +2206,10 @@ static void upipe_h264f_end_annexb(struct upipe *upipe, struct upump **upump_p)
21892206
}
21902207

21912208
if (!ubase_check(err)) {
2192-
upipe_warn(upipe, "discarding invalid slice data");
2209+
if (upipe_h264f->warn_inactive_pps)
2210+
upipe_warn(upipe, "discarding invalid slice data");
2211+
else
2212+
upipe_dbg(upipe, "discarding early slice data");
21932213
upipe_h264f_consume_uref_stream(upipe, upipe_h264f->au_size);
21942214
upipe_h264f->au_size = 0;
21952215
return;

0 commit comments

Comments
 (0)