buildroot/package/bento4/0010-Dazn-sample-duration-w...

31 lines
1.2 KiB
Diff

From 10f931c703c68b4fc856e09788dfe64579252bb8 Mon Sep 17 00:00:00 2001
From: peak3d <pfau@peak3d.de>
Date: Thu, 22 Jul 2021 10:48:36 +0200
Subject: [PATCH] Dazn sample duration workaround
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
Source/C++/Core/Ap4TrunAtom.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Source/C++/Core/Ap4TrunAtom.cpp b/Source/C++/Core/Ap4TrunAtom.cpp
index c51f21d..77b7c6d 100644
--- a/Source/C++/Core/Ap4TrunAtom.cpp
+++ b/Source/C++/Core/Ap4TrunAtom.cpp
@@ -128,6 +128,12 @@ AP4_TrunAtom::AP4_TrunAtom(AP4_UI32 size,
for (unsigned int i=0; i<sample_count; i++) {
if (flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT) {
stream.ReadUI32(m_Entries[i].sample_duration);
+ // Workaround for dazn streams, which provide 24 -> 1 sequences
+ if (i && m_Entries[i].sample_duration == 1 && m_Entries[i - 1].sample_duration > 1)
+ {
+ m_Entries[i].sample_duration = m_Entries[i - 1].sample_duration >> 1;
+ m_Entries[i - 1].sample_duration -= m_Entries[i].sample_duration;
+ }
--record_fields_count;
}
if (flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT) {
--
2.30.2