mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
media: limit the time to wait to something huge
Avoid waiting forever but limit the timeout to 20 seconds.
This commit is contained in:
parent
f90c422e62
commit
83ed258684
1 changed files with 7 additions and 1 deletions
|
@ -1115,12 +1115,18 @@ static GstRTSPMediaStatus
|
|||
gst_rtsp_media_get_status (GstRTSPMedia *media)
|
||||
{
|
||||
GstRTSPMediaStatus result;
|
||||
GTimeVal timeout;
|
||||
|
||||
g_mutex_lock (media->lock);
|
||||
g_get_current_time (&timeout);
|
||||
g_time_val_add (&timeout, 20 * G_USEC_PER_SEC);
|
||||
/* while we are preparing, wait */
|
||||
while (media->status == GST_RTSP_MEDIA_STATUS_PREPARING) {
|
||||
GST_DEBUG ("waiting for status change");
|
||||
g_cond_wait (media->cond, media->lock);
|
||||
if (!g_cond_timed_wait (media->cond, media->lock, &timeout)) {
|
||||
GST_DEBUG ("timeout, assuming error status");
|
||||
media->status = GST_RTSP_MEDIA_STATUS_ERROR;
|
||||
}
|
||||
}
|
||||
/* could be success or error */
|
||||
result = media->status;
|
||||
|
|
Loading…
Reference in a new issue