I've been working with the built-in support in ffmpeg for rtmp (not librtmp, but the avformat rtmpproto/pkt implementation), and had a question about buffering: Currently the rtmp stream reading uses the default IO buffer size of 32768. Is it possible to reduce this to provide lower-latency on the rtmp read? Depending on the rtmp codec settings, anywhere from 5-20 packets will buffer up before being processed by ffmpeg, which usually translates to latency of 500-1000ms. Is this something that should be changed in rtmpproto.c (i.e. max_packet_size) or is there a way to set the max buffer size at the application level? Regards, Tom
Tom Janiszewski wrote:
I've been working with the built-in support in ffmpeg for rtmp (not librtmp, but the avformat rtmpproto/pkt implementation), and had a question about buffering: Currently the rtmp stream reading uses the default IO buffer size of 32768. Is it possible to reduce this to provide lower-latency on the rtmp read?
Depending on the rtmp codec settings, anywhere from 5-20 packets will buffer up before being processed by ffmpeg, which usually translates to latency of 500-1000ms. Is this something that should be changed in rtmpproto.c (i.e. max_packet_size) or is there a way to set the max buffer size at the application level?
It looks like IO_BUFFER_SIZE 32768 in aviobuf.c and max_packet_size are the only available settings. Mucking with max_packet_size would probably be a bad idea since RTMP packets can have widely varying sizes. Perhaps just change rtmp_read() to return at most 1 packet's worth of data at a time. -- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/
On Mon, May 24, 2010 at 11:02:00AM -0700, Howard Chu wrote:
Tom Janiszewski wrote:
I've been working with the built-in support in ffmpeg for rtmp (not librtmp, but the avformat rtmpproto/pkt implementation), and had a question about buffering: Currently the rtmp stream reading uses the default IO buffer size of 32768. Is it possible to reduce this to provide lower-latency on the rtmp read?
Depending on the rtmp codec settings, anywhere from 5-20 packets will buffer up before being processed by ffmpeg, which usually translates to latency of 500-1000ms. Is this something that should be changed in rtmpproto.c (i.e. max_packet_size) or is there a way to set the max buffer size at the application level?
It looks like IO_BUFFER_SIZE 32768 in aviobuf.c and max_packet_size are the only available settings. Mucking with max_packet_size would probably be a bad idea since RTMP packets can have widely varying sizes.
Perhaps just change rtmp_read() to return at most 1 packet's worth of data at a time.
returning only the available packet instead of blocking and filling the whole buffer sounds like the correct solution [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein
Hi, On Mon, May 24, 2010 at 1:45 PM, Tom Janiszewski <Tom.Janiszewski at alcatel-lucent.com> wrote:
Depending on the rtmp codec settings, anywhere from 5-20 packets will buffer up before being processed by ffmpeg, which usually translates to latency of 500-1000ms. ?Is this something that should be changed in rtmpproto.c (i.e. max_packet_size) or is there a way to set the max buffer size at the application level?
There isn't yet, but a patch to rtmp.c would be acceptable. Come to IRC if you need help on what to change to what exactly, and then after changing and testing I can apply to SVN trunk. Ronald
participants (4)
-
hyc@highlandsun.com -
michaelni@gmx.at -
rsbultje@gmail.com -
Tom.Janiszewski@alcatel-lucent.com