I am writing an application capturing the live MPEG2 Transport Stream from a
DVB-S device and saving its parts to files according to user defined
schedule. 
It must run forever as a daemon.
The main cycle is the following

AVFormatContext *input;

av_open_input_file(&input,"/dev/asirx0", ... ); // /dev/asirx0 is the device
node
av_find_stream_info( ... )

while(!is_exiting()){
  AVPacket pkt;
  av_read_frame(&pkt)
  if( [pkt has to be saved] )
     av_write_frame( )
  av_free_packet(&pkt);
}

However, sometimes the application begins eating more and more RAM and
finally the system kills it.
No memory leaks according to Valgrind (I've found and fixed everything it
has detected).

I have added a code, showing the internal state of FFmpeg structures (input,
particularly).
The code also contains a function, showing the length of input ->
packet_buffer.
Here it is:

int get_av_packetlist_size(AVPacketList *pl)
{int sz;
 AVPacketList *p;

        for(p=pl,sz=0; p!=NULL; p=p->next, sz++)
                ;
        return sz;
}

The code also prints PTS and DTS of the packet buffer head.
Some excerpts of the output are shown here:
http://article.gmane.org/gmane.comp.video.ffmpeg.libav.user/580 

in my previous message to the list.
The situation repeats. Other PTS values of stuck packets were 
8 589 935 130
8 589 947 892
8 589 941 018

Whereas PTS = 8 494 381 415 was OK.

Today, before the packet with PTS = 8 589 941 018 has stuck, av_write_frame
has begun returning following errors: 

error, non monotone timestamps 8589928987 >= -2005
error, non monotone timestamps 8589928987 >= 1595
error, non monotone timestamps 8589928987 >= 8795

and many more similar with growing last number.

My impression is that PTS in the stream is somehow reflects the real time
and is reset to 0 once a day.
How to deal with this.
-- 
View this message in context: 
http://www.nabble.com/WHY--Why-frames-with-PTS-%3E-8%2C589%2C930%2C000-get-stuck-in-the-input-buffer-%21-tp17664697p17664697.html
Sent from the libav-users mailing list archive at Nabble.com.

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to