libavformat/movenc.c:2722: error: Uninitialized Value
  The value read from duration was never initialized.

libavformat/movenc.c:2722:9: 
2720.         }
2721.         avio_wb32(pb, (0 << 31) | (ref_size & 0x7fffffff)); /* reference_type (0 = media) | referenced_size */
2722.         avio_wb32(pb, duration); /* subsegment_duration */
              ^
2723.         avio_wb32(pb, (starts_with_SAP << 31) | (0 << 28) | 0); /* starts_with_SAP | SAP_type | SAP_delta_time */
2724.     }

static int mov_write_sidx_tag(AVIOContext *pb,
                              MOVTrack *track, int ref_size, int total_sidx_size)
{
    int64_t pos = avio_tell(pb), offset_pos, end_pos;
    int64_t presentation_time, duration, offset;
    int starts_with_SAP, i, entries;
    if (track->entry) {
        entries = 1;
        presentation_time = track->start_dts + track->frag_start +
                            track->cluster[0].cts;
        duration = track->start_dts + track->track_duration -
                   track->cluster[0].dts;
        starts_with_SAP = track->cluster[0].flags & MOV_SYNC_SAMPLE;
    } else {
        entries = track->nb_frag_info;
        presentation_time = track->frag_info[0].time;
    }
    if (presentation_time < 0)
        presentation_time = 0;
    avio_wb32(pb, 0);
    ffio_wfourcc(pb, "sidx");
    avio_w8(pb, 1);
    avio_wb24(pb, 0);
    avio_wb32(pb, track->track_id);
    avio_wb32(pb, track->timescale);
    avio_wb64(pb, presentation_time);
    offset_pos = avio_tell(pb);
    avio_wb64(pb, 0);
    avio_wb16(pb, 0);
    avio_wb16(pb, entries);
    for (i = 0; i < entries; i++) {
        if (!track->entry) {
            if (i > 1 && track->frag_info[i].offset != track->frag_info[i - 1].offset + track->frag_info[i - 1].size) {
               av_log(NULL, AV_LOG_ERROR, "Non-consecutive fragments, writing incorrect sidx\n");
            }
            duration = track->frag_info[i].duration;
            ref_size = track->frag_info[i].size;
            starts_with_SAP = 1;
        }
        avio_wb32(pb, (0 << 31) | (ref_size & 0x7fffffff));
        avio_wb32(pb, duration);
        avio_wb32(pb, (starts_with_SAP << 31) | (0 << 28) | 0);
    }
    end_pos = avio_tell(pb);
    offset = pos + total_sidx_size - end_pos;
    avio_seek(pb, offset_pos, SEEK_SET);
    avio_wb64(pb, offset);
    avio_seek(pb, end_pos, SEEK_SET);
    return update_size(pb, pos);
}
['static int mov_write_sidx_tag(AVIOContext *pb,\n                              MOVTrack *track, int ref_size, int total_sidx_size)\n{\n    int64_t pos = avio_tell(pb), offset_pos, end_pos;\n    int64_t presentation_time, duration, offset;\n    int starts_with_SAP, i, entries;\n    if (track->entry) {\n        entries = 1;\n        presentation_time = track->start_dts + track->frag_start +\n                            track->cluster[0].cts;\n        duration = track->start_dts + track->track_duration -\n                   track->cluster[0].dts;\n        starts_with_SAP = track->cluster[0].flags & MOV_SYNC_SAMPLE;\n    } else {\n        entries = track->nb_frag_info;\n        presentation_time = track->frag_info[0].time;\n    }\n    if (presentation_time < 0)\n        presentation_time = 0;\n    avio_wb32(pb, 0);\n    ffio_wfourcc(pb, "sidx");\n    avio_w8(pb, 1);\n    avio_wb24(pb, 0);\n    avio_wb32(pb, track->track_id);\n    avio_wb32(pb, track->timescale);\n    avio_wb64(pb, presentation_time);\n    offset_pos = avio_tell(pb);\n    avio_wb64(pb, 0);\n    avio_wb16(pb, 0);\n    avio_wb16(pb, entries);\n    for (i = 0; i < entries; i++) {\n        if (!track->entry) {\n            if (i > 1 && track->frag_info[i].offset != track->frag_info[i - 1].offset + track->frag_info[i - 1].size) {\n               av_log(NULL, AV_LOG_ERROR, "Non-consecutive fragments, writing incorrect sidx\\n");\n            }\n            duration = track->frag_info[i].duration;\n            ref_size = track->frag_info[i].size;\n            starts_with_SAP = 1;\n        }\n        avio_wb32(pb, (0 << 31) | (ref_size & 0x7fffffff));\n        avio_wb32(pb, duration);\n        avio_wb32(pb, (starts_with_SAP << 31) | (0 << 28) | 0);\n    }\n    end_pos = avio_tell(pb);\n    offset = pos + total_sidx_size - end_pos;\n    avio_seek(pb, offset_pos, SEEK_SET);\n    avio_wb64(pb, offset);\n    avio_seek(pb, end_pos, SEEK_SET);\n    return update_size(pb, pos);\n}']