[FFmpeg-devel] [PATCH/RFC] Detecting EOF in RTMP

Kostya kostya.shishkov
Thu Dec 10 16:23:03 CET 2009

On Thu, Dec 10, 2009 at 04:37:59PM +0200, Martin Storsj? wrote:
> Hi,
> I tried out the new and fancy RTMP support recently, against a slightly 
> customized Wowza setup.
> When the live broadcast ends, the current rtmp protocol handler doesn't 
> detect this as an eof, and thus sits and waits for more data on the 
> connection.

Looks like Wowza does not follow RTMP standards :(.
> When the broadcast is terminated, the last packet either contains a single 
> NetStream.Publish.UnpublishNotify status, or sometimes it contains a 
> series of four status codes:
> NetStream.Publish.UnpublishNotify
> NetStream.Play.Stop
> NetStream.Play.Reset
> NetStream.Play.Start

I think one of RTMP streams I encountered sent UnpublishNotify right at
the beginning (possibly indicating that stream is empty), so it could be

> The attached patch is an attempt at fixing this case. The if clause in 
> rtmp_parse_result is needed since the packet that contained 
> UnpublishNotify also could contain a new Start status code.
> On the other hand, that particular behaviour (sending a new Start code 
> even if no more data is sent) perhaps should be regarded as a server 
> misbehaviour? But I think at least the single UnpublishNotify should 
> trigger an eof in some way.

Yes, it should trigger EOF - return AVERROR(EOF) instead of 0 in
> Kostya, what do you think about this approach? How is the eof condition 
> handled in other setups?
> // Martin

More information about the ffmpeg-devel mailing list