adaptivedemux2: track: Add period number to most debug statements

Store the period number the track belongs to, and
add it in various debug statements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2650>
This commit is contained in:
Jan Schmidt 2022-06-22 03:34:19 +10:00 committed by GStreamer Marge Bot
parent e1559d26d0
commit 16a04f7697
4 changed files with 47 additions and 28 deletions

View file

@ -192,13 +192,16 @@ gst_adaptive_demux_period_transfer_selection (GstAdaptiveDemux * demux,
GstAdaptiveDemuxTrack *new_track =
gst_adaptive_demux_period_find_matching_track (next_period, track);
if (new_track) {
GST_DEBUG_OBJECT (demux, "Selecting replacement track %s",
new_track->stream_id);
GST_DEBUG_OBJECT (demux,
"Selecting replacement track %s (period %u) for track %s (period %d)",
new_track->stream_id, new_track->period_num, track->stream_id,
track->period_num);
new_track->selected = TRUE;
gst_pad_set_active (new_track->sinkpad, TRUE);
} else {
GST_WARNING_OBJECT (demux, "Could not find replacement track for %s",
track->stream_id);
GST_WARNING_OBJECT (demux,
"Could not find replacement track for %s (period %u) in period %u",
track->stream_id, track->period_num, current_period->period_num);
/* FIXME : Pick a default for that type ? Just continue as-is ? */
}
}

View file

