diff --git a/src/chunk.rs b/src/chunk.rs index 3f6df32..b81d16f 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -96,7 +96,10 @@ pub struct WebmChunker { } impl WebmChunker { - pub fn with_buffer_limit(mut self, limit: usize) -> Self { + /// add a "soft" buffer size limit; if a chunk buffer exceeds this size, + /// error the stream instead of resuming. It's still possible for a buffer + /// to exceed this size *after* a write, so ensure input sizes are reasonable. + pub fn with_soft_limit(mut self, limit: usize) -> Self { self.buffer_size_limit = Some(limit); self } diff --git a/src/commands/relay.rs b/src/commands/relay.rs index d213601..17bc018 100644 --- a/src/commands/relay.rs +++ b/src/commands/relay.rs @@ -64,8 +64,8 @@ impl RelayServer { where S::Error: Error + Send { let source = stream .map_err(WebmetroError::from_err) - .parse_ebml().with_buffer_limit(BUFFER_LIMIT) - .chunk_webm().with_buffer_limit(BUFFER_LIMIT); + .parse_ebml().with_soft_limit(BUFFER_LIMIT) + .chunk_webm().with_soft_limit(BUFFER_LIMIT); let sink = Transmitter::new(self.get_channel()); Box::new( diff --git a/src/stream_parser.rs b/src/stream_parser.rs index 58d215b..0d3c9cb 100644 --- a/src/stream_parser.rs +++ b/src/stream_parser.rs @@ -15,7 +15,10 @@ pub struct EbmlStreamingParser { } impl EbmlStreamingParser { - pub fn with_buffer_limit(mut self, limit: usize) -> Self { + /// add a "soft" buffer size limit; if the input buffer exceeds this size, + /// error the stream instead of resuming. It's still possible for the buffer + /// to exceed this size *after* a fill, so ensure input sizes are reasonable. + pub fn with_soft_limit(mut self, limit: usize) -> Self { self.buffer_size_limit = Some(limit); self }