Hi,
d3fault wrote:
When receiving an RTP stream (by giving an SDP file to av_open_input_file),
libav blocks in two places and at two different times. The first place is
when you call av_find_stream_info and there is nothing being streamed yet.
The call just waits until the streaming begins before continuing, which
makes sense. The second place it hangs is if you've been receiving some data
but then the transmission has halted, av_read_frame blocks.... which also
makes sense. This call just waits indefinitely until I kill the app. My
question is: what is the proper way to stop receiving an RTP transmission?
Well, the proper way would be to implement support for the RTCP "bye"
packet (when receiving an RTCP "bye", the SDP demuxer should report EOF).
A quick hack I use in my application is to implement a timeout (which is
stopped and reset to a maximum value every time a frame is received) at
application level. When such timeout fires, it means that the input
stream stopped... So, it calls stop_input() defined as follows:
static int stopme(void)
{
return 1;
}
void stop_input(void)
{
url_set_interrupt_cb(stopme);
}
It's ugly, but it works.
Tangent: In my current setup I am recording the RTP transmission, but the
resulting file is corrupt since av_write_trailer is never called (I can't
think of any other reason why it would be corrupt). Am I supposed to call
av_write_trailer after each successful call to av_write_frame, since I won't
know when the transmission will end?
I think this would generate invalid files... AFAIK av_write_trailer()
should be called only one time, when closing the output stream.
Luca
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user