Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
WalkthroughThe change removes the gst-base dependency and refactors MoqSink to extend gst::Element instead of gst_base::BaseSink. MoqSink's internal state shifts from Arc<Mutex> to Mutex<Option> and adds per-pad decoding with request-based pads. New methods include change_state, request_new_pad, and release_pad. The justfile introduces RUST_LOG defaults, adds GST_PLUGIN_PATH_1_0, and updates pipelines to use parsebin and moqsrc. Documentation and examples rename hang*/hangsrc/hangsink terminology to moq*/moqsrc/moqsink and adjust TLS/configuration and environment variable descriptions. 🚥 Pre-merge checks | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/sink/imp.rs (2)
14-20: Consider usingnew_current_thread()for true single-threaded runtime.The coding guidelines specify "single-threaded Tokio worker pool." Using
new_multi_thread()withworker_threads(1)creates a multi-threaded runtime constrained to one worker, which has different semantics thannew_current_thread()(e.g., spawns a separate thread pool even with one worker).♻️ Suggested change
pub static RUNTIME: LazyLock<tokio::runtime::Runtime> = LazyLock::new(|| { - tokio::runtime::Builder::new_multi_thread() + tokio::runtime::Builder::new_current_thread() .enable_all() - .worker_threads(1) .build() .unwrap() });Based on learnings: "Use single-threaded Tokio worker pool for async runtime in plugin elements".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sink/imp.rs` around lines 14 - 20, The RUNTIME static is built with tokio::runtime::Builder::new_multi_thread().worker_threads(1) which yields a multi-threaded runtime constrained to one worker; change the construction of the RUNTIME static (symbol: RUNTIME) to use a single-threaded runtime API (e.g., tokio::runtime::Builder::new_current_thread() or tokio::runtime::Runtime::new_current_thread equivalent) and retain required options (like enable_all()) so the runtime is truly single-threaded per the "single-threaded Tokio worker pool" guideline; update the initialization closure for RUNTIME accordingly and remove the multi_thread builder usage.
286-302: Consider logging when using default Opus parameters.When
channelsorrateare not present in caps, the code silently falls back to defaults (2 channels, 48000 Hz). This could produce incorrect OpusHead if the actual stream differs. A debug log would help diagnose issues.💡 Suggested enhancement
moq_mux::import::DecoderFormat::Opus => { // Synthesize OpusHead from caps fields - let channels: i32 = structure.get("channels").unwrap_or(2); - let rate: i32 = structure.get("rate").unwrap_or(48000); + let channels: i32 = structure.get("channels").unwrap_or_else(|_| { + gst::debug!(CAT, obj = pad, "Opus caps missing channels, defaulting to 2"); + 2 + }); + let rate: i32 = structure.get("rate").unwrap_or_else(|_| { + gst::debug!(CAT, obj = pad, "Opus caps missing rate, defaulting to 48000"); + 48000 + });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sink/imp.rs` around lines 286 - 302, The Opus branch (moq_mux::import::DecoderFormat::Opus) currently silently uses defaults for channels and rate via structure.get(...).unwrap_or(...); modify this to detect when the caps fields are missing (e.g., check structure.get("channels") and structure.get("rate") for None) and emit a debug/log message indicating which default(s) are being used and their values before constructing opus_head and calling decoder.initialize; reference the DecoderFormat::Opus match arm, the local variables channels and rate, the structure lookup, and the decoder.initialize(&mut data) call so the log is added in the correct place (and add the appropriate logging import/level if the crate doesn't already provide one).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CLAUDE.md`:
- Line 87: The documentation line referencing GST_PLUGIN_PATH is out of sync
with the justfile which now uses GST_PLUGIN_PATH_1_0; update the CLAUDE.md entry
that currently says `GST_PLUGIN_PATH` to instead mention `GST_PLUGIN_PATH_1_0`
(or document both with a note that the justfile sets GST_PLUGIN_PATH_1_0) so the
docs and the justfile are consistent.
In `@src/sink/imp.rs`:
- Around line 282-284: The code currently calls map_readable().unwrap() which
can panic; replace the unwrap with proper error propagation by using
map_readable()? (or match/map_err to convert the mapping error into the
function's error type) and handle the Result before creating bytes::Bytes and
calling decoder.initialize(&mut data)?; update the variables map and data
accordingly so mapping failures return an error instead of panicking (affecting
the map_readable, data, and decoder.initialize calls).
---
Nitpick comments:
In `@src/sink/imp.rs`:
- Around line 14-20: The RUNTIME static is built with
tokio::runtime::Builder::new_multi_thread().worker_threads(1) which yields a
multi-threaded runtime constrained to one worker; change the construction of the
RUNTIME static (symbol: RUNTIME) to use a single-threaded runtime API (e.g.,
tokio::runtime::Builder::new_current_thread() or
tokio::runtime::Runtime::new_current_thread equivalent) and retain required
options (like enable_all()) so the runtime is truly single-threaded per the
"single-threaded Tokio worker pool" guideline; update the initialization closure
for RUNTIME accordingly and remove the multi_thread builder usage.
- Around line 286-302: The Opus branch (moq_mux::import::DecoderFormat::Opus)
currently silently uses defaults for channels and rate via
structure.get(...).unwrap_or(...); modify this to detect when the caps fields
are missing (e.g., check structure.get("channels") and structure.get("rate") for
None) and emit a debug/log message indicating which default(s) are being used
and their values before constructing opus_head and calling decoder.initialize;
reference the DecoderFormat::Opus match arm, the local variables channels and
rate, the structure lookup, and the decoder.initialize(&mut data) call so the
log is added in the correct place (and add the appropriate logging import/level
if the crate doesn't already provide one).
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
CLAUDE.mdCargo.tomljustfilesrc/sink/imp.rssrc/sink/mod.rs
💤 Files with no reviewable changes (1)
- Cargo.toml
No description provided.