Skip to content

Commit

Permalink
write 0 sized entries in metadata track to ensure sync
Browse files Browse the repository at this point in the history
  • Loading branch information
mraduldubey committed Aug 9, 2023
1 parent 0990cd8 commit be8ce5e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions base/src/Mp4WriterSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,11 @@ bool DetailH264::write(frame_container& frames)

mp4_mux_track_add_sample(mux, videotrack, &mux_sample);

if (metatrack != -1 && mMetadataEnabled && inMp4MetaFrame.get())
if (metatrack != -1 && mMetadataEnabled)
{
if (inMp4MetaFrame->size())
// null check must happen here to ensure 0 sized entries in mp4 metadata track's stsz table
// this will ensure equal entries in metadata and video tracks
if (inMp4MetaFrame.get() && inMp4MetaFrame->size())
{
mux_sample.buffer = static_cast<uint8_t*>(inMp4MetaFrame->data());
mux_sample.len = inMp4MetaFrame->size();
Expand Down

0 comments on commit be8ce5e

Please sign in to comment.