From 5b744f82bb80a19d86211aac8dfdda060cc93f4b Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 6 Sep 2018 11:44:47 +0200 Subject: [PATCH] rmdec: handle situation when last partial frame is full frame --- src/demuxers/realmedia.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/demuxers/realmedia.rs b/src/demuxers/realmedia.rs index 4415192..2702b9b 100644 --- a/src/demuxers/realmedia.rs +++ b/src/demuxers/realmedia.rs @@ -375,7 +375,11 @@ impl<'a> DemuxCore<'a> for RealMediaDemuxer<'a> { //println!(" mode 2 pkt {}/{} tail {}/{} seq {}", packet_num, num_pkts, tail_size, frame_size, seq_no); self.slice_buf.resize(tail_size as usize, 0); self.src.read_buf(self.slice_buf.as_mut_slice())?; - vstr.add_slice(packet_num as usize, self.slice_buf.as_slice()); + if packet_num == 1 && frame_size == tail_size { + vstr.start_slice(num_pkts, frame_size as usize, self.slice_buf.as_slice()); + } else { + vstr.add_slice(packet_num as usize, self.slice_buf.as_slice()); + } while self.src.tell() < pos + (payload_size as u64) { let res = read_multiple_frame(self.src, stream.clone(), false, false); -- 2.39.5