Skip to content

Commit

Permalink
udp_source/sink: Check for existing fd and close it during set_fd
Browse files Browse the repository at this point in the history
  • Loading branch information
kierank authored and cmassiot committed Aug 26, 2024
1 parent 4ab2f4c commit 509edbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/upipe-modules/upipe_udp_sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ static int _upipe_udpsink_control(struct upipe *upipe,
case UPIPE_UDPSINK_SET_FD: {
UBASE_SIGNATURE_CHECK(args, UPIPE_UDPSINK_SIGNATURE)
upipe_udpsink_set_upump(upipe, NULL);
if (likely(upipe_udpsink->fd != -1))
close(upipe_udpsink->fd);
upipe_udpsink->fd = va_arg(args, int );
return UBASE_ERR_NONE;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/upipe-modules/upipe_udp_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ static int _upipe_udpsrc_control(struct upipe *upipe,
case UPIPE_UDPSRC_SET_FD: {
UBASE_SIGNATURE_CHECK(args, UPIPE_UDPSRC_SIGNATURE)
upipe_udpsrc_set_upump(upipe, NULL);
if (likely(upipe_udpsrc->fd != -1))
close(upipe_udpsrc->fd);
upipe_udpsrc->fd = va_arg(args, int );
return UBASE_ERR_NONE;
}
Expand Down

0 comments on commit 509edbf

Please sign in to comment.