mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-27 09:38:17 +00:00
Fixup for bug 109797 and 109094
Original commit message from CVS: Fixup for bug 109797 and 109094
This commit is contained in:
parent
edf080d727
commit
a1fa51068b
1 changed files with 15 additions and 9 deletions
|
@ -148,6 +148,8 @@ gst_udpsrc_init (GstUDPSrc *udpsrc)
|
||||||
udpsrc->port = UDP_DEFAULT_PORT;
|
udpsrc->port = UDP_DEFAULT_PORT;
|
||||||
udpsrc->control = CONTROL_UDP;
|
udpsrc->control = CONTROL_UDP;
|
||||||
udpsrc->clock = NULL;
|
udpsrc->clock = NULL;
|
||||||
|
udpsrc->sock = -1;
|
||||||
|
udpsrc->control_sock = -1;
|
||||||
|
|
||||||
udpsrc->first_buf = TRUE;
|
udpsrc->first_buf = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -170,18 +172,14 @@ gst_udpsrc_get (GstPad *pad)
|
||||||
|
|
||||||
FD_ZERO (&read_fds);
|
FD_ZERO (&read_fds);
|
||||||
FD_SET (udpsrc->sock, &read_fds);
|
FD_SET (udpsrc->sock, &read_fds);
|
||||||
|
|
||||||
if (udpsrc->control != CONTROL_NONE) {
|
if (udpsrc->control != CONTROL_NONE) {
|
||||||
FD_SET (udpsrc->control_sock, &read_fds);
|
FD_SET (udpsrc->control_sock, &read_fds);
|
||||||
max_sock = udpsrc->control_sock;
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
max_sock = udpsrc->sock;
|
|
||||||
}
|
}
|
||||||
|
max_sock = MAX(udpsrc->sock, udpsrc->control_sock);
|
||||||
|
|
||||||
if (select (max_sock+1, &read_fds, NULL, NULL, NULL) > 0) {
|
if (select (max_sock+1, &read_fds, NULL, NULL, NULL) > 0) {
|
||||||
if (FD_ISSET (udpsrc->control_sock, &read_fds)) {
|
if ((udpsrc->control_sock != -1) &&
|
||||||
|
FD_ISSET (udpsrc->control_sock, &read_fds)) {
|
||||||
#ifndef GST_DISABLE_LOADSAVE
|
#ifndef GST_DISABLE_LOADSAVE
|
||||||
guchar *buf;
|
guchar *buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -203,6 +201,7 @@ gst_udpsrc_get (GstPad *pad)
|
||||||
ret = read (fdread, buf, 1024*10);
|
ret = read (fdread, buf, 1024*10);
|
||||||
break;
|
break;
|
||||||
case CONTROL_UDP:
|
case CONTROL_UDP:
|
||||||
|
len = sizeof (struct sockaddr);
|
||||||
ret = recvfrom (udpsrc->control_sock, buf, 1024*10, 0, (struct sockaddr *)&tmpaddr, &len);
|
ret = recvfrom (udpsrc->control_sock, buf, 1024*10, 0, (struct sockaddr *)&tmpaddr, &len);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
perror ("recvfrom");
|
perror ("recvfrom");
|
||||||
|
@ -253,6 +252,7 @@ gst_udpsrc_get (GstPad *pad)
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
|
GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
len = sizeof (struct sockaddr);
|
||||||
numbytes = recvfrom (udpsrc->sock, GST_BUFFER_DATA (outbuf),
|
numbytes = recvfrom (udpsrc->sock, GST_BUFFER_DATA (outbuf),
|
||||||
GST_BUFFER_SIZE (outbuf), 0, (struct sockaddr *)&tmpaddr, &len);
|
GST_BUFFER_SIZE (outbuf), 0, (struct sockaddr *)&tmpaddr, &len);
|
||||||
|
|
||||||
|
@ -394,8 +394,14 @@ gst_udpsrc_init_receive (GstUDPSrc *src)
|
||||||
static void
|
static void
|
||||||
gst_udpsrc_close (GstUDPSrc *src)
|
gst_udpsrc_close (GstUDPSrc *src)
|
||||||
{
|
{
|
||||||
close (src->sock);
|
if (src->sock != -1) {
|
||||||
close (src->control_sock);
|
close (src->sock);
|
||||||
|
src->sock = -1;
|
||||||
|
}
|
||||||
|
if (src->control_sock != -1) {
|
||||||
|
close (src->control_sock);
|
||||||
|
src->control_sock = -1;
|
||||||
|
}
|
||||||
|
|
||||||
GST_FLAG_UNSET (src, GST_UDPSRC_OPEN);
|
GST_FLAG_UNSET (src, GST_UDPSRC_OPEN);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue