flv: Screen Video wants the FLV `VideoData` header byte

This commit is contained in:
David Wendt 2023-06-28 19:14:51 -04:00 committed by kmeisthax
parent 21b7e70d09
commit 3ff1db014f
1 changed files with 12 additions and 2 deletions

View File

@ -359,16 +359,26 @@ impl<'gc> NetStream<'gc> {
let codec = VideoCodec::from_u8(codec_id as u8); let codec = VideoCodec::from_u8(codec_id as u8);
match (video_handle, codec, data) { match (video_handle, codec, data) {
(Some(video_handle), Some(codec), FlvVideoPacket::Data(data)) (Some(video_handle), Some(codec), FlvVideoPacket::Data(mut data))
| ( | (
Some(video_handle), Some(video_handle),
Some(codec), Some(codec),
FlvVideoPacket::Vp6Data { FlvVideoPacket::Vp6Data {
hadjust: _, hadjust: _,
vadjust: _, vadjust: _,
data, mut data,
}, },
) => { ) => {
if codec == VideoCodec::ScreenVideo {
// ScreenVideo streams consider the FLV
// video data byte to be integral to their
// own bitstream.
let offset =
data.as_ptr() as usize - write.buffer.as_ptr() as usize;
let len = data.len();
data = &write.buffer[offset - 1..offset + len];
}
// NOTE: Currently, no implementation of the decoder backend actually requires // NOTE: Currently, no implementation of the decoder backend actually requires
if tag_needs_preloading { if tag_needs_preloading {
let encoded_frame = EncodedFrame { let encoded_frame = EncodedFrame {