Skip to content

Commit 4955dd4

Browse files
authored
Bugfix: fix Ogg packets spanning multiple pages (#6)
1 parent fafe0af commit 4955dd4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ogg_demuxer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,12 +851,12 @@ OggDemuxer::InternalResult OggDemuxer::handle_page_header(const uint8_t* input,
851851
bos_flag_used_ = true;
852852
}
853853

854-
// Check for zero-copy opportunity
854+
// Check for zero-copy opportunity (only when not assembling a continued packet)
855855
size_t bytes_from_input_for_header = (staged_bytes == 0) ? header_size : bytes_added_to_staging;
856856
size_t remaining_in_input =
857857
(bytes_from_input_for_header < input_len) ? (input_len - bytes_from_input_for_header) : 0;
858858

859-
if (remaining_in_input > 0) {
859+
if (remaining_in_input > 0 && !assembling_packet_) {
860860
PacketInfo first_packet = scan_for_next_packet(0);
861861
if (first_packet.complete && remaining_in_input >= first_packet.size) {
862862
const uint8_t* body_start = input + bytes_from_input_for_header;

0 commit comments

Comments
 (0)