Skip to content

Fix bug - #230

Open
zhuipiaochen wants to merge 4 commits into
dmlc:masterfrom
zhuipiaochen:fix-bug
Open

zhuipiaochen wants to merge 4 commits into
dmlc:masterfrom
zhuipiaochen:fix-bug

Conversation

@zhuipiaochen

Copy link
Copy Markdown

I tried to fix some bugs

Fix the missing parameters of GetVideoReader
Reset the total frame count to 0
 This is going to loop indefinitely when parse some corrupted video
When the video format changes, reinitialize the decoder and continue to decode
@GadiZimerman

Copy link
Copy Markdown

@CodiumAI-Agent /review

@QodoAI-Agent

Copy link
Copy Markdown

PR Analysis

  • 🎯 Main theme: Bug fix in video processing
  • 📝 PR summary: This PR addresses several bugs in the video processing code. It modifies the initialization of the video decoder to handle dynamic video format changes, adjusts the calculation of the total frame count, and adds a condition to prevent an infinite loop when parsing corrupted videos. It also updates the parameters of the GetVideoReader function.
  • 📌 Type of PR: Bug fix
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 3, because the changes involve critical parts of the video processing code and require a good understanding of the domain to review effectively.
  • 🔒 Security concerns: No

PR Feedback

💡 General suggestions: The PR addresses important issues in the video processing code. However, it would be beneficial to add more context or comments in the code to explain the reasons behind the changes. This would help other developers understand the purpose of the changes and their impact on the overall functionality.

🤖 Code feedback:
relevant filesrc/video/nvcodec/cuda_decoder_impl.cc
suggestion      

Consider using a separate function to handle the reinitialization of the decoder when the video format changes. This would improve the readability and maintainability of the code. [important]

relevant lineCHECK_CUDA_CALL(cuvidDestroyDecoder(decoder_));

relevant filesrc/video/video_reader.cc
suggestion      

It would be better to define a constant for the maximum number of iterations (60 in this case) to avoid magic numbers in the code. [medium]

relevant lineif(i > 60){ // This is going to loop indefinitely when parse some corrupted video

relevant fileinclude/decord/video_interface.h
suggestion      

It seems like a new parameter 'fault_tol' is added to the GetVideoReader function but it is not used anywhere in the changes. Make sure to use this parameter or remove it if it's not necessary. [medium]

relevant lineint io_type=kNormal, std::string fault_tol="-1");

✨ Usage tips:

Tag me in a comment '@CodiumAI-Agent' and add one of the following commands:

  • /review: Request a review of your Pull Request.
  • /describe: Update the PR title and description based on the contents of the PR.
  • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
  • /ask <QUESTION>: Ask a question about the PR.
  • /update_changelog: Update the changelog based on the PR's contents.
  • /add_docs 💎: Generate docstring for new components introduced in the PR.
  • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
  • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To edit any configuration parameter from the configuration.toml, add --config_path=new_value.
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, add a /config comment.

@gaurav274

gaurav274 commented May 10, 2024 •

Copy link
Copy Markdown

@zhuipiaochen, please provide a description of the bugs you fixed in this PR.

@gaurav274
gaurav274 self-requested a review May 10, 2024 05:56
chr431 pushed a commit to chr431/decord that referenced this pull request Aug 15, 2026
从 dmlc/decord open issues/PR 筛选并本地验证后移植:
- NDArray.pts int->int64_t(dmlc#269/dmlc#341);SkipFramesImpl 用 Drained() 判真 EOF,避免容器虚标帧数时死循环并采样 EOF 幽灵帧(dmlc#373/dmlc#342)
- CheckKeyFrame EOF 出口 + GetFrameCount avg_frame_rate.den==0 防除零(dmlc#230)
- FFmpeg 7 buffersink pix_fmts 类型变化守卫(libavfilter>=10,PR dmlc#368),新增 Windows FFmpeg 7.1 CI job
- 帧索引缓存版本混入 LIBAVFORMAT_VERSION_INT,防止跨 FFmpeg 构建误用旧缓存(本地实测 7.1/8.1 时间戳不一致)
- ctypes 默认 RTLD_LOCAL + DECORD_RTLD_GLOBAL 逃生开关,PATH 缺失兜底(dmlc#361/dmlc#362/dmlc#357)
- _init_internal_api 显式 import _api_internal(PR dmlc#364);AVReader sample_rate 默认值与文档对齐为 -1(PR dmlc#237)
- VideoReader.close()/上下文管理器(dmlc#222);GPU VP8 映射(dmlc#217);worker 停止后的 Push 可读报错(dmlc#321)
- 新增回归:large_pts.mp4 大 PTS get_batch/seek、close/context manager、PATH 缺失、RTLD_GLOBAL 开关、AVReader 默认值
- 本地验证:Windows GPU FFmpeg 8.1 61 tests、CPU FFmpeg 8.1 60 tests、CPU FFmpeg 7.1 60 tests 全绿
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.

4 participants