Don't send empty RTP frames
authorMark Spencer <markster@digium.com>
Tue, 8 Apr 2003 21:53:46 +0000 (21:53 +0000)
committerMark Spencer <markster@digium.com>
Tue, 8 Apr 2003 21:53:46 +0000 (21:53 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@788 65c4cc65-6c06-0410-ace0-fbb531ad65f3

rtp.c

diff --git a/rtp.c b/rtp.c
index 555b7cf..af65250 100755 (executable)
--- a/rtp.c
+++ b/rtp.c
@@ -749,6 +749,10 @@ int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f)
        /* If we have no peer, return immediately */    
        if (!rtp->them.sin_addr.s_addr)
                return 0;
+
+       /* If there is no data length, return immediately */
+       if (!_f->datalen) 
+               return 0;
        
        /* Make sure we have enough space for RTP header */
        if (_f->frametype != AST_FRAME_VOICE) {
@@ -756,6 +760,7 @@ int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f)
                return -1;
        }
 
+
        codec = ast_rtp_lookup_code(rtp, 1, _f->subclass);
        if (codec < 0) {
                ast_log(LOG_WARNING, "Don't know how to send format %d packets with RTP\n", _f->subclass);