Skip to content

Commit

Permalink
Merge pull request #15 from ittiam-systems/14-enc-box-init-fix
Browse files Browse the repository at this point in the history
MPEG-H Encoder fix #14
  • Loading branch information
SakethSathuvalli authored Jun 12, 2024
2 parents 526c975 + d43230f commit f5db502
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions test/impeghe_mp4_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,8 @@ static WORD32 impeghe_mp4_write_btrt(ia_mp4_writer_struct *pstr_mp4_writer_io, W
WORD32 max_frame_data_size = pstr_mp4_writer_io->max_frame_data_size;
WORD32 total_frame_data_size = pstr_mp4_writer_io->total_frame_data_size;
WORD32 frame_count = pstr_mp4_writer_io->frame_count;
WORD32 avg_frame_data_size = total_frame_data_size / frame_count;
WORD32 avg_frame_data_size = (frame_count != 0) ? total_frame_data_size / frame_count: 0;
WORD32 sample_rate = pstr_mp4_writer_io->sampling_freq;
WORD32 frame_lrngth = 1024;
WORD32 max_bitrate = ((WORD32)(max_frame_data_size / (1024.0 / sample_rate))) << 3;
WORD32 avg_bitrate = ((WORD32)(avg_frame_data_size / (1024.0 / sample_rate)) << 3);
// box size
Expand Down
9 changes: 9 additions & 0 deletions test/impeghe_testbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,15 @@ IA_ERRORCODE impeghe_main_process(WORD32 argc, pWORD8 argv[])
}

// for mhm1 - mhas hdr added to 1st frame

for (int idx = 0; idx < frame_count; idx++)
{
mp4_writer_io.max_frame_data_size = mp4_writer_io.meta_info.ia_mp4_stsz_size[idx] > mp4_writer_io.max_frame_data_size ?
mp4_writer_io.meta_info.ia_mp4_stsz_size[idx] : mp4_writer_io.max_frame_data_size;
mp4_writer_io.total_frame_data_size += mp4_writer_io.meta_info.ia_mp4_stsz_size[idx];
}
mp4_writer_io.frame_count = frame_count;
mp4_writer_io.sampling_freq = pstr_in_cfg->aud_ch_pcm_cfg.sample_rate;
if (op_fmt == MP4_MHM1)
{
ia_stsz_size[0] += pstr_out_cfg->i_dec_len;
Expand Down

0 comments on commit f5db502

Please sign in to comment.