diff --git a/CHANGES.md b/CHANGES.md
index 301ff8de2..b895aee8f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,17 @@
+Changes in 3.6.0
+================
+
+* Removed unused RTPStream code concerning video streams. Also
+ consolidated the rtpstream audio port usage to reuse the global
+ `[media_port]` instead of the `[rtpstream_audio_port]`.
+ Also the `-min_rtp_port` and `-max_rtp_port` options have been
+ removed. Advantages: cleaner code, fewer scenario variables.
+ Drawbacks: possible ICMP port unreachable messages for RCTP and video.
+ Also, no easy way to discern different streams if you want to bombard
+ a single UAS with multiple RTP streams. (Issue #192, reported by
+ @atsakiridis.)
+
+
Bugs fixed in 3.5.1
===================
diff --git a/include/sipp.hpp b/include/sipp.hpp
index e53476617..c923a6d53 100644
--- a/include/sipp.hpp
+++ b/include/sipp.hpp
@@ -255,8 +255,6 @@ extern int tcp_readsize _DEFVAL(65535);
extern int hasMedia _DEFVAL(0);
#endif
#ifdef RTP_STREAM
-extern int min_rtp_port _DEFVAL(DEFAULT_MIN_RTP_PORT);
-extern int max_rtp_port _DEFVAL(DEFAULT_MAX_RTP_PORT);
extern int rtp_default_payload _DEFVAL(DEFAULT_RTP_PAYLOAD);
extern int rtp_tasks_per_thread _DEFVAL(DEFAULT_RTP_THREADTASKS);
extern int rtp_buffsize _DEFVAL(65535);
diff --git a/regress/github-#0196/beep_1sec_50x160b.alaw b/regress/github-#0196/beep_1sec_50x160b.alaw
new file mode 100644
index 000000000..29f5b258e
Binary files /dev/null and b/regress/github-#0196/beep_1sec_50x160b.alaw differ
diff --git a/regress/github-#0196/run b/regress/github-#0196/run
new file mode 100755
index 000000000..bd2311f42
--- /dev/null
+++ b/regress/github-#0196/run
@@ -0,0 +1,32 @@
+#!/bin/sh
+# This regression test is a part of SIPp.
+# Author: Walter Doekes, OSSO B.V., 2016
+#
+# Similar to github-#0192, it checks whether the rtpstream source port
+# is correct, but this time uses the [media_port] instead of a special
+# [rtpstream_audio_port].
+#
+. "`dirname "$0"`/../functions"; init
+
+uac_media_port=5072 # client port
+uas_media_port=5071 # server port
+
+udplisten $uas_media_port >udplisten.log &
+udplisten_job=$!
+trap "kill -9 $udplisten_job 2>/dev/null" EXIT
+
+sippbg -sf uas.xml -p 5070 -key custom_media_port $uas_media_port
+sippfg -m 1 -sf uac.xml 127.0.0.1:5070 -mp $uac_media_port \
+ -timeout 5 -timeout_error >/dev/null 2>&1
+status=$?
+
+test $status -ne 0 && fail "SIPp UAC job failed"
+
+port=`sed -e '/^Connection from/!d;s/.*://' udplisten.log`
+if test "$port" = "$uac_media_port"; then
+ ok
+elif test -n "$port"; then
+ fail "got RTP from wrong source port $port"
+else
+ fail "got no RTP at all"
+fi
diff --git a/regress/github-#0196/uac.xml b/regress/github-#0196/uac.xml
new file mode 100644
index 000000000..4640494b0
--- /dev/null
+++ b/regress/github-#0196/uac.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/regress/github-#0196/uas.xml b/regress/github-#0196/uas.xml
new file mode 100644
index 000000000..758d4ea87
--- /dev/null
+++ b/regress/github-#0196/uas.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/call.cpp b/src/call.cpp
index 6977e8b7c..2783610c0 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -2182,26 +2182,10 @@ char* call::createSendingMessage(SendingMessage *src, int P_index, char *msg_buf
break;
}
#ifdef RTP_STREAM
- case E_Message_RTPStream_Audio_Port:
- {
- int temp_audio_port= rtpstream_get_audioport (&rtpstream_callinfo);
- if (!temp_audio_port) {
- /* Make this a warning instead? */
- ERROR("cannot assign a free audio port to this call - using 0 for [rtpstream_audio_port]");
- }
- dest += snprintf(dest, left, "%d",temp_audio_port);
- }
- break;
- case E_Message_RTPStream_Video_Port:
- {
- int temp_video_port= rtpstream_get_videoport (&rtpstream_callinfo);
- if (!temp_video_port) {
- /* Make this a warning instead? */
- ERROR("cannot assign a free video port to this call - using 0 for [rtpstream_video_port]");
- }
- dest += snprintf(dest, left, "%d",temp_video_port);
- }
- break;
+ case E_Message_RTPStream_Audio_Port: /* DEPRECATED */
+ case E_Message_RTPStream_Video_Port: /* DEPRECATED */
+ dest += sprintf(dest, "%u", media_port);
+ break;
#endif
case E_Message_Media_IP_Type:
dest += snprintf(dest, left, "%s", (media_ip_is_ipv6 ? "6" : "4"));
diff --git a/src/message.cpp b/src/message.cpp
index 5e579545e..0d86aada1 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -62,8 +62,9 @@ struct KeywordMap SimpleKeywords[] = {
{"auto_media_port", E_Message_Auto_Media_Port },
#endif
#ifdef RTP_STREAM
- {"rtpstream_audio_port", E_Message_RTPStream_Audio_Port },
- {"rtpstream_video_port", E_Message_RTPStream_Video_Port },
+ /* Legacy since 3.6-dev. Actually uses media_port. */
+ {"rtpstream_audio_port", E_Message_RTPStream_Audio_Port },
+ {"rtpstream_video_port", E_Message_RTPStream_Video_Port },
#endif
{"media_port", E_Message_Media_Port },
{"media_ip_type", E_Message_Media_IP_Type },
diff --git a/src/rtpstream.cpp b/src/rtpstream.cpp
index e0d5d1af5..a0bcec480 100644
--- a/src/rtpstream.cpp
+++ b/src/rtpstream.cpp
@@ -39,14 +39,12 @@ static void debugprint(const char *Format, ...)
#define MAX_UDP_RECV_BUFFER 8192
#define TI_NULL_AUDIOIP 0x01
-#define TI_NULL_VIDEOIP 0x02
-#define TI_NULLIP (TI_NULL_AUDIOIP|TI_NULL_VIDEOIP)
+#define TI_NULLIP (TI_NULL_AUDIOIP)
#define TI_PAUSERTP 0x04
#define TI_ECHORTP 0x08 /* Not currently implemented */
#define TI_KILLTASK 0x10
-#define TI_RECONNECTSOCKET 0x20
#define TI_PLAYFILE 0x40
-#define TI_CONFIGFLAGS (TI_KILLTASK|TI_RECONNECTSOCKET|TI_PLAYFILE)
+#define TI_CONFIGFLAGS (TI_KILLTASK|TI_PLAYFILE)
struct rtp_header_t
{
@@ -90,15 +88,9 @@ struct taskentry_t
int new_timeticks_per_packet;
/* sockets for audio/video rtp_rtcp */
int audio_rtp_socket;
- int audio_rtcp_socket;
- int video_rtp_socket;
- int video_rtcp_socket;
/* rtp peer address structures */
struct sockaddr_storage remote_audio_rtp_addr;
- struct sockaddr_storage remote_audio_rtcp_addr;
- struct sockaddr_storage remote_video_rtp_addr;
- struct sockaddr_storage remote_video_rtcp_addr;
/* we will have a mutex per call. should we consider refactoring to */
/* share mutexes across calls? makes the per-call code more complex */
@@ -143,94 +135,16 @@ unsigned int global_ssrc_id= 0xCA110000;
/* code checked */
static void rtpstream_free_taskinfo(taskentry_t* taskinfo)
{
- if (taskinfo) {
- /* close sockets associated with this call */
- if (taskinfo->audio_rtp_socket!=-1) {
- close (taskinfo->audio_rtp_socket);
- }
- if (taskinfo->audio_rtcp_socket!=-1) {
- close (taskinfo->audio_rtcp_socket);
- }
- if (taskinfo->video_rtp_socket!=-1) {
- close (taskinfo->video_rtp_socket);
+ if (taskinfo) {
+ /* cleanup pthread library structure */
+ pthread_mutex_destroy(&(taskinfo->mutex));
+ free(taskinfo);
}
- if (taskinfo->video_rtcp_socket!=-1) {
- close (taskinfo->video_rtcp_socket);
- }
-
- /* cleanup pthread library structure */
- pthread_mutex_destroy(&(taskinfo->mutex));
-
- free (taskinfo);
- }
}
/* code checked */
static void rtpstream_process_task_flags(taskentry_t* taskinfo)
{
- if (taskinfo->flags&TI_RECONNECTSOCKET) {
- int remote_addr_len;
- int rc;
-
- remote_addr_len = media_ip_is_ipv6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in);
-
- /* enter critical section to lock address updates */
- /* may want to leave this out -- low chance of race condition */
- pthread_mutex_lock (&(taskinfo->mutex));
-
- /* If we have valid ip and port numbers for audio rtp stream */
- if (!(taskinfo->flags & TI_NULL_AUDIOIP))
- {
- if (taskinfo->audio_rtcp_socket != -1) {
- rc = connect(taskinfo->audio_rtcp_socket, (struct sockaddr *)&taskinfo->remote_audio_rtcp_addr,
- remote_addr_len);
- if (rc < 0) {
- debugprint("closing audio rtcp socket %d due to error %d in rtpstream_process_task_flags taskinfo=%p\n",
- taskinfo->audio_rtcp_socket, errno, taskinfo);
- close(taskinfo->audio_rtcp_socket);
- taskinfo->audio_rtcp_socket = -1;
- }
- }
-
- if (taskinfo->audio_rtp_socket != -1) {
- rc = connect(taskinfo->audio_rtp_socket, (struct sockaddr *)&taskinfo->remote_audio_rtp_addr, remote_addr_len);
- if (rc < 0) {
- debugprint("closing audio rtp socket %d due to error %d in rtpstream_process_task_flags taskinfo=%p\n",
- taskinfo->audio_rtp_socket, errno, taskinfo);
- close(taskinfo->audio_rtp_socket);
- taskinfo->audio_rtp_socket = -1;
- }
- }
- }
-
- /* If we have valid ip and port numbers for video rtp stream */
- if (!(taskinfo->flags & TI_NULL_VIDEOIP))
- {
- if (taskinfo->video_rtcp_socket != -1) {
- rc = connect(taskinfo->video_rtcp_socket, (struct sockaddr *)&taskinfo->remote_video_rtcp_addr,
- remote_addr_len);
- if (rc < 0) {
- debugprint("closing video rtcp socket %d due to error %d in rtpstream_process_task_flags taskinfo=%p\n",
- taskinfo->video_rtcp_socket, errno, taskinfo);
- close(taskinfo->video_rtcp_socket);
- taskinfo->video_rtcp_socket = -1;
- }
- }
- if (taskinfo->video_rtp_socket != -1) {
- rc = connect(taskinfo->video_rtp_socket, (struct sockaddr *)&taskinfo->remote_video_rtp_addr,
- remote_addr_len);
- if (rc < 0) {
- debugprint("closing video rtp socket %d due to error %d in rtpstream_process_task_flags taskinfo=%p\n",
- taskinfo->video_rtp_socket, errno, taskinfo);
- close(taskinfo->video_rtp_socket);
- taskinfo->video_rtp_socket = -1;
- }
- }
- }
-
- taskinfo->flags&= ~TI_RECONNECTSOCKET;
- pthread_mutex_unlock (&(taskinfo->mutex));
- }
if (taskinfo->flags&TI_PLAYFILE) {
/* copy playback information */
taskinfo->loop_count= taskinfo->new_loop_count;
@@ -267,41 +181,11 @@ static unsigned long rtpstream_playrtptask(taskentry_t *taskinfo, unsigned long
next_wake = timenow_ms + 100; /* default next wakeup time */
- if (taskinfo->audio_rtcp_socket != -1) {
- /* just keep listening on rtcp socket (is this really required?) - ignore any errors */
- while ((rc = recv(taskinfo->audio_rtcp_socket, udp.buffer, sizeof(udp), 0)) >= 0) {
- /*
- * rtpstream_bytes_in+= rc;
- */
- }
- }
-
- if (taskinfo->video_rtp_socket != -1) {
- /* just keep listening on rtp socket (is this really required?) - ignore any errors */
- while ((rc = recv(taskinfo->video_rtp_socket, udp.buffer, sizeof(udp), 0)) >= 0) {
- /*
- * rtpstream_bytes_in += rc;
- */
- }
- }
-
- if (taskinfo->video_rtcp_socket != -1) {
- /* just keep listening on rtcp socket (is this really required?) - ignore any errors */
- while ((rc = recv(taskinfo->video_rtcp_socket, udp.buffer, sizeof(udp), 0)) >= 0) {
- /*
- * rtpstream_bytes_in+= rc;
- */
- }
- }
-
if (taskinfo->audio_rtp_socket != -1) {
- /* this is temp code - will have to reorganize if/when we include echo functionality */
- /* just keep listening on rtcp socket (is this really required?) - ignore any errors */
- while ((rc = recv(taskinfo->audio_rtp_socket, udp.buffer, sizeof(udp), 0)) >= 0) {
- /* for now we will just ignore any received data or receive errors */
- /* separate code path for RTP echo */
- rtpstream_bytes_in += rc;
- }
+ /* if/when we include echo functionality, we'll have to read
+ * from the audio_rtp_socket too, and check by peer address if
+ * it is "our" traffic */
+
/* are we playing back an audio file? */
if (taskinfo->loop_count) {
target_timestamp = timenow_ms * taskinfo->timeticks_per_ms;
@@ -311,6 +195,7 @@ static unsigned long rtpstream_playrtptask(taskentry_t *taskinfo, unsigned long
taskinfo->last_timestamp = target_timestamp;
}
if (taskinfo->last_timestamp < target_timestamp) {
+
/* need to send rtp payload - build rtp packet header... */
udp.hdr.flags = htons(0x8000 | taskinfo->payload_type);
udp.hdr.seq = htons(taskinfo->seq);
@@ -327,8 +212,15 @@ static unsigned long rtpstream_playrtptask(taskentry_t *taskinfo, unsigned long
memcpy(udp.buffer + sizeof(rtp_header_t) + taskinfo->file_bytes_left,
taskinfo->file_bytes_start, taskinfo->bytes_per_packet-taskinfo->file_bytes_left);
}
+
/* now send the actual packet */
- rc = send(taskinfo->audio_rtp_socket, udp.buffer, taskinfo->bytes_per_packet + sizeof(rtp_header_t), 0);
+ size_t packet_len = taskinfo->bytes_per_packet + sizeof(rtp_header_t);
+ socklen_t remote_addr_len = (media_ip_is_ipv6 ?
+ sizeof(struct sockaddr_in6) :
+ sizeof(struct sockaddr_in));
+ rc = sendto(taskinfo->audio_rtp_socket, udp.buffer, packet_len, 0,
+ (struct sockaddr*)&taskinfo->remote_audio_rtp_addr, remote_addr_len);
+
if (rc < 0) {
/* handle sending errors */
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
@@ -449,7 +341,7 @@ static void* rtpstream_playback_thread(void* params)
}
/* code checked */
-static int rtpstream_start_task (rtpstream_callinfo_t *callinfo)
+static int rtpstream_start_task(rtpstream_callinfo_t *callinfo)
{
int ready_index;
int allocsize;
@@ -611,10 +503,7 @@ int rtpstream_new_call (rtpstream_callinfo_t *callinfo)
memset (taskinfo,0,sizeof(*taskinfo));
taskinfo->flags= TI_NULLIP;
/* socket descriptors */
- taskinfo->audio_rtp_socket= -1;
- taskinfo->audio_rtcp_socket= -1;
- taskinfo->video_rtp_socket= -1;
- taskinfo->video_rtcp_socket= -1;
+ taskinfo->audio_rtp_socket = -1;
/* rtp stream members */
taskinfo->ssrc_id= global_ssrc_id++;
/* pthread mutexes */
@@ -694,190 +583,6 @@ int rtpstream_cache_file (char *filename)
return num_cached_files++;
}
-static int rtpstream_setsocketoptions (int sock)
-{
- /* set socket non-blocking */
- int flags= fcntl(sock,F_GETFL,0);
- if (fcntl(sock,F_SETFL,flags|O_NONBLOCK)==-1) {
- return 0;
- }
-
- /* set buffer size */
- unsigned int buffsize= rtp_buffsize;
-
- /* Increase buffer sizes for this sockets */
- if(setsockopt(sock,SOL_SOCKET,SO_SNDBUF,(char*)&buffsize,sizeof(buffsize))) {
- return 0;
- }
- if(setsockopt(sock,SOL_SOCKET,SO_RCVBUF,(char*)&buffsize,sizeof(buffsize))) {
- return 0;
- }
-
- return 1; /* success */
-}
-
-/* code checked */
-static int rtpstream_get_localport (int *rtpsocket, int *rtcpsocket)
-{
- int port_number;
- int tries;
- struct sockaddr_storage address;
-
- debugprint ("rtpstream_get_localport\n");
-
- if (next_rtp_portsin6_addr)):
- inet_pton(AF_INET,media_ip,&((_RCAST(struct sockaddr_in *,&address))->sin_addr)))!=1) {
- WARNING("Could not set up media IP for RTP streaming");
- return 0;
- }
-
- /* create new UDP listen socket */
- *rtpsocket= socket(media_ip_is_ipv6?PF_INET6:PF_INET,SOCK_DGRAM,0);
- if (*rtpsocket==-1) {
- WARNING("Could not open socket for RTP streaming: %s", strerror(errno));
- return 0;
- }
-
- for (tries=0;tries(max_rtp_port-1)) {
- next_rtp_port= min_rtp_port;
- }
-
- sockaddr_update_port(&address, port_number);
- if (::bind(*rtpsocket,(sockaddr *)(void *)&address,
- sizeof(address)) == 0) {
- break;
- }
- }
- /* Exit here if we didn't get a suitable port for rtp stream */
- if (tries==BIND_MAX_TRIES) {
- close (*rtpsocket);
- *rtpsocket= -1;
- WARNING("Could not bind port for RTP streaming after %d tries", tries);
- return 0;
- }
-
- if (!rtpstream_setsocketoptions (*rtpsocket)) {
- close (*rtpsocket);
- *rtpsocket= -1;
- WARNING("Could not set socket options for RTP streaming");
- return 0;
- }
-
- /* create socket for rtcp - ignore any errors */
- *rtcpsocket= socket(media_ip_is_ipv6?PF_INET6:PF_INET,SOCK_DGRAM,0);
- if (*rtcpsocket!=-1) {
- /* try to bind it to our preferred address */
- sockaddr_update_port(&address, port_number + 1);
- if (::bind(*rtcpsocket,(sockaddr *)(void *)&address,
- sizeof(address)) == 0) {
- /* could not bind the rtcp socket to required port. so we delete it */
- close (*rtcpsocket);
- *rtcpsocket= -1;
- }
- if (!rtpstream_setsocketoptions (*rtcpsocket)) {
- close (*rtcpsocket);
- *rtcpsocket= -1;
- }
- }
-
- return port_number;
-}
-
-/* code checked */
-int rtpstream_get_audioport (rtpstream_callinfo_t *callinfo)
-{
- debugprint ("rtpstream_get_audioport callinfo=%p",callinfo);
-
- int rtp_socket;
- int rtcp_socket;
-
- if (!callinfo->taskinfo) {
- return 0;
- }
-
- if (callinfo->audioport) {
- /* already a port assigned to this call */
- debugprint (" ==> %d\n",callinfo->audioport);
- return callinfo->audioport;
- }
-
- callinfo->audioport= rtpstream_get_localport (&rtp_socket,&rtcp_socket);
- debugprint (" ==> %d\n",callinfo->audioport);
-
- /* assign rtp and rtcp sockets to callinfo. must assign rtcp socket first */
- callinfo->taskinfo->audio_rtcp_socket= rtcp_socket;
- callinfo->taskinfo->audio_rtp_socket= rtp_socket;
-
- /* start playback task if not already started */
- if (!callinfo->taskinfo->parent_thread) {
- if (!rtpstream_start_task (callinfo)) {
- /* error starting playback task */
- return 0;
- }
- }
-
- /* make sure the new socket gets bound to destination address (if any) */
- callinfo->taskinfo->flags|= TI_RECONNECTSOCKET;
-
- return callinfo->audioport;
-}
-
-/* code checked */
-int rtpstream_get_videoport (rtpstream_callinfo_t *callinfo)
-{
- debugprint ("rtpstream_get_videoport callinfo=%p",callinfo);
-
- int rtp_socket;
- int rtcp_socket;
-
- if (!callinfo->taskinfo) {
- return 0;
- }
-
- if (callinfo->videoport) {
- /* already a port assigned to this call */
- debugprint (" ==> %d\n",callinfo->videoport);
- return callinfo->videoport;
- }
-
- callinfo->videoport= rtpstream_get_localport (&rtp_socket,&rtcp_socket);
- debugprint (" ==> %d\n",callinfo->videoport);
-
- /* assign rtp and rtcp sockets to callinfo. must assign rtcp socket first */
- callinfo->taskinfo->video_rtcp_socket= rtcp_socket;
- callinfo->taskinfo->video_rtp_socket= rtp_socket;
-
- /* start playback task if not already started */
- if (!callinfo->taskinfo->parent_thread) {
- if (!rtpstream_start_task (callinfo)) {
- /* error starting playback task */
- return 0;
- }
- }
-
- /* make sure the new socket gets bound to destination address (if any) */
- callinfo->taskinfo->flags|= TI_RECONNECTSOCKET;
-
- return callinfo->videoport;
-}
-
/* code checked */
void rtpstream_set_remote (rtpstream_callinfo_t *callinfo, int ip_ver, char *ip_addr,
int audio_port, int video_port)
@@ -889,6 +594,8 @@ void rtpstream_set_remote (rtpstream_callinfo_t *callinfo, int ip_ver, char *ip_
unsigned count;
int nonzero_ip;
+ /* observe that we rely on ip_ver being in sync with media_ip_is_ipv6 */
+ /* we never alloc a socket here, we reuse the global media socket */
debugprint("rtpstream_set_remote callinfo=%p, ip_ver %d ip_addr %s audio %d video %d\n",
callinfo, ip_ver, ip_addr, audio_port, video_port);
@@ -940,38 +647,18 @@ void rtpstream_set_remote (rtpstream_callinfo_t *callinfo, int ip_ver, char *ip_
pthread_mutex_lock (&(taskinfo->mutex));
/* clear out existing addresses */
- memset (&(taskinfo->remote_audio_rtp_addr),0,sizeof(taskinfo->remote_audio_rtp_addr));
- memset (&(taskinfo->remote_audio_rtcp_addr),0,sizeof(taskinfo->remote_audio_rtcp_addr));
- memset (&(taskinfo->remote_video_rtp_addr),0,sizeof(taskinfo->remote_video_rtp_addr));
- memset (&(taskinfo->remote_video_rtcp_addr),0,sizeof(taskinfo->remote_video_rtcp_addr));
+ memset(&(taskinfo->remote_audio_rtp_addr), 0, sizeof(taskinfo->remote_audio_rtp_addr));
/* Audio */
if (audio_port) {
sockaddr_update_port(&address, audio_port);
memcpy (&(taskinfo->remote_audio_rtp_addr),&address,sizeof(address));
-
- sockaddr_update_port(&address, audio_port + 1);
- memcpy (&(taskinfo->remote_audio_rtcp_addr),&address,sizeof(address));
-
taskinfo->flags&= ~TI_NULL_AUDIOIP;
}
- /* Video */
- if (video_port) {
- sockaddr_update_port(&address, video_port);
- memcpy (&(taskinfo->remote_video_rtp_addr),&address,sizeof(address));
-
- sockaddr_update_port(&address, video_port + 1);
- memcpy (&(taskinfo->remote_video_rtcp_addr),&address,sizeof(address));
-
- taskinfo->flags&= ~TI_NULL_VIDEOIP;
- }
-
/* ok, we are done with the shared memory objects. let go mutex */
pthread_mutex_unlock (&(taskinfo->mutex));
- taskinfo->flags|= TI_RECONNECTSOCKET;
-
/* may want to start a playback (listen) task here if no task running? */
/* only makes sense if we decide to send 0-filled packets on idle */
}
@@ -993,7 +680,15 @@ void rtpstream_play (rtpstream_callinfo_t *callinfo, rtpstream_actinfo_t *action
}
/* make sure we have an open socket from which to play the audio file */
- rtpstream_get_audioport (callinfo);
+ taskinfo->audio_rtp_socket = media_socket;
+
+ /* start playback task if not already started */
+ if (!taskinfo->parent_thread) {
+ if (!rtpstream_start_task(callinfo)) {
+ /* error starting playback task */
+ return;
+ }
+ }
/* save file parameter in taskinfo structure */
taskinfo->new_loop_count= actioninfo->loop_count;
diff --git a/src/sipp.cpp b/src/sipp.cpp
index f2ae0bde5..1be48ec44 100644
--- a/src/sipp.cpp
+++ b/src/sipp.cpp
@@ -257,8 +257,6 @@ struct sipp_option options_table[] = {
{"mb", "Set the RTP echo buffer size (default: 2048).", SIPP_OPTION_INT, &media_bufsize, 1},
{"mp", "Set the local RTP echo port number. Default is 6000.", SIPP_OPTION_INT, &user_media_port, 1},
#ifdef RTP_STREAM
- {"min_rtp_port", "Minimum port number for RTP socket range.", SIPP_OPTION_INT, &min_rtp_port, 1},
- {"max_rtp_port", "Maximum port number for RTP socket range.", SIPP_OPTION_INT, &max_rtp_port, 1},
{"rtp_payload", "RTP default payload type.", SIPP_OPTION_INT, &rtp_default_payload, 1},
{"rtp_threadtasks", "RTP number of playback tasks per thread.", SIPP_OPTION_INT, &rtp_tasks_per_thread, 1},
{"rtp_buffsize", "Set the rtp socket send/receive buffer size.", SIPP_OPTION_INT, &rtp_buffsize, 1},