Skip to content

Libmoq 0.2.13 api refactor fix#35

Open
danrossi wants to merge 1 commit intomoq-dev:mainfrom
danrossi:api-refactor-fix
Open

Libmoq 0.2.13 api refactor fix#35
danrossi wants to merge 1 commit intomoq-dev:mainfrom
danrossi:api-refactor-fix

Conversation

@danrossi
Copy link
Copy Markdown

@danrossi danrossi commented May 9, 2026

Related: #34

The libmoq api refactor requires to be changed for the moq source. There is a build issue with an error

'moq_consume_frame_chunk': identifier not found

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2026

Review Change Stack

Walkthrough

This PR updates the frame data retrieval in moq_source_decode_frame by replacing the moq_consume_frame_chunk function call with moq_consume_frame. The change removes the explicit offset parameter (previously 0) from the function signature. Error handling for frame data retrieval failures and subsequent frame decoding logic remain unchanged.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main change: updating the moq source for the libmoq 0.2.13 API refactor to fix a build issue.
Description check ✅ Passed The description explains the context (libmoq API refactor), the issue (#34 reference), and the specific error ('moq_consume_frame_chunk' not found), all directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/moq-source.cpp`:
- Line 791: The call to the non-existent moq_consume_frame must be replaced with
libmoq 0.2.13 API calls: call moq_consume_frame_chunk(frame_id, 0, &frame_data)
to read the first chunk (use index 0) and check its return value for errors, and
after processing call moq_consume_frame_close(frame_id) to release the frame;
update any error handling that relied on moq_consume_frame to use the chunk and
close return codes and ensure you still populate/use frame_data as before.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0a9e7889-4e41-4816-8f4e-b01d144e7081

📥 Commits

Reviewing files that changed from the base of the PR and between ae7df7a and 8d96b63.

📒 Files selected for processing (1)
  • src/moq-source.cpp

Comment thread src/moq-source.cpp
// Get frame data
struct moq_frame frame_data;
if (moq_consume_frame_chunk(frame_id, 0, &frame_data) < 0) {
if (moq_consume_frame(frame_id, &frame_data) < 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for any remaining usage of moq_consume_frame_chunk

# Search for the old API function name
rg -n 'moq_consume_frame_chunk' --type=cpp --type=c --type=h

Repository: moq-dev/obs

Length of output: 37


🌐 Web query:

libmoq 0.2.13 moq_consume_frame API documentation

💡 Result:

In libmoq 0.2.13, the moq_consume_frame APIs are the frame-consuming functions in the crate’s public C ABI, exposed as the following functions: 1) moq_consume_frame_chunk(uint32_t frame, uint32_t index, moq_frame *dst) - Purpose: retrieve a chunk of a frame’s payload (“Consuming: Frames” → “moq_consume_frame_chunk”). [1] 2) moq_consume_frame_close(uint32_t frame) - Purpose: close/clean up a frame consumer (“Consuming: Frames” → “moq_consume_frame_close”). [1] Related lifecycle functions you typically use around frame consumption: - moq_consume_close(uint32_t consume): close the overall consumer resource. [2] Where to find the API documentation for libmoq 0.2.13: - The libmoq 0.2.13 docs are published on docs.rs and include the C API header declarations and/or “README.md” excerpt that lists the consuming APIs including moq_consume_frame_chunk and moq_consume_frame_close. [3] - The crate itself indicates that it generates the C header moq.h during the build (“Generate the C header file at target/include/moq.h”), which is where these symbols originate in the C integration. [1] Primary sources: - libmoq v0.2.13 crate page (version/update date and build notes about generating the C header). [1] - docs.rs/libmoq 0.2.13 README source excerpt containing the “Consuming: Frames” function names. [3]

Citations:


🏁 Script executed:

# Read the context around line 791 in src/moq-source.cpp
sed -n '785,800p' src/moq-source.cpp

Repository: moq-dev/obs

Length of output: 476


🏁 Script executed:

# Search for the definition of moq_consume_frame in the codebase
rg -n 'moq_consume_frame' --type=cpp --type=c --type=h -A 3

Repository: moq-dev/obs

Length of output: 2822


🏁 Script executed:

# Find libmoq header files to verify the API
fd -e h -e hpp | xargs grep -l 'moq_consume_frame' 2>/dev/null | head -20

Repository: moq-dev/obs

Length of output: 37


🏁 Script executed:

# Find where libmoq headers are included
rg -n '#include.*moq' src/moq-source.cpp

Repository: moq-dev/obs

Length of output: 102


🏁 Script executed:

# Check if moq_consume_frame is declared anywhere in this codebase
rg -n 'moq_consume_frame\(' --type=cpp --type=c --type=h --type=hpp -B 2 | head -50

Repository: moq-dev/obs

Length of output: 83


🌐 Web query:

moq_consume_frame libmoq API function

💡 Result:

In libmoq, there is no function named moq_consume_frame. Instead, libmoq exposes frame-consumption functions named: 1) moq_consume_frame_chunk(uint32_t frame, uint32_t index, moq_frame *dst) - “Consuming: Frames” API for retrieving a chunk of a frame’s payload [1]. 2) moq_consume_frame_close(uint32_t frame) - “Consuming: Frames” API for closing/cleaning up a consumed frame [1]. Context: these frame functions are part of libmoq’s C API for consuming media tracks/frames (e.g., moq_consume_video_ordered / moq_consume_audio_ordered ultimately deliver frames, which you then read via moq_consume_frame_chunk and release via moq_consume_frame_close) [2][1]. References: libmoq C API function list includes moq_consume_frame_chunk and moq_consume_frame_close under “Consuming: Frames” [1], and libmoq’s docs.rs page enumerates moq_consume_frame_chunk / moq_consume_frame_close under consuming frames [2].

