Streaming/Transcode broken when input TS stream has multiple AUD into each PES
Hi,
I have a stream which cannot be streamed nor transcoded.
vlc -I dummy file.ts --sout '#std{access=file,mux=ts,dst=/dev/null}' -vv
[0x7fb35c0024d8] main input debug: Stream buffering done (1015 ms in 2 ms)
[0x7fb35c0024d8] main input debug: Decoder buffering done in 0 ms
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
[0x6a7d68] main stream output warning: trying to send non-dated packet to stream output!
(reproduced with vlc-git)
After some investigations it seems to be related to the fact that each PES looks like this :
AUD
SEI
SLICE
AUD
SEI
SLICE
The h264 packetizer assumes that each time it sees an AUD it can flush the previous PTS/DTS :
modules/packetizer/packetizer_helper.h :
p_pic = p_pack->pf_parse( p_pack->p_private, &b_used_ts, p_pic );
if( b_used_ts )
{
p_block_bytestream->i_dts = VLC_TS_INVALID;
p_block_bytestream->i_pts = VLC_TS_INVALID;
}
In my case, the PTS/DTS of the PES is stored and used when outputing the first AUD/SEI/SLICE but the next AUD/SEI/SLICE of the same PES will have no PTS/DTS (thus the warning).
libavcodec handles that correctly (the PES is split into two packet of 20ms (it's interlaced material at 25fps)).
I'm attaching a sample of the stream to this ticket.