---
description: Code review structure, clarification protocol, and debugging workflow for VIOS
alwaysApply: true
---

# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Code Review

Structure feedback as: **Critical** (bugs, memory leaks, UB, thread-safety violations) -> **Warnings** (missing error handling, performance issues, style drift) -> **Suggestions** (optional improvements).

Focus on recently changed code unless a full audit is requested. Provide concrete examples when suggesting changes. Before proposing a fix that touches a public interface, confirm whether ABI backward compatibility must be maintained.

# Clarification Protocol

Before implementing, ask if any of the following are ambiguous:
- Codec, format, or protocol context (e.g. H.264 vs H.265, RTSP vs WebRTC)
- Whether the change must maintain backward ABI compatibility
- Target platform or compiler version constraints
- Whether existing tests need updating or new ones are required

Never assume on changes that could cause ABI breakage or silent behavioral differences.

# Debugging

**Workflow:** reproduce -> gather evidence (logs, stack traces) -> hypothesize root causes ranked by likelihood -> trace code paths through the shim layer -> isolate minimal reproduction -> fix with clear reasoning -> check for regressions.

**Tools:** GDB (stack traces, watchpoints), Valgrind / AddressSanitizer (memory errors), ThreadSanitizer (data races), `perf` / `gprof` (CPU profiling), `GST_DEBUG` + pipeline dot graphs (GStreamer).
