From 691d5dd67e835722d8fad9e2086addcf8d7b702c Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Wed, 25 Oct 2023 16:32:12 +0500 Subject: [PATCH] minor fixes with init fragment --- src/muxer/hls/handler.rs | 3 ++- src/muxer/hls/mp4/atoms.rs | 4 ++-- src/muxer/hls/mp4/mp4muxer.rs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/muxer/hls/handler.rs b/src/muxer/hls/handler.rs index e30eea5..1b1d185 100644 --- a/src/muxer/hls/handler.rs +++ b/src/muxer/hls/handler.rs @@ -62,11 +62,12 @@ impl HLSHandler { let playlist_string = format!("\ #EXTM3U\n\ #EXT-X-VERSION:7\n\ + #EXT-X-TARGETDURATION:{}\n\ #EXT-X-MEDIA-SEQUENCE:{}\n\ #EXT-X-MAP:URI=\"{}init.mp4\"\n\ {}\ #EXT-X-ENDLIST\ - ", self.curr_media_seq_idx, self.args.segment_prepend.clone(), segment_listing); + ", self.args.segment_time, self.curr_media_seq_idx, self.args.segment_prepend.clone(), segment_listing); let mut f = fs::File::create("stream.m3u8").unwrap(); f.write_all(&playlist_string.as_bytes()); diff --git a/src/muxer/hls/mp4/atoms.rs b/src/muxer/hls/mp4/atoms.rs index 735b742..fa35ba1 100644 --- a/src/muxer/hls/mp4/atoms.rs +++ b/src/muxer/hls/mp4/atoms.rs @@ -225,7 +225,7 @@ impl Default for TKHD { fn default() -> Self { TKHD { version: 0, - flags: 1, + flags: 3, create_time: 0, modify_time: 0, track_id: 0, @@ -435,7 +435,7 @@ impl Default for VMHD { fn default() -> Self { VMHD { version: 0, - flags: 0, + flags: 1, mode: 0, opcolor: [0,0,0], } diff --git a/src/muxer/hls/mp4/mp4muxer.rs b/src/muxer/hls/mp4/mp4muxer.rs index 8dee66e..6a52436 100644 --- a/src/muxer/hls/mp4/mp4muxer.rs +++ b/src/muxer/hls/mp4/mp4muxer.rs @@ -131,7 +131,7 @@ fn get_opus_stsd(sample: Vec, metadata: &Arc) -> mp4::atoms: dref_idx: 1, channels: metadata.audio.channels as u16, sample_size: 16, - sample_rate: metadata.audio.samplerate, + sample_rate: metadata.audio.samplerate << 16, codec_config: mp4::atoms::CodecConfig { atom_name: *b"dOps", data: opus_binding} }; return mp4::atoms::STSD {