mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 03:46:11 +00:00
adaptivedemux2: Use track ID for debugging
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3890>
This commit is contained in:
parent
5e193730db
commit
f072b25940
3 changed files with 89 additions and 111 deletions
|
@ -173,10 +173,9 @@ gst_adaptive_demux2_stream_add_track (GstAdaptiveDemux2Stream * stream,
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (track != NULL, FALSE);
|
g_return_val_if_fail (track != NULL, FALSE);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (stream->demux, "stream:%p track:%s", stream,
|
GST_DEBUG_OBJECT (stream, "track:%s", track->stream_id);
|
||||||
track->stream_id);
|
|
||||||
if (g_list_find (stream->tracks, track)) {
|
if (g_list_find (stream->tracks, track)) {
|
||||||
GST_DEBUG_OBJECT (stream->demux,
|
GST_DEBUG_OBJECT (stream,
|
||||||
"track '%s' already handled by this stream", track->stream_id);
|
"track '%s' already handled by this stream", track->stream_id);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ GST_DEBUG_CATEGORY_EXTERN (adaptivedemux2_debug);
|
||||||
void
|
void
|
||||||
gst_adaptive_demux_track_flush (GstAdaptiveDemuxTrack * track)
|
gst_adaptive_demux_track_flush (GstAdaptiveDemuxTrack * track)
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (track->demux, "Flushing track '%s' with %u queued items",
|
GST_DEBUG_ID (track->id, "Flushing track with %u queued items",
|
||||||
track->stream_id, gst_queue_array_get_length (track->queue));
|
gst_queue_array_get_length (track->queue));
|
||||||
gst_queue_array_clear (track->queue);
|
gst_queue_array_clear (track->queue);
|
||||||
|
|
||||||
gst_event_store_flush (&track->sticky_events);
|
gst_event_store_flush (&track->sticky_events);
|
||||||
|
@ -69,15 +69,14 @@ static gboolean
|
||||||
_track_sink_query_function (GstPad * pad, GstObject * parent, GstQuery * query)
|
_track_sink_query_function (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
{
|
{
|
||||||
GstAdaptiveDemuxTrack *track = gst_pad_get_element_private (pad);
|
GstAdaptiveDemuxTrack *track = gst_pad_get_element_private (pad);
|
||||||
GstAdaptiveDemux *demux = track->demux;
|
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (pad, "query %" GST_PTR_FORMAT, query);
|
GST_DEBUG_ID (track->id, "query %" GST_PTR_FORMAT, query);
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_ACCEPT_CAPS:
|
case GST_QUERY_ACCEPT_CAPS:
|
||||||
/* Should we intersect by track caps as a safety check ? */
|
/* Should we intersect by track caps as a safety check ? */
|
||||||
GST_DEBUG_OBJECT (demux, "We accept any caps on %s:%s",
|
GST_DEBUG_ID (track->id, "We accept any caps on %s:%s",
|
||||||
GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_PAD_NAME (pad));
|
||||||
gst_query_set_accept_caps_result (query, TRUE);
|
gst_query_set_accept_caps_result (query, TRUE);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
@ -103,9 +102,9 @@ track_dequeue_item_locked (GstAdaptiveDemux * demux,
|
||||||
*out_item = *item;
|
*out_item = *item;
|
||||||
gst_queue_array_pop_head (track->queue);
|
gst_queue_array_pop_head (track->queue);
|
||||||
|
|
||||||
GST_LOG_OBJECT (demux,
|
GST_LOG_ID (track->id,
|
||||||
"track %s (period %u) item running_time %" GST_STIME_FORMAT " end %"
|
"item running_time %" GST_STIME_FORMAT " end %"
|
||||||
GST_STIME_FORMAT, track->stream_id, track->period_num,
|
GST_STIME_FORMAT,
|
||||||
GST_STIME_ARGS (out_item->runningtime),
|
GST_STIME_ARGS (out_item->runningtime),
|
||||||
GST_STIME_ARGS (out_item->runningtime_end));
|
GST_STIME_ARGS (out_item->runningtime_end));
|
||||||
|
|
||||||
|
@ -136,9 +135,8 @@ gst_adaptive_demux_track_dequeue_data_locked (GstAdaptiveDemux * demux,
|
||||||
res = (GstMiniObject *) event;
|
res = (GstMiniObject *) event;
|
||||||
running_time_buffering = running_time = running_time_end =
|
running_time_buffering = running_time = running_time_end =
|
||||||
GST_CLOCK_STIME_NONE;
|
GST_CLOCK_STIME_NONE;
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id,
|
||||||
"track %s (period %u) dequeued pending sticky event %" GST_PTR_FORMAT,
|
"dequeued pending sticky event %" GST_PTR_FORMAT, event);
|
||||||
track->stream_id, track->period_num, event);
|
|
||||||
is_pending_sticky = TRUE;
|
is_pending_sticky = TRUE;
|
||||||
goto handle_event;
|
goto handle_event;
|
||||||
}
|
}
|
||||||
|
@ -213,10 +211,10 @@ gst_adaptive_demux_track_dequeue_data_locked (GstAdaptiveDemux * demux,
|
||||||
pos = cstart;
|
pos = cstart;
|
||||||
duration = cstop - cstart;
|
duration = cstop - cstart;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id,
|
||||||
"track %s (period %u) Starting gap for runningtime %" GST_STIME_FORMAT
|
"Starting gap for runningtime %" GST_STIME_FORMAT
|
||||||
" - clipped position %" GST_TIME_FORMAT " duration %" GST_TIME_FORMAT,
|
" - clipped position %" GST_TIME_FORMAT " duration %" GST_TIME_FORMAT,
|
||||||
track->stream_id, track->period_num, GST_STIME_ARGS (running_time),
|
GST_STIME_ARGS (running_time),
|
||||||
GST_TIME_ARGS (pos), GST_TIME_ARGS (duration));
|
GST_TIME_ARGS (pos), GST_TIME_ARGS (duration));
|
||||||
|
|
||||||
track->gap_position = pos;
|
track->gap_position = pos;
|
||||||
|
@ -252,8 +250,8 @@ handle_event:
|
||||||
GstClockTimeDiff global_output_position =
|
GstClockTimeDiff global_output_position =
|
||||||
demux->priv->global_output_position;
|
demux->priv->global_output_position;
|
||||||
|
|
||||||
GST_DEBUG ("track %s: Override segment for running time %"
|
GST_DEBUG_ID (track->id, "Override segment for running time %"
|
||||||
GST_STIME_FORMAT " : %" GST_PTR_FORMAT, track->stream_id,
|
GST_STIME_FORMAT " : %" GST_PTR_FORMAT,
|
||||||
GST_STIME_ARGS (global_output_position), event);
|
GST_STIME_ARGS (global_output_position), event);
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
gst_segment_set_running_time (&track->output_segment, GST_FORMAT_TIME,
|
gst_segment_set_running_time (&track->output_segment, GST_FORMAT_TIME,
|
||||||
|
@ -278,9 +276,7 @@ handle_event:
|
||||||
/* Store any sticky event in the cache, unless this is already an event
|
/* Store any sticky event in the cache, unless this is already an event
|
||||||
* from the pending sticky_events store */
|
* from the pending sticky_events store */
|
||||||
if (!is_pending_sticky && GST_EVENT_IS_STICKY (event)) {
|
if (!is_pending_sticky && GST_EVENT_IS_STICKY (event)) {
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id, "Storing sticky event %" GST_PTR_FORMAT, event);
|
||||||
"track %s Storing sticky event %" GST_PTR_FORMAT,
|
|
||||||
track->stream_id, event);
|
|
||||||
gst_event_store_insert_event (&track->sticky_events, event, FALSE);
|
gst_event_store_insert_event (&track->sticky_events, event, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,14 +285,13 @@ handle_event:
|
||||||
if (GST_CLOCK_STIME_IS_VALID (running_time_buffering)) {
|
if (GST_CLOCK_STIME_IS_VALID (running_time_buffering)) {
|
||||||
track->output_time = running_time_buffering;
|
track->output_time = running_time_buffering;
|
||||||
|
|
||||||
GST_LOG_OBJECT (demux,
|
GST_LOG_ID (track->id,
|
||||||
"track %s buffering time:%" GST_STIME_FORMAT,
|
"buffering time:%" GST_STIME_FORMAT,
|
||||||
track->stream_id, GST_STIME_ARGS (running_time_buffering));
|
GST_STIME_ARGS (running_time_buffering));
|
||||||
|
|
||||||
gst_adaptive_demux_track_update_level_locked (track);
|
gst_adaptive_demux_track_update_level_locked (track);
|
||||||
} else {
|
} else {
|
||||||
GST_LOG_OBJECT (demux, "track %s popping untimed item %" GST_PTR_FORMAT,
|
GST_LOG_ID (track->id, "popping untimed item %" GST_PTR_FORMAT, res);
|
||||||
track->stream_id, res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
track->level_bytes -= item_size;
|
track->level_bytes -= item_size;
|
||||||
|
@ -310,9 +305,9 @@ gst_adaptive_demux_track_drain_to (GstAdaptiveDemuxTrack * track,
|
||||||
{
|
{
|
||||||
GstAdaptiveDemux *demux = track->demux;
|
GstAdaptiveDemux *demux = track->demux;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id,
|
||||||
"Track '%s' draining to running time %" GST_STIME_FORMAT,
|
"draining to running time %" GST_STIME_FORMAT,
|
||||||
track->stream_id, GST_STIME_ARGS (drain_running_time));
|
GST_STIME_ARGS (drain_running_time));
|
||||||
|
|
||||||
while (track->next_position == GST_CLOCK_STIME_NONE ||
|
while (track->next_position == GST_CLOCK_STIME_NONE ||
|
||||||
track->next_position < drain_running_time) {
|
track->next_position < drain_running_time) {
|
||||||
|
@ -334,9 +329,9 @@ gst_adaptive_demux_track_drain_to (GstAdaptiveDemuxTrack * track,
|
||||||
my_segment_to_running_time (&track->output_segment, gap_end);
|
my_segment_to_running_time (&track->output_segment, gap_end);
|
||||||
|
|
||||||
if (running_time_end >= drain_running_time) {
|
if (running_time_end >= drain_running_time) {
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id,
|
||||||
"Track '%s' drained to GAP with running time %" GST_STIME_FORMAT,
|
"drained to GAP with running time %" GST_STIME_FORMAT,
|
||||||
track->stream_id, GST_STIME_ARGS (running_time_end));
|
GST_STIME_ARGS (running_time_end));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,8 +343,7 @@ gst_adaptive_demux_track_drain_to (GstAdaptiveDemuxTrack * track,
|
||||||
item = gst_queue_array_peek_head_struct (track->queue);
|
item = gst_queue_array_peek_head_struct (track->queue);
|
||||||
/* track is empty, we're done */
|
/* track is empty, we're done */
|
||||||
if (item == NULL) {
|
if (item == NULL) {
|
||||||
GST_DEBUG_OBJECT (demux, "Track '%s' completely drained",
|
GST_DEBUG_ID (track->id, "Track completely drained");
|
||||||
track->stream_id);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,15 +351,15 @@ gst_adaptive_demux_track_drain_to (GstAdaptiveDemuxTrack * track,
|
||||||
* we're done. */
|
* we're done. */
|
||||||
if (item->runningtime != GST_CLOCK_STIME_NONE
|
if (item->runningtime != GST_CLOCK_STIME_NONE
|
||||||
&& item->runningtime >= drain_running_time) {
|
&& item->runningtime >= drain_running_time) {
|
||||||
GST_DEBUG_OBJECT (demux, "Track '%s' drained to item %" GST_PTR_FORMAT
|
GST_DEBUG_ID (track->id, "Track drained to item %" GST_PTR_FORMAT
|
||||||
" with running time %" GST_STIME_FORMAT,
|
" with running time %" GST_STIME_FORMAT,
|
||||||
track->stream_id, item->item, GST_STIME_ARGS (item->runningtime));
|
item->item, GST_STIME_ARGS (item->runningtime));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, "Track '%s' discarding %" GST_PTR_FORMAT
|
GST_DEBUG_ID (track->id, "discarding %" GST_PTR_FORMAT
|
||||||
" with running time %" GST_STIME_FORMAT,
|
" with running time %" GST_STIME_FORMAT,
|
||||||
track->stream_id, item->item, GST_STIME_ARGS (item->runningtime));
|
item->item, GST_STIME_ARGS (item->runningtime));
|
||||||
|
|
||||||
/* Dequeue the item and discard. Sticky events
|
/* Dequeue the item and discard. Sticky events
|
||||||
* will be collected by the dequeue function, gaps will be started.
|
* will be collected by the dequeue function, gaps will be started.
|
||||||
|
@ -380,8 +374,8 @@ gst_adaptive_demux_track_drain_to (GstAdaptiveDemuxTrack * track,
|
||||||
gst_adaptive_demux_track_update_next_position (track);
|
gst_adaptive_demux_track_update_next_position (track);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id,
|
||||||
"Track '%s' drained to running time %" GST_STIME_FORMAT, track->stream_id,
|
"drained to running time %" GST_STIME_FORMAT,
|
||||||
GST_STIME_ARGS (track->next_position));
|
GST_STIME_ARGS (track->next_position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,18 +469,17 @@ track_queue_data_locked (GstAdaptiveDemux * demux,
|
||||||
* so buffering level is updated correctly */
|
* so buffering level is updated correctly */
|
||||||
if (!GST_CLOCK_STIME_IS_VALID (track->output_time)) {
|
if (!GST_CLOCK_STIME_IS_VALID (track->output_time)) {
|
||||||
track->output_time = track->lowest_input_time;
|
track->output_time = track->lowest_input_time;
|
||||||
GST_LOG_OBJECT (track->sinkpad,
|
GST_LOG_ID (track->id,
|
||||||
"track %s (period %u) set output_time = lowest input_time = %"
|
"setting output_time = lowest input_time = %"
|
||||||
GST_STIME_FORMAT, track->stream_id, track->period_num,
|
GST_STIME_FORMAT, GST_STIME_ARGS (track->output_time));
|
||||||
GST_STIME_ARGS (track->output_time));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_adaptive_demux_track_update_level_locked (track);
|
gst_adaptive_demux_track_update_level_locked (track);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (track->sinkpad,
|
GST_LOG_ID (track->id,
|
||||||
"track %s item running_time :%" GST_STIME_FORMAT " end :%"
|
"item running_time :%" GST_STIME_FORMAT " end :%"
|
||||||
GST_STIME_FORMAT, track->stream_id, GST_STIME_ARGS (item.runningtime),
|
GST_STIME_FORMAT, GST_STIME_ARGS (item.runningtime),
|
||||||
GST_STIME_ARGS (item.runningtime_end));
|
GST_STIME_ARGS (item.runningtime_end));
|
||||||
|
|
||||||
track->level_bytes += size;
|
track->level_bytes += size;
|
||||||
|
@ -507,7 +500,7 @@ _track_sink_chain_function (GstPad * pad, GstObject * parent,
|
||||||
GstAdaptiveDemux *demux = track->demux;
|
GstAdaptiveDemux *demux = track->demux;
|
||||||
GstClockTime ts;
|
GstClockTime ts;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (pad, "buffer %" GST_PTR_FORMAT, buffer);
|
GST_DEBUG_ID (track->id, "buffer %" GST_PTR_FORMAT, buffer);
|
||||||
|
|
||||||
TRACKS_LOCK (demux);
|
TRACKS_LOCK (demux);
|
||||||
|
|
||||||
|
@ -531,12 +524,12 @@ _track_sink_chain_function (GstPad * pad, GstObject * parent,
|
||||||
*/
|
*/
|
||||||
if (!GST_CLOCK_TIME_IS_VALID (ts)) {
|
if (!GST_CLOCK_TIME_IS_VALID (ts)) {
|
||||||
if (GST_CLOCK_TIME_IS_VALID (track->input_segment.position)) {
|
if (GST_CLOCK_TIME_IS_VALID (track->input_segment.position)) {
|
||||||
GST_WARNING_OBJECT (pad,
|
GST_WARNING_ID (track->id,
|
||||||
"buffer doesn't have any pts or dts, using segment position (%"
|
"buffer doesn't have any pts or dts, using segment position (%"
|
||||||
GST_TIME_FORMAT ")", GST_TIME_ARGS (track->input_segment.position));
|
GST_TIME_FORMAT ")", GST_TIME_ARGS (track->input_segment.position));
|
||||||
ts = track->input_segment.position;
|
ts = track->input_segment.position;
|
||||||
} else {
|
} else {
|
||||||
GST_ERROR_OBJECT (pad, "initial buffer doesn't have any pts or dts !");
|
GST_ERROR_ID (track->id, "initial buffer doesn't have any pts or dts !");
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
TRACKS_UNLOCK (demux);
|
TRACKS_UNLOCK (demux);
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
@ -550,7 +543,7 @@ _track_sink_chain_function (GstPad * pad, GstObject * parent,
|
||||||
GstClockTime duration = ts - track->input_segment.position;
|
GstClockTime duration = ts - track->input_segment.position;
|
||||||
GstEvent *gap = gst_event_new_gap (track->input_segment.position, duration);
|
GstEvent *gap = gst_event_new_gap (track->input_segment.position, duration);
|
||||||
/* Insert gap event to ensure coherent interleave */
|
/* Insert gap event to ensure coherent interleave */
|
||||||
GST_DEBUG_OBJECT (pad,
|
GST_DEBUG_ID (track->id,
|
||||||
"Inserting gap for %" GST_TIME_FORMAT " vs %" GST_TIME_FORMAT,
|
"Inserting gap for %" GST_TIME_FORMAT " vs %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (ts), GST_TIME_ARGS (track->input_segment.position));
|
GST_TIME_ARGS (ts), GST_TIME_ARGS (track->input_segment.position));
|
||||||
track_queue_data_locked (demux, track, (GstMiniObject *) gap, 0,
|
track_queue_data_locked (demux, track, (GstMiniObject *) gap, 0,
|
||||||
|
@ -580,7 +573,7 @@ _track_sink_event_function (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
gboolean drop = FALSE;
|
gboolean drop = FALSE;
|
||||||
gboolean is_discont = FALSE;
|
gboolean is_discont = FALSE;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (pad, "event %" GST_PTR_FORMAT, event);
|
GST_DEBUG_ID (track->id, "event %" GST_PTR_FORMAT, event);
|
||||||
|
|
||||||
TRACKS_LOCK (demux);
|
TRACKS_LOCK (demux);
|
||||||
|
|
||||||
|
@ -588,13 +581,13 @@ _track_sink_event_function (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
case GST_EVENT_STREAM_COLLECTION:
|
case GST_EVENT_STREAM_COLLECTION:
|
||||||
{
|
{
|
||||||
/* Replace upstream collection with demux collection */
|
/* Replace upstream collection with demux collection */
|
||||||
GST_DEBUG_OBJECT (pad, "Dropping stream-collection, we send our own");
|
GST_DEBUG_ID (track->id, "Dropping stream-collection, we send our own");
|
||||||
drop = TRUE;
|
drop = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_EVENT_STREAM_START:
|
case GST_EVENT_STREAM_START:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (pad, "Dropping stream-start, we send our own");
|
GST_DEBUG_ID (track->id, "Dropping stream-start, we send our own");
|
||||||
if (track->eos) {
|
if (track->eos) {
|
||||||
gint i, len;
|
gint i, len;
|
||||||
/* Find and drop latest EOS if present */
|
/* Find and drop latest EOS if present */
|
||||||
|
@ -605,8 +598,8 @@ _track_sink_event_function (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
if (GST_IS_EVENT (item->item)
|
if (GST_IS_EVENT (item->item)
|
||||||
&& GST_EVENT_TYPE (item->item) == GST_EVENT_EOS) {
|
&& GST_EVENT_TYPE (item->item) == GST_EVENT_EOS) {
|
||||||
TrackQueueItem sub;
|
TrackQueueItem sub;
|
||||||
GST_DEBUG_OBJECT (pad, "Removing previously received EOS (pos:%d)",
|
GST_DEBUG_ID (track->id,
|
||||||
i);
|
"Removing previously received EOS (pos:%d)", i);
|
||||||
if (gst_queue_array_drop_struct (track->queue, i, &sub))
|
if (gst_queue_array_drop_struct (track->queue, i, &sub))
|
||||||
gst_mini_object_unref (sub.item);
|
gst_mini_object_unref (sub.item);
|
||||||
break;
|
break;
|
||||||
|
@ -620,7 +613,7 @@ _track_sink_event_function (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
{
|
{
|
||||||
if (track->pending_srcpad != NULL) {
|
if (track->pending_srcpad != NULL) {
|
||||||
GST_DEBUG_OBJECT (pad,
|
GST_DEBUG_ID (track->id,
|
||||||
"Dropping EOS because we have a pending pad switch");
|
"Dropping EOS because we have a pending pad switch");
|
||||||
drop = TRUE;
|
drop = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -640,7 +633,7 @@ _track_sink_event_function (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drop || !GST_EVENT_IS_SERIALIZED (event)) {
|
if (drop || !GST_EVENT_IS_SERIALIZED (event)) {
|
||||||
GST_DEBUG_OBJECT (pad, "dropping event %s", GST_EVENT_TYPE_NAME (event));
|
GST_DEBUG_ID (track->id, "dropping event %s", GST_EVENT_TYPE_NAME (event));
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
TRACKS_UNLOCK (demux);
|
TRACKS_UNLOCK (demux);
|
||||||
/* Silently "accept" them */
|
/* Silently "accept" them */
|
||||||
|
@ -653,7 +646,7 @@ _track_sink_event_function (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
guint64 seg_seqnum = gst_event_get_seqnum (event);
|
guint64 seg_seqnum = gst_event_get_seqnum (event);
|
||||||
|
|
||||||
if (track->input_segment_seqnum == seg_seqnum) {
|
if (track->input_segment_seqnum == seg_seqnum) {
|
||||||
GST_DEBUG_OBJECT (pad, "Ignoring duplicate segment");
|
GST_DEBUG_ID (track->id, "Ignoring duplicate segment");
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
TRACKS_UNLOCK (demux);
|
TRACKS_UNLOCK (demux);
|
||||||
|
|
||||||
|
@ -666,8 +659,8 @@ _track_sink_event_function (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
track->input_segment.position = track->input_segment.start;
|
track->input_segment.position = track->input_segment.start;
|
||||||
else
|
else
|
||||||
track->input_segment.position = track->input_segment.stop;
|
track->input_segment.position = track->input_segment.stop;
|
||||||
GST_DEBUG_OBJECT (pad, "track %s stored segment %" GST_SEGMENT_FORMAT,
|
GST_DEBUG_ID (track->id, "stored segment %" GST_SEGMENT_FORMAT,
|
||||||
track->stream_id, &track->input_segment);
|
&track->input_segment);
|
||||||
timestamp = track->input_segment.position;
|
timestamp = track->input_segment.position;
|
||||||
is_discont = TRUE;
|
is_discont = TRUE;
|
||||||
|
|
||||||
|
@ -678,7 +671,7 @@ _track_sink_event_function (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
gst_event_parse_gap (event, ×tamp, &duration);
|
gst_event_parse_gap (event, ×tamp, &duration);
|
||||||
|
|
||||||
if (!GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
if (!GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
||||||
GST_DEBUG_OBJECT (pad, "Dropping gap event with invalid timestamp");
|
GST_DEBUG_ID (track->id, "Dropping gap event with invalid timestamp");
|
||||||
goto drop_ok;
|
goto drop_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,8 +740,8 @@ gst_adaptive_demux_track_update_next_position (GstAdaptiveDemuxTrack * track)
|
||||||
TrackQueueItem *item = gst_queue_array_peek_nth_struct (track->queue, i);
|
TrackQueueItem *item = gst_queue_array_peek_nth_struct (track->queue, i);
|
||||||
|
|
||||||
if (item->runningtime != GST_CLOCK_STIME_NONE) {
|
if (item->runningtime != GST_CLOCK_STIME_NONE) {
|
||||||
GST_DEBUG_OBJECT (track->demux,
|
GST_DEBUG_ID (track->id,
|
||||||
"Track '%s' next position %" GST_STIME_FORMAT, track->stream_id,
|
"next position %" GST_STIME_FORMAT,
|
||||||
GST_STIME_ARGS (item->runningtime));
|
GST_STIME_ARGS (item->runningtime));
|
||||||
track->next_position = item->runningtime;
|
track->next_position = item->runningtime;
|
||||||
return;
|
return;
|
||||||
|
@ -756,8 +749,7 @@ gst_adaptive_demux_track_update_next_position (GstAdaptiveDemuxTrack * track)
|
||||||
}
|
}
|
||||||
track->next_position = GST_CLOCK_STIME_NONE;
|
track->next_position = GST_CLOCK_STIME_NONE;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (track->demux,
|
GST_DEBUG_ID (track->id, "Track doesn't have any pending timed data");
|
||||||
"Track '%s' doesn't have any pending timed data", track->stream_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TRACKS_LOCK held. Recomputes the level_time for the track */
|
/* TRACKS_LOCK held. Recomputes the level_time for the track */
|
||||||
|
@ -777,10 +769,10 @@ gst_adaptive_demux_track_update_level_locked (GstAdaptiveDemuxTrack * track)
|
||||||
else
|
else
|
||||||
track->level_time = 0;
|
track->level_time = 0;
|
||||||
|
|
||||||
GST_LOG_OBJECT (track->sinkpad,
|
GST_LOG_ID (track->id,
|
||||||
"track %s (period %u) input_time:%" GST_STIME_FORMAT " output_time:%"
|
"input_time:%" GST_STIME_FORMAT " output_time:%"
|
||||||
GST_STIME_FORMAT " level:%" GST_TIME_FORMAT,
|
GST_STIME_FORMAT " level:%" GST_TIME_FORMAT,
|
||||||
track->stream_id, track->period_num, GST_STIME_ARGS (track->input_time),
|
GST_STIME_ARGS (track->input_time),
|
||||||
GST_STIME_ARGS (track->output_time), GST_TIME_ARGS (track->level_time));
|
GST_STIME_ARGS (track->output_time), GST_TIME_ARGS (track->level_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,7 +809,7 @@ GstAdaptiveDemuxTrack *
|
||||||
gst_adaptive_demux_track_ref (GstAdaptiveDemuxTrack * track)
|
gst_adaptive_demux_track_ref (GstAdaptiveDemuxTrack * track)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (track != NULL, NULL);
|
g_return_val_if_fail (track != NULL, NULL);
|
||||||
GST_TRACE ("%p %d -> %d", track, track->ref_count, track->ref_count + 1);
|
GST_TRACE_ID (track->id, "%d -> %d", track->ref_count, track->ref_count + 1);
|
||||||
g_atomic_int_inc (&track->ref_count);
|
g_atomic_int_inc (&track->ref_count);
|
||||||
|
|
||||||
return track;
|
return track;
|
||||||
|
@ -828,7 +820,7 @@ gst_adaptive_demux_track_unref (GstAdaptiveDemuxTrack * track)
|
||||||
{
|
{
|
||||||
g_return_if_fail (track != NULL);
|
g_return_if_fail (track != NULL);
|
||||||
|
|
||||||
GST_TRACE ("%p %d -> %d", track, track->ref_count, track->ref_count - 1);
|
GST_TRACE_ID (track->id, "%d -> %d", track->ref_count, track->ref_count - 1);
|
||||||
if (g_atomic_int_dec_and_test (&track->ref_count)) {
|
if (g_atomic_int_dec_and_test (&track->ref_count)) {
|
||||||
_demux_track_free (track);
|
_demux_track_free (track);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1789,10 +1789,10 @@ demux_update_buffering_locked (GstAdaptiveDemux * demux)
|
||||||
for (tmp = demux->output_period->tracks; tmp; tmp = tmp->next) {
|
for (tmp = demux->output_period->tracks; tmp; tmp = tmp->next) {
|
||||||
GstAdaptiveDemuxTrack *track = (GstAdaptiveDemuxTrack *) tmp->data;
|
GstAdaptiveDemuxTrack *track = (GstAdaptiveDemuxTrack *) tmp->data;
|
||||||
|
|
||||||
GST_LOG_OBJECT (demux,
|
GST_LOG_ID (track->id,
|
||||||
"Checking track '%s' (period %u) active:%d selected:%d eos:%d level:%"
|
"Checking track active:%d selected:%d eos:%d level:%"
|
||||||
GST_TIME_FORMAT " buffering_threshold:%" GST_TIME_FORMAT,
|
GST_TIME_FORMAT " buffering_threshold:%" GST_TIME_FORMAT,
|
||||||
track->stream_id, track->period_num, track->active, track->selected,
|
track->active, track->selected,
|
||||||
track->eos, GST_TIME_ARGS (track->level_time),
|
track->eos, GST_TIME_ARGS (track->level_time),
|
||||||
GST_TIME_ARGS (track->buffering_threshold));
|
GST_TIME_ARGS (track->buffering_threshold));
|
||||||
|
|
||||||
|
@ -1957,7 +1957,7 @@ gst_adaptive_demux_seek_to_input_period (GstAdaptiveDemux * demux)
|
||||||
if (slot->pending_track != NULL) {
|
if (slot->pending_track != NULL) {
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Removing track '%s' as pending from output of current track '%s'",
|
"Removing track '%s' as pending from output of current track '%s'",
|
||||||
slot->pending_track->stream_id, slot->track->stream_id);
|
slot->pending_track->id, slot->track->id);
|
||||||
gst_adaptive_demux_track_unref (slot->pending_track);
|
gst_adaptive_demux_track_unref (slot->pending_track);
|
||||||
slot->pending_track = NULL;
|
slot->pending_track = NULL;
|
||||||
}
|
}
|
||||||
|
@ -3147,7 +3147,7 @@ check_and_handle_selection_update_locked (GstAdaptiveDemux * demux)
|
||||||
if (slot->pending_track != NULL && !slot->pending_track->selected) {
|
if (slot->pending_track != NULL && !slot->pending_track->selected) {
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Removing deselected track '%s' as pending from output of current track '%s'",
|
"Removing deselected track '%s' as pending from output of current track '%s'",
|
||||||
slot->pending_track->stream_id, slot->track->stream_id);
|
slot->pending_track->id, slot->track->id);
|
||||||
gst_adaptive_demux_track_unref (slot->pending_track);
|
gst_adaptive_demux_track_unref (slot->pending_track);
|
||||||
slot->pending_track = NULL;
|
slot->pending_track = NULL;
|
||||||
}
|
}
|
||||||
|
@ -3163,7 +3163,7 @@ check_and_handle_selection_update_locked (GstAdaptiveDemux * demux)
|
||||||
/* 0. Track is selected and has a slot. Nothing to do */
|
/* 0. Track is selected and has a slot. Nothing to do */
|
||||||
if (slot) {
|
if (slot) {
|
||||||
GST_DEBUG_OBJECT (demux, "Track '%s' is already being outputted",
|
GST_DEBUG_OBJECT (demux, "Track '%s' is already being outputted",
|
||||||
track->stream_id);
|
track->id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3174,16 +3174,14 @@ check_and_handle_selection_update_locked (GstAdaptiveDemux * demux)
|
||||||
g_assert (slot->pending_track == NULL || slot->pending_track == track);
|
g_assert (slot->pending_track == NULL || slot->pending_track == track);
|
||||||
if (slot->pending_track == NULL) {
|
if (slot->pending_track == NULL) {
|
||||||
slot->pending_track = gst_adaptive_demux_track_ref (track);
|
slot->pending_track = gst_adaptive_demux_track_ref (track);
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id,
|
||||||
"Track '%s' (period %u) will be used on output of track '%s' (period %u)",
|
"Track will be used on output of track '%s' (period %u)",
|
||||||
track->stream_id, track->period_num,
|
slot->track->id, slot->track->period_num);
|
||||||
slot->track->stream_id, slot->track->period_num);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* 2. There is no compatible replacement slot, create a new one */
|
/* 2. There is no compatible replacement slot, create a new one */
|
||||||
slot = gst_adaptive_demux_output_slot_new (demux, track->type);
|
slot = gst_adaptive_demux_output_slot_new (demux, track->type);
|
||||||
GST_DEBUG_OBJECT (demux, "Created slot for track '%s'",
|
GST_DEBUG_OBJECT (demux, "Created slot for track '%s'", track->id);
|
||||||
track->stream_id);
|
|
||||||
demux->priv->outputs = g_list_append (demux->priv->outputs, slot);
|
demux->priv->outputs = g_list_append (demux->priv->outputs, slot);
|
||||||
|
|
||||||
track->update_next_segment = TRUE;
|
track->update_next_segment = TRUE;
|
||||||
|
@ -3207,7 +3205,7 @@ check_and_handle_selection_update_locked (GstAdaptiveDemux * demux)
|
||||||
GstAdaptiveDemux2Stream *stream;
|
GstAdaptiveDemux2Stream *stream;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, "Output for track '%s' is no longer used",
|
GST_DEBUG_OBJECT (demux, "Output for track '%s' is no longer used",
|
||||||
slot->track->stream_id);
|
slot->track->id);
|
||||||
slot->track->active = FALSE;
|
slot->track->active = FALSE;
|
||||||
|
|
||||||
/* If the stream feeding this track is stopped, flush and clear
|
/* If the stream feeding this track is stopped, flush and clear
|
||||||
|
@ -3303,7 +3301,7 @@ handle_slot_pending_track_switch_locked (GstAdaptiveDemux * demux,
|
||||||
if (!pending_is_ready && gst_queue_array_get_length (track->queue) > 0) {
|
if (!pending_is_ready && gst_queue_array_get_length (track->queue) > 0) {
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Replacement track '%s' doesn't have enough data for switching yet",
|
"Replacement track '%s' doesn't have enough data for switching yet",
|
||||||
slot->pending_track->stream_id);
|
slot->pending_track->id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3416,9 +3414,8 @@ restart:
|
||||||
gst_adaptive_demux_track_update_next_position (track);
|
gst_adaptive_demux_track_update_next_position (track);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_TRACE_OBJECT (demux,
|
GST_TRACE_ID (track->id,
|
||||||
"Looking at track %s (period %u). next_position %" GST_STIME_FORMAT,
|
"Looking at track, next_position %" GST_STIME_FORMAT,
|
||||||
track->stream_id, track->period_num,
|
|
||||||
GST_STIME_ARGS (track->next_position));
|
GST_STIME_ARGS (track->next_position));
|
||||||
|
|
||||||
if (track->next_position != GST_CLOCK_STIME_NONE) {
|
if (track->next_position != GST_CLOCK_STIME_NONE) {
|
||||||
|
@ -3430,14 +3427,11 @@ restart:
|
||||||
track->waiting_add = FALSE;
|
track->waiting_add = FALSE;
|
||||||
all_tracks_empty = FALSE;
|
all_tracks_empty = FALSE;
|
||||||
} else if (!track->eos) {
|
} else if (!track->eos) {
|
||||||
GST_DEBUG_OBJECT (demux, "Need timed data on track %s (period %u)",
|
GST_DEBUG_ID (track->id, "Need timed data");
|
||||||
track->stream_id, track->period_num);
|
|
||||||
all_tracks_empty = FALSE;
|
all_tracks_empty = FALSE;
|
||||||
wait_for_data = track->waiting_add = TRUE;
|
wait_for_data = track->waiting_add = TRUE;
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id, "Track is EOS, not waiting for timed data");
|
||||||
"Track %s (period %u) is EOS, not waiting for timed data",
|
|
||||||
track->stream_id, track->period_num);
|
|
||||||
|
|
||||||
if (gst_queue_array_get_length (track->queue) > 0) {
|
if (gst_queue_array_get_length (track->queue) > 0) {
|
||||||
all_tracks_empty = FALSE;
|
all_tracks_empty = FALSE;
|
||||||
|
@ -3497,10 +3491,9 @@ restart:
|
||||||
gst_adaptive_demux_track_dequeue_data_locked (demux, track, TRUE);
|
gst_adaptive_demux_track_dequeue_data_locked (demux, track, TRUE);
|
||||||
|
|
||||||
if (!mo) {
|
if (!mo) {
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id,
|
||||||
"Track '%s' (period %u) doesn't have any pending data (eos:%d pushed_timed_data:%d)",
|
"Track doesn't have any pending data (eos:%d pushed_timed_data:%d)",
|
||||||
track->stream_id, track->period_num, track->eos,
|
track->eos, slot->pushed_timed_data);
|
||||||
slot->pushed_timed_data);
|
|
||||||
/* This should only happen if the track is EOS, or exactly in between
|
/* This should only happen if the track is EOS, or exactly in between
|
||||||
* the parser outputting segment/caps before buffers. */
|
* the parser outputting segment/caps before buffers. */
|
||||||
g_assert (track->eos || !slot->pushed_timed_data);
|
g_assert (track->eos || !slot->pushed_timed_data);
|
||||||
|
@ -3508,9 +3501,8 @@ restart:
|
||||||
/* If we drained the track, but there's a pending track on the slot
|
/* If we drained the track, but there's a pending track on the slot
|
||||||
* loop again to activate it */
|
* loop again to activate it */
|
||||||
if (slot->pending_track) {
|
if (slot->pending_track) {
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id,
|
||||||
"Track '%s' (period %u) drained, but has a pending track to activate",
|
"Track drained, but has a pending track to activate");
|
||||||
track->stream_id, track->period_num);
|
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3520,9 +3512,7 @@ restart:
|
||||||
demux_post_buffering_locked (demux);
|
demux_post_buffering_locked (demux);
|
||||||
TRACKS_UNLOCK (demux);
|
TRACKS_UNLOCK (demux);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_ID (track->id, "Track dequeued %" GST_PTR_FORMAT, mo);
|
||||||
"Track '%s' (period %u) dequeued %" GST_PTR_FORMAT, track->stream_id,
|
|
||||||
track->period_num, mo);
|
|
||||||
|
|
||||||
if (GST_IS_EVENT (mo)) {
|
if (GST_IS_EVENT (mo)) {
|
||||||
GstEvent *event = (GstEvent *) mo;
|
GstEvent *event = (GstEvent *) mo;
|
||||||
|
@ -3531,9 +3521,7 @@ restart:
|
||||||
} else if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
} else if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
||||||
/* If there is a pending next period, don't send the EOS */
|
/* If there is a pending next period, don't send the EOS */
|
||||||
if (demux->output_period->has_next_period) {
|
if (demux->output_period->has_next_period) {
|
||||||
GST_LOG_OBJECT (demux,
|
GST_LOG_OBJECT (track->id, "Dropping EOS before next period");
|
||||||
"Dropping EOS on track '%s' (period %u) before next period",
|
|
||||||
track->stream_id, track->period_num);
|
|
||||||
gst_event_store_mark_delivered (&track->sticky_events, event);
|
gst_event_store_mark_delivered (&track->sticky_events, event);
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
event = NULL;
|
event = NULL;
|
||||||
|
@ -3556,8 +3544,7 @@ restart:
|
||||||
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) {
|
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) {
|
||||||
buffer = gst_buffer_make_writable (buffer);
|
buffer = gst_buffer_make_writable (buffer);
|
||||||
GST_DEBUG_OBJECT (slot->pad,
|
GST_DEBUG_OBJECT (slot->pad,
|
||||||
"track %s marking discont %" GST_PTR_FORMAT, track->stream_id,
|
"track %s marking discont %" GST_PTR_FORMAT, track->id, buffer);
|
||||||
buffer);
|
|
||||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||||
}
|
}
|
||||||
track->output_discont = FALSE;
|
track->output_discont = FALSE;
|
||||||
|
@ -3567,8 +3554,8 @@ restart:
|
||||||
gst_flow_combiner_update_pad_flow (demux->priv->flowcombiner,
|
gst_flow_combiner_update_pad_flow (demux->priv->flowcombiner,
|
||||||
slot->pad, slot->flow_ret);
|
slot->pad, slot->flow_ret);
|
||||||
GST_DEBUG_OBJECT (slot->pad,
|
GST_DEBUG_OBJECT (slot->pad,
|
||||||
"track %s (period %u) push returned %s (combined %s)",
|
"track %s push returned %s (combined %s)",
|
||||||
track->stream_id, track->period_num,
|
track->id,
|
||||||
gst_flow_get_name (slot->flow_ret), gst_flow_get_name (ret));
|
gst_flow_get_name (slot->flow_ret), gst_flow_get_name (ret));
|
||||||
slot->pushed_timed_data = TRUE;
|
slot->pushed_timed_data = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue