Fixed state machine (again)
This commit is contained in:
parent
a7ad12e208
commit
29c62f4780
@ -443,7 +443,6 @@ gst_dash_demux_change_state (GstElement * element, GstStateChange transition)
|
|||||||
gst_dash_demux_stop (demux);
|
gst_dash_demux_stop (demux);
|
||||||
gst_task_join (demux->stream_task);
|
gst_task_join (demux->stream_task);
|
||||||
gst_task_join (demux->download_task);
|
gst_task_join (demux->download_task);
|
||||||
GST_WARNING_OBJECT (demux, "DASH demux now terminated");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -787,13 +786,12 @@ gst_dash_demux_stop (GstDashDemux * demux)
|
|||||||
gst_uri_downloader_cancel (demux->downloader);
|
gst_uri_downloader_cancel (demux->downloader);
|
||||||
|
|
||||||
if (GST_TASK_STATE (demux->download_task) != GST_TASK_STOPPED) {
|
if (GST_TASK_STATE (demux->download_task) != GST_TASK_STOPPED) {
|
||||||
gst_task_stop (demux->download_task);
|
|
||||||
GST_TASK_SIGNAL (demux->download_task);
|
GST_TASK_SIGNAL (demux->download_task);
|
||||||
|
gst_task_stop (demux->download_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) {
|
if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) {
|
||||||
gst_task_stop (demux->stream_task);
|
|
||||||
GST_TASK_SIGNAL (demux->stream_task);
|
GST_TASK_SIGNAL (demux->stream_task);
|
||||||
|
gst_task_stop (demux->stream_task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -924,7 +922,7 @@ gst_dash_demux_stream_loop (GstDashDemux * demux)
|
|||||||
/* Wait until the next scheduled push downstream */
|
/* Wait until the next scheduled push downstream */
|
||||||
if (g_cond_timed_wait (GST_TASK_GET_COND (demux->stream_task),
|
if (g_cond_timed_wait (GST_TASK_GET_COND (demux->stream_task),
|
||||||
demux->stream_timed_lock, &demux->next_push)) {
|
demux->stream_timed_lock, &demux->next_push)) {
|
||||||
goto pause_streaming;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_queue_is_empty (demux->queue)) {
|
if (g_queue_is_empty (demux->queue)) {
|
||||||
@ -990,7 +988,10 @@ gst_dash_demux_stream_loop (GstDashDemux * demux)
|
|||||||
goto pause_streaming;
|
goto pause_streaming;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quit:
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
end_of_manifest:
|
end_of_manifest:
|
||||||
{
|
{
|
||||||
@ -1105,7 +1106,7 @@ gst_dash_demux_download_loop (GstDashDemux * demux)
|
|||||||
/* Wait until the next scheduled download */
|
/* Wait until the next scheduled download */
|
||||||
if (g_cond_timed_wait (GST_TASK_GET_COND (demux->download_task),
|
if (g_cond_timed_wait (GST_TASK_GET_COND (demux->download_task),
|
||||||
demux->download_timed_lock, &demux->next_download)) {
|
demux->download_timed_lock, &demux->next_download)) {
|
||||||
goto pause_download;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Target buffering time MUST at least exceeds mimimum buffering time
|
/* Target buffering time MUST at least exceeds mimimum buffering time
|
||||||
@ -1141,12 +1142,9 @@ gst_dash_demux_download_loop (GstDashDemux * demux)
|
|||||||
if (demux->client->update_failed_count < DEFAULT_FAILED_COUNT) {
|
if (demux->client->update_failed_count < DEFAULT_FAILED_COUNT) {
|
||||||
GST_WARNING_OBJECT (demux, "Could not fetch the next fragment");
|
GST_WARNING_OBJECT (demux, "Could not fetch the next fragment");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else
|
||||||
GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,
|
|
||||||
("Could not fetch the next fragment"), (NULL));
|
|
||||||
goto error_downloading;
|
goto error_downloading;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
GST_INFO_OBJECT (demux, "Internal buffering : %d s",
|
GST_INFO_OBJECT (demux, "Internal buffering : %d s",
|
||||||
gst_dash_demux_get_buffering_time (demux) / GST_SECOND);
|
gst_dash_demux_get_buffering_time (demux) / GST_SECOND);
|
||||||
@ -1157,25 +1155,26 @@ gst_dash_demux_download_loop (GstDashDemux * demux)
|
|||||||
g_get_current_time (&demux->next_download);
|
g_get_current_time (&demux->next_download);
|
||||||
g_time_val_add (&demux->next_download, 100000);
|
g_time_val_add (&demux->next_download, 100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quit:
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
end_of_manifest:
|
end_of_manifest:
|
||||||
{
|
{
|
||||||
GST_INFO_OBJECT (demux, "Stopped download task");
|
GST_INFO_OBJECT (demux, "Stopped download task");
|
||||||
gst_task_stop (demux->download_task);
|
gst_task_stop (demux->download_task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_downloading:
|
error_downloading:
|
||||||
{
|
{
|
||||||
GST_INFO_OBJECT (demux, "Terminating the demux");
|
GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,
|
||||||
|
("Could not fetch the next fragment"), (NULL));
|
||||||
gst_dash_demux_stop (demux);
|
gst_dash_demux_stop (demux);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pause_download:
|
|
||||||
{
|
|
||||||
GST_INFO_OBJECT (demux, "Pausing download task");
|
|
||||||
gst_task_pause (demux->download_task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user