[vlc-devel] [PATCH 1/2] access/rtp: define MSG_TRUNC on recv call if available.
Ilkka Ollakka
ileoo at videolan.org
Mon Oct 15 16:22:04 CEST 2018
On Sun, Oct 14, 2018 at 12:16:23PM +0300, Rémi Denis-Courmont wrote:
> Le lauantaina 13. lokakuuta 2018, 21.04.43 EEST Ilkka Ollakka a écrit :
> > Defining the MSG_TRUNC on msghrd does only tell if data is truncated,
> > not what the actual data size was.
> > Tested the adjust of MTU by sending data to localhost via netcat:
> > cat ~/tmp/myfile.mp3|netcat -u 127.0.0.1 1234
> > and vlc -Idummy -vv rtp://@127.0.0.1:1234 --sout="#stat"
> > without this patch the rtp input constantly complains about trunced
> > input and doesn't adjust the receiving amount.
> I would add 'const', and maybe clarify the description because it took me some
> time to figure out what the problem and solution was here.
Thanks, I reworded the description.
> But looks OK.
> > ---
> > modules/access/rtp/input.c | 18 +++++++++---------
> > 1 file changed, 9 insertions(+), 9 deletions(-)
> > diff --git a/modules/access/rtp/input.c b/modules/access/rtp/input.c
> > index f22f6655ab..be23e3b3e6 100644
> > --- a/modules/access/rtp/input.c
> > +++ b/modules/access/rtp/input.c
> > @@ -109,6 +109,12 @@ void *rtp_dgram_thread (void *opaque)
> > demux_sys_t *sys = demux->p_sys;
> > vlc_tick_t deadline = VLC_TICK_INVALID;
> > int rtp_fd = sys->fd;
> > +#ifdef __linux__
> > + int trunc_flag = MSG_TRUNC;
> > +#else
> > + int trunc_flag = 0;
> > +#endif
> > +
> > struct iovec iov =
> > {
> > .iov_len = DEFAULT_MRU,
> > @@ -149,17 +155,12 @@ void *rtp_dgram_thread (void *opaque)
> > }
> > iov.iov_base = block->p_buffer;
> > -#ifdef __linux__
> > - msg.msg_flags = MSG_TRUNC;
> > -#else
> > - msg.msg_flags = 0;
> > -#endif
> > + msg.msg_flags = trunc_flag;
> > - ssize_t len = recvmsg (rtp_fd, &msg, 0);
> > + ssize_t len = recvmsg (rtp_fd, &msg, trunc_flag);
> > if (len != -1)
> > {
> > -#ifdef MSG_TRUNC
> > - if (msg.msg_flags & MSG_TRUNC)
> > + if (msg.msg_flags & trunc_flag )
> > {
> > msg_Err(demux, "%zd bytes packet truncated (MRU was
> > %zu)", len, iov.iov_len);
> > @@ -167,7 +168,6 @@ void *rtp_dgram_thread (void *opaque)
> > iov.iov_len = len;
> > }
> > else
> > -#endif
> > block->i_buffer = len;
> > rtp_process (demux, block);
--
Ilkka Ollakka
The number of computer scientists in a room is inversely proportional
to the number of bugs in their code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20181015/4d9028cd/attachment.sig>
More information about the vlc-devel
mailing list