diff mbox

[FFmpeg-devel] avformat/movenc : Don't write sidx for empty urls

Message ID 20181128144011.95972-1-kjeyapal@akamai.com
State Superseded
Headers show

Commit Message

Jeyapal, Karthick Nov. 28, 2018, 2:40 p.m. UTC
When movenc is used by other segmenting muxers such as dashenc, url field is always empty.
In such cases it is better to not write sidx, instead of throwing errors.
---
 libavformat/movenc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Moritz Barsnick Nov. 28, 2018, 2:48 p.m. UTC | #1
On Wed, Nov 28, 2018 at 20:10:11 +0530, Karthick J wrote:
> +            // If url is an empty string("") don't write sidx atom.
> +            if (s->url[0] == '\0')
> +                return res;

Probably clearer if you return 0, as res hasn't been assigned anything
up to this point, except its initial 0.

Moritz
Jeyapal, Karthick Nov. 28, 2018, 4:17 p.m. UTC | #2
>On 11/28/18, 8:19 PM, "Moritz Barsnick" <barsnick@gmx.net> wrote:

>

>On Wed, Nov 28, 2018 at 20:10:11 +0530, Karthick J wrote:

>> +            // If url is an empty string("") don't write sidx atom.

>> +            if (s->url[0] == '\0')

>> +                return res;

>

>Probably clearer if you return 0, as res hasn't been assigned anything

>up to this point, except its initial 0.

Makes sense. Sent PATCH v2 with this change.

Regards,
Karthick
>

>Moritz
diff mbox

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6dab5193b0..150a505a4a 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6706,6 +6706,9 @@  static int mov_write_trailer(AVFormatContext *s)
            mov->tracks[i].data_offset = 0;
         if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) {
             int64_t end;
+            // If url is an empty string("") don't write sidx atom.
+            if (s->url[0] == '\0')
+                return res;
             av_log(s, AV_LOG_INFO, "Starting second pass: inserting sidx atoms\n");
             res = shift_data(s);
             if (res < 0)