Commit 88044af255 for ffmpeg
commit 88044af255608e9d05f478c1e148e9f9c9cc45de
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Fri Dec 4 18:42:07 2026 +0100
avformat/dashdec: pick the Period of each manifest
A Period of a refreshed manifest was only picked when it was at least as
long as the Period of the manifest before. Once that Period had left the
manifest and the next one was shorter, every refresh failed for a missing
Period.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index d0b098f5fc..0f34ee5989 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1456,6 +1456,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
// at now we can handle only one period, with the longest duration
int64_t period_end = 0;
+ int64_t longest_duration = 0;
node = xmlFirstElementChild(node);
while (node) {
if (!av_strcasecmp(node->name, "Period")) {
@@ -1481,9 +1482,9 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
period_duration = c->is_live ? 0 :
FFMAX(get_period_end(s, node) - period_start, 0);
period_end = av_sat_add64(period_start, period_duration);
- if (period_duration >= c->period_duration) {
+ if (period_duration >= longest_duration) {
period_node = node;
- c->period_duration = period_duration;
+ longest_duration = period_duration;
}
} else if (!av_strcasecmp(node->name, "ProgramInformation")) {
parse_programinformation(s, node);
@@ -1495,6 +1496,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
ret = AVERROR_INVALIDDATA;
goto cleanup;
}
+ c->period_duration = longest_duration;
adaptionset_node = xmlFirstElementChild(period_node);
while (adaptionset_node) {