mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
srt: Check socket state before retrieving payload size
The connection might be broken, which we should detect instead of just aborting the write. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1669>
This commit is contained in:
parent
6f2f15b5fb
commit
2a7fa67693
1 changed files with 8 additions and 7 deletions
|
@ -1534,13 +1534,6 @@ gst_srt_object_write_one (GstSRTObject * srtobject,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (srt_getsockflag (wsock, SRTO_PAYLOADSIZE, &payload_size, &optlen)) {
|
||||
GST_WARNING_OBJECT (srtobject->element, "%s", srt_getlasterror_str ());
|
||||
break;
|
||||
}
|
||||
|
||||
rest = MIN (mapinfo->size - len, payload_size);
|
||||
|
||||
switch (srt_getsockstate (wsock)) {
|
||||
case SRTS_BROKEN:
|
||||
case SRTS_NONEXIST:
|
||||
|
@ -1562,6 +1555,14 @@ gst_srt_object_write_one (GstSRTObject * srtobject,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (srt_getsockflag (wsock, SRTO_PAYLOADSIZE, &payload_size, &optlen)) {
|
||||
GST_ELEMENT_ERROR (srtobject->element, RESOURCE, WRITE, NULL,
|
||||
("%s", srt_getlasterror_str ()));
|
||||
break;
|
||||
}
|
||||
|
||||
rest = MIN (mapinfo->size - len, payload_size);
|
||||
|
||||
sent = srt_sendmsg2 (wsock, (char *) (msg + len), rest, 0);
|
||||
if (sent < 0) {
|
||||
GST_ELEMENT_ERROR (srtobject->element, RESOURCE, WRITE, NULL,
|
||||
|
|
Loading…
Reference in a new issue