From f95c24e5b4896ca9293612618c951a1fe381493a Mon Sep 17 00:00:00 2001 From: "lee.fordyce" Date: Mon, 6 Nov 2023 12:23:50 -0700 Subject: [PATCH] Additional comments for multiple init segment callbacks. --- packager/live_packager.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packager/live_packager.cc b/packager/live_packager.cc index 9d751b1d7d6..dd5bd2a78fc 100644 --- a/packager/live_packager.cc +++ b/packager/live_packager.cc @@ -153,8 +153,12 @@ Status LivePackager::Package(const Segment &in, FullSegmentBuffer &out) { init_callback_params.write_func = [&out](const std::string &name, const void *data, uint64_t size) { - // TODO: this gets called more than once, why? - // TODO: this is a workaround to write this only once + // For live packaging it is observed that the init segment callback is + // invoked more than once. The initial callback does not contain the MEHD + // box data and furthermore does not contain fragment duration. + // If an MP4 file is created in real-time, such as used in live-streaming, + // it is not likely that the fragment_duration is known in advance and this + // box may be omitted. if(out.InitSegmentSize() == 0) { out.SetInitSegment(reinterpret_cast(data), size); }