AV1 packetizer: set frame durations

If no duration is set and a file is appended, the first in file N+1
will have the same timestamp as the last frame in file N.

Fixes #2937.
This commit is contained in:
Moritz Bunkus 2020-10-01 12:50:03 +02:00
parent 926301bfd4
commit 84d294aa6f
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
5 changed files with 18 additions and 5 deletions

View File

@ -47,6 +47,9 @@
error due to certain data conditions. Found by fuzzying.
* mkvmerge, mkvinfo, mkvextract, mkvpropedit: Matroska access class: fixed an
invalid memory access under certain data conditions. Found by fuzzying.
* mkvmerge: AV1 packetizer: the duration of frames wasn't set properly. When
appending AV1 IVF or OBU files this meant that the last frame of the Nth
file and the first frame of file N+1 had the same timestamp. Fixes #2937.
## Build system changes

View File

@ -129,9 +129,10 @@ av1_video_packetizer_c::flush_frames() {
while (m_parser.frame_available()) {
auto frame = m_parser.get_next_frame();
auto bref = frame.is_keyframe ? -1 : m_previous_timestamp;
auto duration = m_htrack_default_duration > 0 ? m_htrack_default_duration : -1;
m_previous_timestamp = frame.timestamp;
add_packet(std::make_shared<packet_t>(frame.mem, frame.timestamp, -1, bref));
add_packet(std::make_shared<packet_t>(frame.mem, frame.timestamp, duration, bref));
}
}

View File

@ -483,7 +483,7 @@ T_634dialog_normalization_gain_removal:3d6dbda1833badeedefdf19f7779d8b7-d2731d66
T_635propedit_update_doc_type_version:95b1ca52eb9e2d331b978a827c53b69b-4+1-4+1:passed:20180310-135142:0.138196579
T_636flac_with_id3_tags:f27a3d9f611aff0875d0a2bde2be9167:passed:20180310-182917:0.204964643
T_637mp4_8_channels_in_track_headers_but_7_in_codec_specific_config:true:passed:20180322-222201:0.012853536
T_638av1_ivf_webm:cd902152d002926730686ac5b3e1d8bc-592b819fc6952fdba2a49d760597b0ad-aeb4ba5a97f001bd9191c4eb43444237-da5d532c635c2f9293a8eabe3472a20b-ff10f999f9977493d60a34646bf43174-05cbd562555cf1e130e83b182be7dc2d:passed:20180401-164905:0.057717643
T_638av1_ivf_webm:14c969917e48be90e9b33be3f82ab1a3-592b819fc6952fdba2a49d760597b0ad-aeb4ba5a97f001bd9191c4eb43444237-9764c6cd8cfaca90cbb1fae3f6965df3-ff10f999f9977493d60a34646bf43174-05cbd562555cf1e130e83b182be7dc2d:passed:20180401-164905:0.057717643
T_639vobsub_missing_duration_in_matroska:e27f81c9739a701e4b7b3bc850750014:passed:20180401-193013:0.014669303
T_640no_date:a178a9c785873c2759ea8380e55ca105:passed:20180427-231324:0.011724657
T_641keep_display_unit:ff45d7070bdf57db30171ee6550f8a17-3+16x9-f35abe281ef86eef2ac1c167dabc318f-0+123x456:passed:20180609-123022:0.062045824
@ -503,8 +503,8 @@ T_654text_subtitles_without_duration:13fd731a8702c93b6be46d7c3af45f66:passed:201
T_655mpeg_ts_teletext_subs_long_gap_until_end_of_display:f0c1c0c2b7b11cfb9855c4d6786691da:passed:20181005-212927:0.513727609
T_656mpeg_ts_bad_utf8_in_service_names2:544606778297772ea61146bdbd8f1186:passed:20181006-122753:0.020246407
T_657av1_from_mp4:7d92a1dfebf450fd4f8872af8f085879:passed:20181007-220646:0.040201275
T_658X_av1:20347e54bac4d1b0fe82d1f2f6c17c4d+785df0554ac215ec607e5a9328122f63:passed:20181007-225807:0.019174721
T_659av1_timing_info_in_bitstream:c4ab8e621a7b41b548f37155ce2c0b2c-a056dec552558d665baba83b0167c5e3:passed:20181007-235434:0.016544501
T_658X_av1:20347e54bac4d1b0fe82d1f2f6c17c4d-3eaa76c492f92b87787fa48bebafbf6b:passed:20181007-225807:0.019174721
T_659av1_timing_info_in_bitstream:e9488f53e9aa5863bf7c1524dd0b6b00-74682cfc5565c906a2f4c90324d78150:passed:20181007-235434:0.016544501
T_660propedit_replace_one_byte_with_ebmlvoid_all_surrounding_elements_coded_size_length_8:a16d7aa5d00d120d20c4c3c718e1b00b:passed:20181020-160502:0.0
T_661av1_in_matroska_by_mkvmerge_28_0_0:523ebf22a1a7cb3ae41126f7df3a9854:passed:20181021-225056:0.008359871
T_662cisco_talos_2018_0694:2bacc50e6e28fb2a92d2abf2583405f5:passed:20181025-215511:0.024040919
@ -556,3 +556,4 @@ T_707bcp47_mkvmerge_chapters_disable_language_ietf:2a2202254f1e426484151e9299f83
T_708bcp47_propedit_language_ietf_disable_language_ietf:d80d696e8045ebf157d31db09142307c-und+und+ok+ger+und+ok+ger+pt_BR+ok+spa+pt_BR+ok+eng+pt_BR+ok+eng++ok:passed:20200829-103838:0.0
T_709bcp47_mkvmerge_tags:9208217d36fa9368be5a44b239286424:passed:20200903-234135:0.0
T_710fuzzying:ok-ok-ok-ok-ok-ok-ok-ok-ok-ok:passed:20200921-133156:0.059249045
T_711av1_last_frame_duration_when_appending:a19352e35a535cbefc8e126fac8a0246-ad1b56c56820bb291a1ccbf30ea7479a:new:20201001-124823:0

View File

@ -7,5 +7,5 @@ test "extraction to IVF" do
extract "data/av1/av1.webm", 0 => "#{tmp}-1"
merge "#{tmp}-1", :output => "#{tmp}-2"
(1..2).map { |idx| hash_file("#{tmp}-#{idx}") }.join('+')
(1..2).map { |idx| hash_file("#{tmp}-#{idx}") }.join('-')
end

View File

@ -0,0 +1,8 @@
#!/usr/bin/ruby -w
# T_711av1_last_frame_duration_when_appending
describe "mkvmerge / AV1 frame durations & appending"
%w{ivf obu}.each do |ext|
test_merge((1..4).map { |idx| "data/av1/parts/v-00#{idx}.#{ext}" }.join(' + '))
end