From e1f0919720c9ba214ce800146a3155e3924ce7d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sun, 15 Jun 2008 22:41:04 +0300 Subject: [PATCH 1/1] RTP sout: fix buffer size for SRTP --- modules/stream_out/rtp.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c index c74f659530..d09419372e 100644 --- a/modules/stream_out/rtp.c +++ b/modules/stream_out/rtp.c @@ -945,6 +945,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) msg_Err (p_stream, "bad SRTP key/salt combination (%m)"); goto error; } + id->i_sequence = 0; /* FIXME: awful hack for libvlc_srtp */ } vlc_mutex_init( &id->lock_sink ); @@ -1440,16 +1441,10 @@ static void ThreadSend( vlc_object_t *p_this ) if( id->srtp ) { /* FIXME: this is awfully inefficient */ size_t len = out->i_buffer; - int val = srtp_send( id->srtp, out->p_buffer, &len, - out->i_buffer ); - if( val == ENOSPC ) - { - out = block_Realloc( out, 0, len ); - if( out == NULL ) - continue; - val = srtp_send( id->srtp, out->p_buffer, &len, - out->i_buffer ); - } + out = block_Realloc( out, 0, len + 10 ); + out->i_buffer = len; + + int val = srtp_send( id->srtp, out->p_buffer, &len, len + 10 ); if( val ) { errno = val; -- 2.39.2