Skip to content

Commit 9c69f00

Browse files
committed
ogg_pager: Add constants to separate maximum possible page size from written page size
1 parent d1beb78 commit 9c69f00

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ogg_pager/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ pub use packets::{Packets, PacketsIter};
1515
pub use paginate::paginate;
1616

1717
const CONTINUED_PACKET: u8 = 0x01;
18+
pub(crate) const MAX_WRITTEN_SEGMENT_COUNT: usize = 32;
19+
pub(crate) const MAX_WRITTEN_CONTENT_SIZE: usize = MAX_WRITTEN_SEGMENT_COUNT * 255;
1820

1921
/// The maximum page content size
20-
pub const MAX_CONTENT_SIZE: usize = 65025;
22+
// NOTE: An OGG page can have up to 255 segments, or ~64KB. We cap it at 32 segments, or ~8KB when writing.
23+
pub const MAX_CONTENT_SIZE: usize = MAX_WRITTEN_CONTENT_SIZE * 4;
24+
/// The maximum number of segments a page can contain
25+
pub const MAX_SEGMENT_COUNT: usize = 255;
2126
/// The packet contains the first page of the logical bitstream
2227
pub const CONTAINS_FIRST_PAGE_OF_BITSTREAM: u8 = 0x02;
2328
/// The packet contains the last page of the logical bitstream

0 commit comments

Comments
 (0)