core: `NullAudioBackend` should not report latency seek data as part of the size of a sound.
This commit is contained in:
parent
d7f2f782c4
commit
e4c6e29b8a
|
@ -64,9 +64,7 @@ pub fn bytes_total<'gc>(
|
|||
) -> Result<Value<'gc>, Error> {
|
||||
if let Some(sound) = this.and_then(|this| this.as_sound()) {
|
||||
if let Some(length) = activation.context.audio.get_sound_size(sound) {
|
||||
//TODO: The length of the sound data is consistently off by two in SWFs.
|
||||
//This probably needs to go away when we start decoding network sounds
|
||||
return Ok((length - 2).into());
|
||||
return Ok((length).into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,13 @@ impl AudioBackend for NullAudioBackend {
|
|||
fn play(&mut self) {}
|
||||
fn pause(&mut self) {}
|
||||
fn register_sound(&mut self, sound: &swf::Sound) -> Result<SoundHandle, Error> {
|
||||
// Slice off latency seek for MP3 data.
|
||||
let data = if sound.format.compression == swf::AudioCompression::Mp3 {
|
||||
&sound.data[2..]
|
||||
} else {
|
||||
sound.data
|
||||
};
|
||||
|
||||
// AS duration does not subtract `skip_sample_frames`.
|
||||
let num_sample_frames: f64 = sound.num_samples.into();
|
||||
let sample_rate: f64 = sound.format.sample_rate.into();
|
||||
|
@ -142,7 +149,7 @@ impl AudioBackend for NullAudioBackend {
|
|||
|
||||
Ok(self.sounds.insert(NullSound {
|
||||
duration: ms as u32,
|
||||
size: sound.data.len() as u32,
|
||||
size: data.len() as u32,
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue