Skip to content

Last coded block lost in packetizer

Packetizers cache the input block and give it back on the next call:

pf_packetize(1) = NULL;
pf_packetize(2) = 1;
pf_packetize(3) = 2;
/* block 3 is lost */

This can be noticed when playing audio (last packet is missing), or when muxing videos (the last frame is lost, frame count is reduced by 1).

21:00 < funman> i think the block should be returned immediately if it's a valid packet
21:01 < funman> why ? you don't need the next block to know if the previous one is valid
21:01 < nefrir> funman: for video, yes you need it
21:02 < nefrir> funman: nope, with mpeg 2 for instance, you now that you reach the end only when you see the next picture start code
21:02 < nefrir> same with mpeg 4 ASP and AVC(h264)
21:05 < nefrir> it's not that easy to fix, but I think that calling pf_packetizer(NULL) would be the right solution
21:05 < nefrir> and of course the packetizers need to be updated to handle that case

Note that for packetizer_copy this is a bit trickier: the length of blocks isn't known in input, and is computed by length(block[N]) = pts(block[N+1]) - pts(block[N]), so the length of the last block would be unknown.

That might point to broken demuxers though.

Edited by Rafaël Carré
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information