@ -103,8 +103,9 @@ track_dequeue_item_locked (GstAdaptiveDemux * demux,
gst_queue_array_pop_head (track->queue);
GST_LOG_OBJECT (demux,
"track %s item running_time %" GST_STIME_FORMAT " end %" GST_STIME_FORMAT,
track->stream_id, GST_STIME_ARGS (out_item->runningtime),
"track %s (period %u) item running_time %" GST_STIME_FORMAT " end %"
GST_STIME_FORMAT, track->stream_id, track->period_num,
GST_STIME_ARGS (out_item->runningtime),
GST_STIME_ARGS (out_item->runningtime_end));
return TRUE;
@ -135,8 +136,8 @@ track_dequeue_data_locked (GstAdaptiveDemux * demux,
running_time_buffering = running_time = running_time_end =
GST_CLOCK_STIME_NONE;
GST_DEBUG_OBJECT (demux,
"track %s dequeued pending sticky event %" GST_PTR_FORMAT,
track->stream_id, event);
"track %s (period %u) dequeued pending sticky event %" GST_PTR_FORMAT,
track->stream_id, track->period_num, event);
is_pending_sticky = TRUE;
goto handle_event;
}
@ -212,10 +213,10 @@ track_dequeue_data_locked (GstAdaptiveDemux * demux,
duration = cstop - cstart;
GST_DEBUG_OBJECT (demux,
"track %s Starting gap for runningtime %" GST_STIME_FORMAT
"track %s (period %u) Starting gap for runningtime %" GST_STIME_FORMAT
" - clipped position %" GST_TIME_FORMAT " duration %" GST_TIME_FORMAT,
track->stream_id, GST_STIME_ARGS (running_time), GST_TIME_ARGS (pos),
GST_TIME_ARGS (duration));
track->stream_id, track->period_num, GST_STIME_ARGS (running_time),
GST_TIME_ARGS (pos), GST_TIME_ARGS (duration));
track->gap_position = pos;
track->gap_duration = duration;
@ -504,14 +505,14 @@ track_queue_data_locked (GstAdaptiveDemux * demux,
else
track->level_time = 0;
GST_LOG_OBJECT (demux,
"track %s input_time:%" GST_STIME_FORMAT " output_time:%"
GST_LOG_OBJECT (track->sinkpad,
"track %s (period %u) input_time:%" GST_STIME_FORMAT " output_time:%"
GST_STIME_FORMAT " level:%" GST_TIME_FORMAT,
track->stream_id, GST_STIME_ARGS (track->input_time),
track->stream_id, track->period_num, GST_STIME_ARGS (track->input_time),
GST_STIME_ARGS (track->output_time), GST_TIME_ARGS (track->level_time));
}
GST_LOG_OBJECT (demux,
GST_LOG_OBJECT (track->sinkpad,
"track %s item running_time :%" GST_STIME_FORMAT " end :%"
GST_STIME_FORMAT, track->stream_id, GST_STIME_ARGS (item.runningtime),
GST_STIME_ARGS (item.runningtime_end));
@ -855,6 +856,9 @@ gst_adaptive_demux_track_add_elements (GstAdaptiveDemuxTrack * track,
gchar *internal_name;
guint i, len;
/* Store the period number for debugging output */
track->period_num = period_num;
internal_name =
g_strdup_printf ("track-period%d-%s", period_num, track->stream_id);
len = strlen (internal_name);
@ -922,6 +926,7 @@ gst_adaptive_demux_track_new (GstAdaptiveDemux * demux,
track->type = type;
track->flags = flags;
track->stream_id = g_strdup (stream_id);
track->period_num = (guint) (-1);
track->generic_caps = caps;
track->stream_object = gst_stream_new (stream_id, caps, type, flags);
if (tags) {

View file

@ -1867,10 +1867,10 @@ demux_update_buffering_locked (GstAdaptiveDemux * demux)
GstAdaptiveDemuxTrack *track = (GstAdaptiveDemuxTrack *) tmp->data;
GST_LOG_OBJECT (demux,
"Checking track '%s' active:%d selected:%d eos:%d level:%"
"Checking track '%s' (period %u) active:%d selected:%d eos:%d level:%"
GST_TIME_FORMAT " buffering_threshold:%" GST_TIME_FORMAT,
track->stream_id, track->active, track->selected, track->eos,
GST_TIME_ARGS (track->level_time),
track->stream_id, track->period_num, track->active, track->selected,
track->eos, GST_TIME_ARGS (track->level_time),
GST_TIME_ARGS (track->buffering_threshold));
if (track->active && track->selected) {
@ -3342,8 +3342,9 @@ check_and_handle_selection_update_locked (GstAdaptiveDemux * demux)
if (slot->pending_track == NULL) {
slot->pending_track = gst_adaptive_demux_track_ref (track);
GST_DEBUG_OBJECT (demux,
"Track '%s' will be used on output of track '%s'",
track->stream_id, slot->track->stream_id);
"Track '%s' (period %u) will be used on output of track '%s' (period %u)",
track->stream_id, track->period_num,
slot->track->stream_id, slot->track->period_num);
}
} else {
/* 2. There is no compatible replacement slot, create a new one */
@ -3587,11 +3588,13 @@ restart:
MIN (global_output_position, track->next_position);
track->waiting_add = FALSE;
} else if (!track->eos) {
GST_DEBUG_OBJECT (demux, "Need timed data on track %s", track->stream_id);
GST_DEBUG_OBJECT (demux, "Need timed data on track %s (period %u)",
track->stream_id, track->period_num);
wait_for_data = track->waiting_add = TRUE;
} else {
GST_DEBUG_OBJECT (demux, "Track %s is EOS, not waiting for timed data",
track->stream_id);
GST_DEBUG_OBJECT (demux,
"Track %s (period %u) is EOS, not waiting for timed data",
track->stream_id, track->period_num);
}
}
@ -3645,8 +3648,9 @@ restart:
if (!mo) {
GST_DEBUG_OBJECT (demux,
"Track '%s' doesn't have any pending data (eos:%d pushed_timed_data:%d)",
track->stream_id, track->eos, slot->pushed_timed_data);
"Track '%s' (period %u) doesn't have any pending data (eos:%d pushed_timed_data:%d)",
track->stream_id, track->period_num, track->eos,
slot->pushed_timed_data);
/* This should only happen if the track is EOS, or exactly in between
* the parser outputting segment/caps before buffers. */
g_assert (track->eos || !slot->pushed_timed_data);
@ -3657,8 +3661,9 @@ restart:
demux_post_buffering_locked (demux);
TRACKS_UNLOCK (demux);
GST_DEBUG_OBJECT (demux, "Track '%s' dequeued %" GST_PTR_FORMAT,
track->stream_id, mo);
GST_DEBUG_OBJECT (demux,
"Track '%s' (period %u) dequeued %" GST_PTR_FORMAT, track->stream_id,
track->period_num, mo);
if (GST_IS_EVENT (mo)) {
GstEvent *event = (GstEvent *) mo;
@ -3686,7 +3691,8 @@ restart:
gst_flow_combiner_update_pad_flow (demux->priv->flowcombiner,
slot->pad, slot->flow_ret);
GST_DEBUG_OBJECT (slot->pad,
"track %s push returned %s (combined %s)", track->stream_id,
"track %s (period %u) push returned %s (combined %s)",
track->stream_id, track->period_num,
gst_flow_get_name (slot->flow_ret), gst_flow_get_name (ret));
slot->pushed_timed_data = TRUE;
} else {

View file

@ -159,6 +159,11 @@ struct _GstAdaptiveDemuxTrack
/* Unique identifier */
gchar *stream_id;
/* Period number this track belongs
* to (MAXINT if not assigned to a period yet)
*/
guint period_num;
/* Unique identifier of the internal stream produced
* by parsebin for the Stream this track comes from */
gchar *upstream_stream_id;