Citations:


🏁 Script executed:

# Find and read the moq.h header file to check for moq_consume_frame definition
find . -name "moq.h" -type f 2>/dev/null | head -5

Repository: moq-dev/obs

Length of output: 37


🏁 Script executed:

# Search for moq_consume_frame definition or declaration
rg -n 'moq_consume_frame' --type=c --type=h -A 5 -B 1

Repository: moq-dev/obs

Length of output: 37


🌐 Web query:

libmoq 0.2.13 "moq_consume_frame" C API function signature

💡 Result:

In libmoq v0.2.13, the C API does not expose a function named moq_consume_frame; instead, frame-consuming functions are: 1) int32_t moq_consume_frame_chunk(uint32_t frame, uint32_t index, moq_frame dst); 2) int32_t moq_consume_frame_close(uint32_t frame); So there is no C API function signature for moq_consume_frame in that version; the closest equivalents are moq_consume_frame_chunk (to read a chunk payload into moq_frame) and moq_consume_frame_close (to close/cleanup the frame consumer handle). [1] If you intended the Rust API (not the C bindings), the Rust docs list moq_consume_frame_close and moq_consume_frame_chunk as well, not a Rust function named moq_consume_frame. [2]

Citations:


🏁 Script executed:

# Search for moq_consume_frame definition across entire codebase with looser pattern
rg 'moq_consume_frame' --type=c --type=h -i

Repository: moq-dev/obs

Length of output: 37


🏁 Script executed:

# Check if there's a local wrapper or definition in any file
git ls-files | xargs grep -l 'moq_consume_frame' 2>/dev/null

Repository: moq-dev/obs

Length of output: 74


🏁 Script executed:

# Look for recent commits or comments that might explain this API
git log --oneline --all -S 'moq_consume_frame' 2>/dev/null | head -20

Repository: moq-dev/obs

Length of output: 144


🏁 Script executed:

# Read the actual commit that changed this
git show 8d96b63 --stat

Repository: moq-dev/obs

Length of output: 5865


🏁 Script executed:

# Get more details on the commit
git show 8d96b63 | head -100

Repository: moq-dev/obs

Length of output: 2940


🏁 Script executed:

