[rtmpdump] rtmpdump buffering problems? and possible patch

Jon Davies jon at hedgerows.org.uk
Sat Feb 9 13:03:56 CET 2013


over on the get-iplayer mailing list we have some users who reported
errors downloading programmes with rtmpdump, e.g. this thread on
"Stream corrupt error and then rtmpdump goes nuts!"

http://lists.infradead.org/pipermail/get_iplayer/2012-December/003687.html

it seems that on fast broadband connections (typically fibre
connections at or approaching 80Mbps) the buffers in rtmpdump (and
probably the OS too) get overwhelmed and it all falls apart.

We ended up with the patch below as a workaround, which just makes the
buffers bigger, but I concede I don't really understand rtmpdump
enough (like not at all really, I just use it ;-) to know whether it's
really a solution to the problem or just a workaround.  So I offer
this with all the caveats you might be able to think of, but it works
for me (and several get-iplayer users).

I'm happy to put you in touch with people who suffer from this
particular problem if that helps.

Regards
Jon
-----------------

diff --git a/rtmpdump.c b/rtmpdump.c
index 13741a7..bc606a1 100644
--- a/rtmpdump.c
+++ b/rtmpdump.c
@@ -444,7 +444,7 @@ Download(RTMP * rtmp,		// connected RTMP object
 	 FILE * file, uint32_t dSeek, uint32_t dStopOffset, double duration,
int bResume, char *metaHeader, uint32_t nMetaHeaderSize, char
*initialFrame, int initialFrameType, uint32_t nInitialFrameSize, int
nSkipKeyFrames, int bStdoutMode, int bLiveStream, int bRealtimeStream,
int bHashes, int bOverrideBufferTime, uint32_t bufferTime, double
*percent)	// percentage downloaded [out]
 {
   int32_t now, lastUpdate;
-  int bufferSize = 64 * 1024;
+  int bufferSize = 64 * 4096;
   char *buffer;
   int nRead = 0;
   off_t size = ftello(file);


More information about the rtmpdump mailing list