core: Update the stream offset after each tag is processed.

The `preload_offset` is only ever moved forward, of course.
This commit is contained in:
David Wendt 2023-04-15 23:44:20 -04:00 committed by kmeisthax
parent 3410d9fcf8
commit 3d5156b90d
1 changed files with 8 additions and 0 deletions

View File

@ -12,6 +12,7 @@ use flv_rs::{
use gc_arena::{Collect, GcCell, MutationContext}; use gc_arena::{Collect, GcCell, MutationContext};
use ruffle_video::VideoStreamHandle; use ruffle_video::VideoStreamHandle;
use ruffle_wstr::WStr; use ruffle_wstr::WStr;
use std::cmp::max;
use std::io::Seek; use std::io::Seek;
use swf::{VideoCodec, VideoDeblocking}; use swf::{VideoCodec, VideoDeblocking};
@ -393,6 +394,13 @@ impl<'gc> NetStream<'gc> {
tracing::error!("FLV data parsing failed: {}", e) tracing::error!("FLV data parsing failed: {}", e)
} }
} }
// We cannot mutate stream state while also holding an active
// reader or any tags.
let (_, position) = reader.into_parts();
write.offset = position;
write.preload_offset = max(write.offset, write.preload_offset);
reader = FlvReader::from_parts(&write.buffer, position);
} }
} }
} }