# Check CMakeLists.txt or build configuration for libmoq version
find . -name "CMakeLists.txt" -o -name "*.cmake" -o -name "conanfile.*" | xargs grep -l 'libmoq' 2>/dev/null

Repository: moq-dev/obs

Length of output: 72


🏁 Script executed:

# Check CMakeLists.txt for libmoq version specification
cat CMakeLists.txt | grep -i libmoq -A 5 -B 5

Repository: moq-dev/obs

Length of output: 631


🏁 Script executed:

# Look for libmoq in conanfile or other dependency files
find . -name "conanfile.*" -o -name "requirements.txt" -o -name "package.json" | xargs cat 2>/dev/null | grep -i libmoq

Repository: moq-dev/obs

Length of output: 37


🌐 Web query:

libmoq C API moq_consume_frame newer version function

💡 Result:

In the current libmoq C API, there is no function named moq_consume_frame. Instead, the frame-consumption API is split into “chunk” and “close” calls: 1) moq_consume_frame_chunk(frame, index, moq_frame* dst) 2) moq_consume_frame_close(frame) So if you previously used moq_consume_frame in older code, the equivalent newer pattern is to: - call moq_consume_frame_chunk(...), repeatedly for each chunk index in the frame, and - call moq_consume_frame_close(...) when you’re done with the frame. This split is reflected in the documented C functions exposed by libmoq (e.g., libmoq v0.2.13): it lists moq_consume_frame_chunk(...) and moq_consume_frame_close(...) under “Consuming: Frames”. [1]

Citations:


🏁 Script executed:

# Find where MOQ_VERSION is defined
rg -n 'MOQ_VERSION' CMakeLists.txt -B 5 -A 5

Repository: moq-dev/obs

Length of output: 443


🏁 Script executed:

# Check if there's a version file or defaults
find . -name "*.cmake" -o -name "CMakePresets.json" | xargs grep -i 'MOQ_VERSION' 2>/dev/null

Repository: moq-dev/obs

Length of output: 108


🌐 Web query:

libmoq moq_consume_frame latest version C API

💡 Result:

In libmoq (C FFI for moq-lite), the “consume frame” operations are exposed as frame-level functions, not a single function literally named moq_consume_frame. Latest libmoq version (as published on crates.io at the time of research): v0.2.13 [1]. C API frame consumption functions (consuming frames): - int32_t moq_consume_frame_chunk(uint32_t frame, uint32_t index, moq_frame *dst); [1][2] - int32_t moq_consume_frame_close(uint32_t frame); [1][2] Related frame consumer lifecycle (consume handle cleanup): - int32_t moq_consume_close(uint32_t consume); (close the broadcast consumer / top-level consume handle) [1][2] Notes on “latest version C API”: - The libmoq crate documentation states the library exposes C functions and points to api.rs for full details [3]. - The Rust bindings documentation page lists the consuming frame APIs including moq_consume_frame_chunk and moq_consume_frame_close [2]. If you meant a different API surface (e.g., moq-lite Rust FrameConsumer vs libmoq C FFI), tell me which language/API you’re using and I’ll map the corresponding calls.

Citations:


Fix API call to match libmoq 0.2.13 C API.

The function moq_consume_frame does not exist in libmoq 0.2.13. The official C API provides only:

  • moq_consume_frame_chunk(uint32_t frame, uint32_t index, moq_frame *dst)
  • moq_consume_frame_close(uint32_t frame)

Line 791 will fail at link time with an undefined reference. The code needs to use the actual libmoq 0.2.13 API, likely calling moq_consume_frame_chunk with an appropriate chunk index (0 for the first chunk, if applicable) instead of the non-existent moq_consume_frame.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/moq-source.cpp` at line 791, The call to the non-existent
moq_consume_frame must be replaced with libmoq 0.2.13 API calls: call
moq_consume_frame_chunk(frame_id, 0, &frame_data) to read the first chunk (use
index 0) and check its return value for errors, and after processing call
moq_consume_frame_close(frame_id) to release the frame; update any error
handling that relied on moq_consume_frame to use the chunk and close return
codes and ensure you still populate/use frame_data as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant