mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
dashdemux: detect end-of-period correctly
Detect end of period when there are no more buffers on any of the streams
This commit is contained in:
parent
3a055ac2d1
commit
a19c689dfa
1 changed files with 17 additions and 6 deletions
|
@ -1126,7 +1126,9 @@ gst_dash_demux_stream_loop (GstDashDemux * demux)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
buffer = GST_BUFFER_CAST (item->object);
|
buffer = GST_BUFFER_CAST (item->object);
|
||||||
active_stream = gst_mpdparser_get_active_stream_by_index (demux->client, i);
|
active_stream =
|
||||||
|
gst_mpdparser_get_active_stream_by_index (demux->client,
|
||||||
|
selected_stream->index);
|
||||||
if (demux->need_segment) {
|
if (demux->need_segment) {
|
||||||
GstClockTime start =
|
GstClockTime start =
|
||||||
GST_BUFFER_TIMESTAMP (buffer) + demux->position_shift;
|
GST_BUFFER_TIMESTAMP (buffer) + demux->position_shift;
|
||||||
|
@ -1145,8 +1147,8 @@ gst_dash_demux_stream_loop (GstDashDemux * demux)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Pushing fragment %p #%d (stream %i) ts:%" GST_TIME_FORMAT " dur:%"
|
"Pushing fragment %p #%d (stream %i) ts:%" GST_TIME_FORMAT " dur:%"
|
||||||
GST_TIME_FORMAT, buffer, GST_BUFFER_OFFSET (buffer), i,
|
GST_TIME_FORMAT, buffer, GST_BUFFER_OFFSET (buffer),
|
||||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
|
selected_stream->index, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
|
||||||
GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)));
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)));
|
||||||
ret = gst_pad_push (selected_stream->pad, gst_buffer_ref (buffer));
|
ret = gst_pad_push (selected_stream->pad, gst_buffer_ref (buffer));
|
||||||
item->destroy (item);
|
item->destroy (item);
|
||||||
|
@ -1734,6 +1736,7 @@ gst_dash_demux_get_next_fragment_set (GstDashDemux * demux)
|
||||||
guint64 size_buffer = 0;
|
guint64 size_buffer = 0;
|
||||||
gboolean need_header;
|
gboolean need_header;
|
||||||
GSList *iter;
|
GSList *iter;
|
||||||
|
gboolean end_of_period = TRUE;
|
||||||
|
|
||||||
g_get_current_time (&start);
|
g_get_current_time (&start);
|
||||||
/* Figure out if we will need to switch pads, thus requiring a new
|
/* Figure out if we will need to switch pads, thus requiring a new
|
||||||
|
@ -1749,9 +1752,10 @@ gst_dash_demux_get_next_fragment_set (GstDashDemux * demux)
|
||||||
|
|
||||||
if (!gst_mpd_client_get_next_fragment (demux->client,
|
if (!gst_mpd_client_get_next_fragment (demux->client,
|
||||||
stream_idx, &discont, &next_fragment_uri, &duration, ×tamp)) {
|
stream_idx, &discont, &next_fragment_uri, &duration, ×tamp)) {
|
||||||
GST_INFO_OBJECT (demux, "This Period doesn't contain more fragments");
|
GST_INFO_OBJECT (demux,
|
||||||
demux->end_of_period = TRUE;
|
"This Period doesn't contain more fragments for stream %u",
|
||||||
return FALSE;
|
stream_idx);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_INFO_OBJECT (demux, "Next fragment for stream #%i", stream_idx);
|
GST_INFO_OBJECT (demux, "Next fragment for stream #%i", stream_idx);
|
||||||
|
@ -1760,6 +1764,9 @@ gst_dash_demux_get_next_fragment_set (GstDashDemux * demux)
|
||||||
GST_TIME_FORMAT, next_fragment_uri, GST_TIME_ARGS (timestamp),
|
GST_TIME_FORMAT, next_fragment_uri, GST_TIME_ARGS (timestamp),
|
||||||
GST_TIME_ARGS (duration));
|
GST_TIME_ARGS (duration));
|
||||||
|
|
||||||
|
/* got a fragment to fetch, no end of period */
|
||||||
|
end_of_period = FALSE;
|
||||||
|
|
||||||
download = gst_uri_downloader_fetch_uri (demux->downloader,
|
download = gst_uri_downloader_fetch_uri (demux->downloader,
|
||||||
next_fragment_uri);
|
next_fragment_uri);
|
||||||
g_free (next_fragment_uri);
|
g_free (next_fragment_uri);
|
||||||
|
@ -1799,6 +1806,10 @@ gst_dash_demux_get_next_fragment_set (GstDashDemux * demux)
|
||||||
size_buffer += GST_BUFFER_SIZE (buffer);
|
size_buffer += GST_BUFFER_SIZE (buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
demux->end_of_period = end_of_period;
|
||||||
|
if (end_of_period)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* Wake the download task up */
|
/* Wake the download task up */
|
||||||
GST_TASK_SIGNAL (demux->download_task);
|
GST_TASK_SIGNAL (demux->download_task);
|
||||||
g_get_current_time (&now);
|
g_get_current_time (&now);
|
||||||
|
|
Loading…
Reference in a new issue