Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ if(ENABLE_QT)
)
endif()

# FFmpeg dependency
include(FindPkgConfig)
pkg_check_modules(FFMPEG REQUIRED libavcodec libavutil libswscale libswresample)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${FFMPEG_INCLUDE_DIRS})
target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${FFMPEG_LIBRARIES})

target_sources(
${CMAKE_PROJECT_NAME}
PRIVATE src/obs-moq.cpp src/moq-output.h src/moq-service.h src/moq-output.cpp src/moq-service.cpp
src/moq-source.cpp src/moq-source.h
)

set_target_properties_plugin(${CMAKE_PROJECT_NAME} PROPERTIES OUTPUT_NAME ${_name})
12 changes: 6 additions & 6 deletions src/logger.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <iostream>

// Logging macros
#define LOG(level, format, ...) blog(level, "[obs-moq] " format, ##__VA_ARGS__)
#define LOG_DEBUG(format, ...) LOG(LOG_DEBUG, format, ##__VA_ARGS__)
#define LOG_INFO(format, ...) LOG(LOG_INFO, format, ##__VA_ARGS__)
#define LOG_WARNING(format, ...) LOG(LOG_WARNING, format, ##__VA_ARGS__)
#define LOG_ERROR(format, ...) LOG(LOG_ERROR, format, ##__VA_ARGS__)
// Logging macros - use MOQ_ prefix to avoid conflicts with OBS log level constants
#define MOQ_LOG(level, format, ...) blog(level, "[obs-moq] " format, ##__VA_ARGS__)
#define LOG_DEBUG(format, ...) MOQ_LOG(400, format, ##__VA_ARGS__)
#define LOG_INFO(format, ...) MOQ_LOG(300, format, ##__VA_ARGS__)
#define LOG_WARNING(format, ...) MOQ_LOG(200, format, ##__VA_ARGS__)
#define LOG_ERROR(format, ...) MOQ_LOG(100, format, ##__VA_ARGS__)
2 changes: 1 addition & 1 deletion src/moq-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ bool MoQOutput::Start()

// Start establishing a session with the MoQ server
// NOTE: You could publish the same broadcasts to multiple sessions if you want (redundant ingest).
session = moq_session_connect(server_url.data(), server_url.size(), origin, NULL, session_connect_callback, this);
session = moq_session_connect(server_url.data(), server_url.size(), origin, 0, session_connect_callback, this);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟑 Minor

🧩 Analysis chain

🏁 Script executed:

fd -e h -e hpp | xargs rg -l "moq_session_connect" | head -5

Repository: moq-dev/obs

Length of output: 37


🏁 Script executed:

rg -B 2 -A 8 "moq_session_connect\s*\(" --type=c --type=h --type=cpp

Repository: moq-dev/obs

Length of output: 1240


🏁 Script executed:

fd -e h -e hpp | xargs grep -l "moq_session_connect"

Repository: moq-dev/obs

Length of output: 39


🏁 Script executed:

rg "moq_session_connect" --type=h --type=hpp -B 5 -A 5

Repository: moq-dev/obs

Length of output: 82


🏁 Script executed:

fd "\.h$" | head -20

Repository: moq-dev/obs

Length of output: 120


🏁 Script executed:

rg "moq_session_connect" -B 5 -A 10

Repository: moq-dev/obs

Length of output: 1723


🏁 Script executed:

rg "include.*moq" src/moq-output.cpp src/hang-source.cpp

Repository: moq-dev/obs

Length of output: 170


🏁 Script executed:

rg "#include" src/moq-output.cpp | head -20

Repository: moq-dev/obs

Length of output: 144


🏁 Script executed:

find . -name "moq.h" -type f

Repository: moq-dev/obs

Length of output: 37


🏁 Script executed:

rg "int32_t.*moq_session_connect|moq_session_connect.*int32_t" -A 8 -B 2

Repository: moq-dev/obs

Length of output: 554


🏁 Script executed:

rg "moq_session_connect" -B 10 -A 10 src/hang-source.cpp

Repository: moq-dev/obs

Length of output: 652


🏁 Script executed:

git log --oneline -20 | grep -i moq

Repository: moq-dev/obs

Length of output: 109


Use nullptr instead of 0 for the null pointer.

The fourth parameter to moq_session_connect is a pointer type (origin_consume). While 0 works as a null pointer in C++, modern C++ style prefers nullptr for better type safety and clarity. Change 0 to nullptr.

πŸ€– Prompt for AI Agents
In src/moq-output.cpp around line 87, the call to moq_session_connect passes a
raw literal 0 for the fourth parameter which is a pointer type; replace the 0
with nullptr to convey a null pointer in modern C++ and ensure type safety and
clarity when calling moq_session_connect.

if (session < 0) {
LOG_ERROR("Failed to initialize MoQ server: %d", session);
return false;
Expand Down
Loading