-
Notifications
You must be signed in to change notification settings - Fork 136
libmoq consume API #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libmoq consume API #777
Changes from 9 commits
62eab2f
556c3a9
6ed5895
9c24c14
c5e4b24
197f3f9
ba03cc7
173fc7b
842ea30
9033a27
aa3ef89
5f5a59a
c43f5ef
ad3031f
6a06057
453db4e
cd6cdb6
e51ff8f
2cdf531
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -91,8 +91,8 @@ impl TrackProducer { | |||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||
| /// Multiple consumers can be created from the same producer, each receiving | ||||||||||||||||||||||||||||||||
| /// a copy of all data written to the track. | ||||||||||||||||||||||||||||||||
| pub fn consume(&self) -> TrackConsumer { | ||||||||||||||||||||||||||||||||
| TrackConsumer::new(self.inner.consume()) | ||||||||||||||||||||||||||||||||
| pub fn consume(&self, max_buffer: std::time::Duration) -> TrackConsumer { | ||||||||||||||||||||||||||||||||
| TrackConsumer::new(self.inner.consume(), max_buffer) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -132,18 +132,18 @@ pub struct TrackConsumer { | |||||||||||||||||||||||||||||||
| max_timestamp: Timestamp, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // The maximum buffer size before skipping a group. | ||||||||||||||||||||||||||||||||
| latency: std::time::Duration, | ||||||||||||||||||||||||||||||||
| max_buffer: std::time::Duration, | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| impl TrackConsumer { | ||||||||||||||||||||||||||||||||
| /// Create a new TrackConsumer wrapping the given moq-lite consumer. | ||||||||||||||||||||||||||||||||
| pub fn new(inner: moq_lite::TrackConsumer) -> Self { | ||||||||||||||||||||||||||||||||
| pub fn new(inner: moq_lite::TrackConsumer, max_buffer: std::time::Duration) -> Self { | ||||||||||||||||||||||||||||||||
| Self { | ||||||||||||||||||||||||||||||||
| inner, | ||||||||||||||||||||||||||||||||
| current: None, | ||||||||||||||||||||||||||||||||
| pending: VecDeque::new(), | ||||||||||||||||||||||||||||||||
| max_timestamp: Timestamp::default(), | ||||||||||||||||||||||||||||||||
| latency: std::time::Duration::ZERO, | ||||||||||||||||||||||||||||||||
| max_buffer, | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -155,7 +155,7 @@ impl TrackConsumer { | |||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||
| /// Returns `None` when the track has ended. | ||||||||||||||||||||||||||||||||
| pub async fn read_frame(&mut self) -> Result<Option<Frame>, Error> { | ||||||||||||||||||||||||||||||||
| let latency = self.latency.try_into()?; | ||||||||||||||||||||||||||||||||
| let latency = self.max_buffer.try_into()?; | ||||||||||||||||||||||||||||||||
| loop { | ||||||||||||||||||||||||||||||||
| let cutoff = self | ||||||||||||||||||||||||||||||||
| .max_timestamp | ||||||||||||||||||||||||||||||||
|
|
@@ -209,7 +209,7 @@ impl TrackConsumer { | |||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| Some((index, timestamp)) = buffering.next() => { | ||||||||||||||||||||||||||||||||
| if self.current.is_some() { | ||||||||||||||||||||||||||||||||
| tracing::debug!(old = ?self.max_timestamp, new = ?timestamp, buffer = ?self.latency, "skipping slow group"); | ||||||||||||||||||||||||||||||||
| tracing::debug!(old = ?self.max_timestamp, new = ?timestamp, buffer = ?self.max_buffer, "skipping slow group"); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| drop(buffering); | ||||||||||||||||||||||||||||||||
|
|
@@ -228,9 +228,9 @@ impl TrackConsumer { | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| /// Set the maximum latency tolerance for this consumer. | ||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||
| /// Groups with timestamps older than `max_timestamp - latency` will be skipped. | ||||||||||||||||||||||||||||||||
| pub fn set_latency(&mut self, max: std::time::Duration) { | ||||||||||||||||||||||||||||||||
| self.latency = max; | ||||||||||||||||||||||||||||||||
| /// Groups with timestamps older than `max_timestamp - max_buffer` will be skipped. | ||||||||||||||||||||||||||||||||
| pub fn set_max_buffer(&mut self, max: std::time::Duration) { | ||||||||||||||||||||||||||||||||
| self.max_buffer = max; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
229
to
234
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the documentation for consistent terminology. The method has been renamed to Apply this diff to improve consistency: - /// Set the maximum latency tolerance for this consumer.
+ /// Set the maximum buffer duration for this consumer.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| /// Wait until the track is closed. | ||||||||||||||||||||||||||||||||
|
|
@@ -239,12 +239,6 @@ impl TrackConsumer { | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| impl From<moq_lite::TrackConsumer> for TrackConsumer { | ||||||||||||||||||||||||||||||||
| fn from(inner: moq_lite::TrackConsumer) -> Self { | ||||||||||||||||||||||||||||||||
| Self::new(inner) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| impl From<TrackConsumer> for moq_lite::TrackConsumer { | ||||||||||||||||||||||||||||||||
| fn from(inner: TrackConsumer) -> Self { | ||||||||||||||||||||||||||||||||
| inner.inner | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: moq-dev/moq
Length of output: 14894
Update call site in
rs/hang/src/catalog/root.rswith the requiredmax_bufferparameter.The
consume()method signature was changed to require amax_buffer: std::time::Durationparameter, but the call at line 168 inrs/hang/src/catalog/root.rsdoes not pass this argument:This will fail to compile. The call must be updated to pass the required parameter.
🤖 Prompt for AI Agents