Commit 5c9210cd47 for ffmpeg
commit 5c9210cd4784291ffa5ec4b9ad38dbdd333d3624
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Tue Oct 27 06:04:13 2026 +0100
avformat/dashdec: factor out the check whether a representation is needed
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 4635df4cb2..5f5ffa286a 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -2421,16 +2421,23 @@ static int dash_read_header(AVFormatContext *s)
return 0;
}
+static int representation_needed(const struct representation *pls)
+{
+ int needed = !pls->nb_assoc_stream;
+
+ for (int j = 0; j < pls->nb_assoc_stream; j++)
+ needed |= pls->assoc_stream[j]->discard < AVDISCARD_ALL;
+
+ return needed;
+}
+
static void recheck_discard_flags(AVFormatContext *s, struct representation **p, int n)
{
int i, j;
for (i = 0; i < n; i++) {
struct representation *pls = p[i];
- int needed = !pls->nb_assoc_stream;
-
- for (int j = 0; j < pls->nb_assoc_stream; j++)
- needed |= pls->assoc_stream[j]->discard < AVDISCARD_ALL;
+ int needed = representation_needed(pls);
if (needed && !pls->ctx) {
pls->cur_seg_offset = 0;