core: Rename `init_buffer` to `reset_buffer`

This commit is contained in:
David Wendt 2023-08-22 23:25:02 -04:00 committed by kmeisthax
parent 51c8799b32
commit 52d940b8de
2 changed files with 5 additions and 5 deletions

View File

@ -1392,7 +1392,7 @@ impl<'gc> Loader<'gc> {
match response {
Ok(mut response) => {
stream.init_buffer(uc);
stream.reset_buffer(uc);
stream.load_buffer(uc, &mut response.body);
}
Err(response) => {

View File

@ -239,7 +239,7 @@ pub struct NetStreamData<'gc> {
impl<'gc> NetStream<'gc> {
pub fn new(gc_context: &Mutation<'gc>, avm_object: Option<AvmObject<'gc>>) -> Self {
// IMPORTANT: When adding new fields consider if they need to be
// initialized in `init_buffer` as well.
// initialized in `reset_buffer` as well.
Self(GcCell::new(
gc_context,
NetStreamData {
@ -271,15 +271,15 @@ impl<'gc> NetStream<'gc> {
self.0.write(gc_context).avm_object = Some(avm_object);
}
/// Initialize the `NetStream` buffer to accept new source data.
/// Reset the `NetStream` buffer to accept new source data.
///
/// This must be done once per source change and should ideally be done
/// immediately before the first `load_buffer` call for a particular source
/// file.
///
/// Externally visible AVM state must not be initialized here - i.e. the
/// Externally visible AVM state must not be reinitialized here - i.e. the
/// AS3 `client` doesn't go away because you played a new video file.
pub fn init_buffer(self, context: &mut UpdateContext<'_, 'gc>) {
pub fn reset_buffer(self, context: &mut UpdateContext<'_, 'gc>) {
let mut write = self.0.write(context.gc_context);
if let Some(instance) = write.sound_instance {