mkvtoolnix/tests/test-523mpeg_ts_pes_size_0.rb
Moritz Bunkus f4fbf0c591 MPEG TS: simplify "send to packetizer" logic; drop incomplete packets; handle unknown-sized packets
The old logic was so complex (even within parse_start_unit_packet()
there were two or three places were data was sent to the packetizer)
that it had to be simplified a lot. The new logic knows only three
cases:

1. When parsing a normal packet then data is sent to the packetizer if
   and only if the expected PES size is known (!= 0) and the accumulated
   PES data's size equals the expected PES size.

2. When parsing a "start unit" packet then there are two cases:

2.a. If the previous unit's expected PES size is unknown ( == 0) then
     all data gathered so far is sent to the packetizer.

2.b. Otherwise (the expected PES size is known) the packet must be too
     short or too large. Otherwise it would have been sent to the
     packetizer in case 1. already.

On top the packet's data is cleared in both "send_to_packetizer()" and
in "probe_packet_complete()", the two functions that handle complete
packets in the muxing phase ("send_to_packetizer()") respectively
probing phase ("probe_packet_complete()").

Fixes #1553.
2015-12-30 22:23:53 +01:00

9 lines
223 B
Ruby
Executable File

#!/usr/bin/ruby -w
file = "data/ts/pes_size_0.ts"
# T_523mpeg_ts_pes_size_0
describe "mkvmerge / MPEG TS with a video track with all packets having a PES size of 0"
test_merge file, exit_code: :warning
test_identify file