---
 libavformat/icertpdec.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/icertpdec.c b/libavformat/icertpdec.c
index fd8efa9..bc0849d 100644
--- a/libavformat/icertpdec.c
+++ b/libavformat/icertpdec.c
@@ -47,6 +47,7 @@ typedef struct ICEContext {
 #define D AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
     { "port", "incoming port number", OFFSET(port), AV_OPT_TYPE_INT, {.i64 = 
0},  0, 65535, D },
+    { "socket", "incoming socket", OFFSET(stun.fd), AV_OPT_TYPE_INT, {.i64 = 
0},  0, INT_MAX, D },
     { "mypwd", "my password", OFFSET(stun.mypwd), AV_OPT_TYPE_STRING, {.str = 
NULL},  0, 0, D },
     { "peerpwd", "peer password", OFFSET(stun.peerpwd), AV_OPT_TYPE_STRING, 
{.str = NULL},  0, 0, D },
     { "mycrypto", "my encryption key", OFFSET(mycrypto), AV_OPT_TYPE_STRING, 
{.str = NULL},  0, 0, D },
@@ -158,6 +159,7 @@ static int icertp_read_header(AVFormatContext *s)
 
     c->demuxer->pb = avio_alloc_context(c->iobuf, sizeof(c->iobuf), 1, c, 
io_read, io_write, NULL);
 
+    if (!c->stun.fd) {
     snprintf(portbuf, sizeof(portbuf), "%d", c->port);
     hints.ai_socktype = SOCK_DGRAM;
     hints.ai_family = AF_INET;
@@ -171,6 +173,7 @@ static int icertp_read_header(AVFormatContext *s)
     setsockopt(c->stun.fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
     bind(c->stun.fd, ai->ai_addr, ai->ai_addrlen);
     freeaddrinfo(ai);
+    }
 
     return 0;
 fail:
-- 
1.7.9.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to