[FFmpeg-devel] Fix for poor bandwidth usage on Windows

Michael Niedermayer michaelni at gmx.at
Fri Oct 5 21:45:51 CEST 2012


On Thu, Oct 04, 2012 at 06:47:12PM -0700, Farhad Roueintan wrote:
> Hi,
> We had noticed that when we streamed a video using ffmpeg we'd get
> much lower bitrates than what we expected based on our bandwidth. We
> did some investigation and tracked down the problem to the way
> ffmpeg's networking code calls send(). It was calling the function
> many times with small chunks of data (including lots of calls with 1
> byte, 8 bytes, etc.). This appears to be fine on Linux but on
> Windows this causes a significant slowdown due to the way the send()
> function behaves. To fix this we changed the ffmpeg RTMP code to
> buffer the data and only call send() when the buffer fills up (we
> use a 64K buffer). This improved the speed by over 10x. Our patch
> was specific to RTMP since that's the only thing we were using;
> however, you probably want to do this buffering in a more generic
> way at the TCP level.

Which line(s) of the rtmp code exactly cause these small packets ?

> I've attached the affected files. The buffering happens in the
> ff_buffered_urlwrite function in rtmppkt.c.

please see:


posting a complete file is useless, noone can see from it
what changes you made and noone can find these changes as noone
knows upon which revission you based your changes.


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121005/b977c328/attachment.asc>

More information about the ffmpeg-devel mailing list