Skip to content

Conversation

@karasusan
Copy link
Collaborator

This pull request introduces several improvements and bug fixes related to video codec encoders and Vulkan graphics device handling. The main focus is on improving error handling in the VP9 and AV1 encoder code, enhancing Vulkan device logging, and ensuring platform-specific code is properly guarded.

Codec Encoder Robustness and Error Handling:

  • Added null pointer checks in libvpx_vp9_encoder.cc and libaom_av1_encoder.cc to prevent crashes if the I420 buffer is missing, returning failure codes or empty values as appropriate. [1] [2]
  • Updated the build script (build_libwebrtc_android.sh) to apply new patches for VP9 and AV1 encoders, ensuring these error checks are included during the build process.

Vulkan Graphics Device Improvements:

  • Added error logging in VulkanGraphicsDevice.cpp for failed texture access and synchronization timeouts, making debugging easier when Vulkan resource operations fail. [1] [2]
  • Included the <chrono> header in VulkanGraphicsDevice.cpp to support time-based operations.

Platform-Specific Code Guarding:

  • Wrapped CUDA-specific code in GpuMemoryBuffer.cpp with #if CUDA_PLATFORM to ensure it only compiles on supported platforms, improving portability and preventing build errors.

@karasusan karasusan requested a review from Copilot August 19, 2025 02:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a crash in the AV1 encoder and improves error handling across video codec encoders. The changes focus on preventing null pointer crashes, enhancing debugging capabilities, and ensuring platform compatibility.

Key changes include:

  • Added null pointer checks to VP9 and AV1 encoders to prevent crashes when I420 buffer is missing
  • Enhanced Vulkan graphics device error logging for better debugging
  • Added platform-specific guards for CUDA code to improve portability

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
VulkanGraphicsDevice.cpp Added error logging for texture access failures and sync timeouts, plus chrono header
GpuMemoryBuffer.cpp Wrapped CUDA-specific code with platform guards
libvpx_vp9_encoder.patch Added null check for I420 buffer to prevent crashes
libaom_av1_encoder.patch Added null check for I420 buffer with proper error code return
build_libwebrtc_android.sh Applied new encoder patches during build process

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

});
if (!ret)
{
RTC_LOG(LS_ERROR) << "WaitSync timeout. "
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Missing space after 'timeout.' - should be 'timeout. ' to properly separate from the next line.

Copilot uses AI. Check for mistakes.
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.

2 participants