On Wed, 14 Jan 2015, Luca Barbato wrote:
On 14/01/15 21:28, Martin Storsjö wrote:
From: Michael Niedermayer <[email protected]>
This goto wasn't necessary originally, but adding it was missed
when the write_manifest call was added in 8e276378.
CC: [email protected]
---
libavformat/smoothstreamingenc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index ddd8da7..1db2dba 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -394,6 +394,7 @@ static int ism_write_header(AVFormatContext *s)
if (!c->has_video && c->min_frag_duration <= 0) {
av_log(s, AV_LOG_WARNING, "no video stream and no min frag duration
set\n");
ret = AVERROR(EINVAL);
+ goto fail;
}
ret = write_manifest(s, 0);
Not sure if you like better
```
diff --git a/libavformat/smoothstreamingenc.c
b/libavformat/smoothstreamingenc.c
index 137d8fd..0532e2d 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -387,8 +387,9 @@ static int ism_write_header(AVFormatContext *s)
if (!c->has_video && c->min_frag_duration <= 0) {
av_log(s, AV_LOG_WARNING, "no video stream and no min frag
duration set\n");
ret = AVERROR(EINVAL);
+ } else {
+ ret = write_manifest(s, 0);
}
- ret = write_manifest(s, 0);
fail:
if (ret)
```
While this also works, it has got pretty much the same risk as before,
that someone adds code after the if block, forgetting to add a goto fail
there. It also breaks the normal flow we have, to reduce indentation level
by not nesting too many ifs, but using goto fail for that.
// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel