From c487972ed0e1eaebdbe4a13cdd191e119be0b19c Mon Sep 17 00:00:00 2001
From: Mika Raento <mika.raento@elisa.fi>
Date: Wed, 3 Sep 2014 09:13:46 +0300
Subject: [PATCH] ismindex: recover from completely empty streams
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This creates best-effort results from input that is missing stream
contents, there are warnings printed when this happens.

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 tools/ismindex.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/ismindex.c b/tools/ismindex.c
index f49916ae038..a6a9763beb7 100644
--- a/tools/ismindex.c
+++ b/tools/ismindex.c
@@ -325,6 +325,12 @@ static int handle_file(struct Tracks *tracks, const char *file, int split,
     for (i = 0; i < ctx->nb_streams; i++) {
         struct Track **temp;
         AVStream *st = ctx->streams[i];
+
+        if (st->codec->bit_rate == 0) {
+            fprintf(stderr, "Skipping track %d in %s as it has zero bitrate\n", i, file);
+            continue;
+        }
+
         track = av_mallocz(sizeof(*track));
         if (!track) {
             err = AVERROR(ENOMEM);
-- 
GitLab