From 6d21a24a424b85837b3d3eeb49a68330f9bd8aea Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 24 Sep 2017 23:06:03 +0200 Subject: [PATCH] Opus output: give frames with discard padding their own BlockGroup Fixes #2100. --- NEWS.md | 2 ++ src/merge/cluster_helper.cpp | 5 ++++- src/merge/private/cluster_helper.h | 3 ++- tests/results.txt | 1 + tests/test-615opus_discard_padding_in_the_middle.rb | 5 +++++ 5 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 tests/test-615opus_discard_padding_in_the_middle.rb diff --git a/NEWS.md b/NEWS.md index 665701ec4..bd2048c79 100644 --- a/NEWS.md +++ b/NEWS.md @@ -25,6 +25,8 @@ coordinate x" and "white colour coordinate y" in the output file. * MKVToolNix GUI: header editor: removed the check for external modification when saving the file. Fixes #2097. +* mkvmerge: Opus output: mkvmerge will now put all frames with discard padding + into their own block group. Fixes #2100. ## Build system changes diff --git a/src/merge/cluster_helper.cpp b/src/merge/cluster_helper.cpp index 52a21b2f4..dc85c267a 100644 --- a/src/merge/cluster_helper.cpp +++ b/src/merge/cluster_helper.cpp @@ -444,6 +444,7 @@ cluster_helper_c::render() { || !pack->is_key_frame() || has_codec_state || pack->has_discard_padding() + || render_group->m_has_discard_padding || must_duration_be_set(nullptr, pack) || source->is_lacing_prevented(); @@ -521,8 +522,10 @@ cluster_helper_c::render() { } } - if (pack->has_discard_padding()) + if (pack->has_discard_padding()) { GetChild(*new_block_group).SetValue(pack->discard_padding.to_ns()); + render_group->m_has_discard_padding = true; + } } elements_in_cluster++; diff --git a/src/merge/private/cluster_helper.h b/src/merge/private/cluster_helper.h index 2ea123f45..dded445b8 100644 --- a/src/merge/private/cluster_helper.h +++ b/src/merge/private/cluster_helper.h @@ -22,12 +22,13 @@ public: std::vector m_groups; std::vector m_durations; generic_packetizer_c *m_source; - bool m_more_data, m_duration_mandatory; + bool m_more_data, m_duration_mandatory, m_has_discard_padding; render_groups_c(generic_packetizer_c *source) : m_source(source) , m_more_data(false) , m_duration_mandatory(false) + , m_has_discard_padding{} { } }; diff --git a/tests/results.txt b/tests/results.txt index 73280a9e3..e5db64bff 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -460,3 +460,4 @@ T_611info_null_pointer_dereference_for_ebmlbinary:eaaec943902f1aea38ba3c85c58794 T_612dts_provided_timestamp_used_too_early:ae879a711c571394195ec4dcd2a6a6a3:passed:20170813-175153:0.010423057 T_613vorbis_in_mp4:bcf052d24ed82ff0de57425259d075db:passed:20170910-175618:0.014743465 T_614white_colour_coordinates_from_mkv:916ae39f45a435c0b526d875c378e199-916ae39f45a435c0b526d875c378e199:passed:20170916-112249:0.094985684 +T_615opus_discard_padding_in_the_middle:1b2e18413bab72c0d669a406fc403b38:passed:20170924-230527:0.025602623 diff --git a/tests/test-615opus_discard_padding_in_the_middle.rb b/tests/test-615opus_discard_padding_in_the_middle.rb new file mode 100755 index 000000000..d9aa24a72 --- /dev/null +++ b/tests/test-615opus_discard_padding_in_the_middle.rb @@ -0,0 +1,5 @@ +#!/usr/bin/ruby -w + +# T_615opus_discard_padding_in_the_middle +describe "mkvmerge / Opus with frames with discard padding in the middle" +test_merge "data/opus/discard-padding-in-the-middle.opus"