aviobuf: Handle a NULL buffer in avio_close_dyn_buf

This simplifies proper error handling in rtsp.c/rtspdec.c. When
broadcasting over RTSP in TCP mode, the AVIOContext is closed and
recreated for each sent packet, and if the recreation fails, we might
try to close a NULL buffer when freeing things at the end.

Previously, if recreating the buffer in rtspdec.c failed, this would
crash later due to trying to close a NULL buffer.

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpenc: Remove some superfluous parentheses

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpenc: Add a rtpflag option for sending BYE packets when finishing

Signed-off-by: Martin Storsjö <martin@martin.st>
rtspenc: Make sure BYE packets are sent before TEARDOWN

Also make sure the BYE packets are sent at all when using
TCP interleaved transport.

Signed-off-by: Martin Storsjö <martin@martin.st>