applehttp: Don't export variant_bitrate if it isn't known
authorMartin Storsjö <martin@martin.st>
Sun, 24 Apr 2011 17:19:49 +0000 (20:19 +0300)
committerMartin Storsjö <martin@martin.st>
Sun, 24 Apr 2011 18:30:03 +0000 (21:30 +0300)
If there are no variants, the total bitrate of the single
stream isn't known, and exporting variant_bitrate = 0 does
look weird, since there really aren't any variants.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/applehttp.c

index 2e0e8a1b3ad988e81d041f9935b11770ec9dab27..822d80bb000452c66ba0214e51be93e1acc584fb 100644 (file)
@@ -505,7 +505,9 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
                 goto fail;
             }
             avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
                 goto fail;
             }
             avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
-            av_metadata_set2(&st->metadata, "variant_bitrate", bitrate_str, 0);
+            if (v->bandwidth)
+                av_metadata_set2(&st->metadata, "variant_bitrate", bitrate_str,
+                                 0);
         }
         stream_offset += v->ctx->nb_streams;
     }
         }
         stream_offset += v->ctx->nb_streams;
     }