-
Notifications
You must be signed in to change notification settings - Fork 665
Limit CPU video decoder codec support #6352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 425555244cbc9aaeca233ddd42bd650306000165 | ||
| ToDo | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 21dd6148f0cf4557531d54b810379c681c898e91 | ||
| ToDo |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -154,18 +154,19 @@ bool FramesDecoderCpu::ReadRegularFrame(uint8_t *data) { | |||||||||||||||||||||||||||||
| LOG_LINE << (copy_to_output ? "Read" : "Skip") << " frame (ReadRegularFrame), index " | ||||||||||||||||||||||||||||||
| << next_frame_idx_ << ", timestamp " << std::setw(5) << frame_->pts | ||||||||||||||||||||||||||||||
| << std::endl; | ||||||||||||||||||||||||||||||
| if (!copy_to_output) { | ||||||||||||||||||||||||||||||
| ++next_frame_idx_; | ||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||
| if (copy_to_output) { | ||||||||||||||||||||||||||||||
| CopyToOutput(data); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| CopyToOutput(data); | ||||||||||||||||||||||||||||||
| ++next_frame_idx_; | ||||||||||||||||||||||||||||||
| if (next_frame_idx_ >= NumFrames()) { | ||||||||||||||||||||||||||||||
| next_frame_idx_ = -1; | ||||||||||||||||||||||||||||||
| LOG_LINE << "Next frame index out of bounds (regular), setting to -1" << std::endl; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||
|
Comment on lines
160
to
165
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ret = avcodec_send_packet(codec_ctx_, nullptr); | ||||||||||||||||||||||||||||||
| DALI_ENFORCE(ret >= 0, | ||||||||||||||||||||||||||||||
| DALI_ENFORCE(ret >= 0 || ret == AVERROR_EOF, | ||||||||||||||||||||||||||||||
| make_string("Failed to send packet to decoder: ", av_error_string(ret))); | ||||||||||||||||||||||||||||||
| flush_state_ = true; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
@@ -176,6 +177,7 @@ bool FramesDecoderCpu::ReadFlushFrame(uint8_t *data) { | |||||||||||||||||||||||||||||
| bool copy_to_output = data != nullptr; | ||||||||||||||||||||||||||||||
| if (avcodec_receive_frame(codec_ctx_, frame_) < 0) { | ||||||||||||||||||||||||||||||
| flush_state_ = false; | ||||||||||||||||||||||||||||||
| next_frame_idx_ = -1; | ||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
@@ -189,7 +191,7 @@ bool FramesDecoderCpu::ReadFlushFrame(uint8_t *data) { | |||||||||||||||||||||||||||||
| ++next_frame_idx_; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // TODO(awolant): Figure out how to handle this during index building | ||||||||||||||||||||||||||||||
| // Or when NumFrames in unavailible | ||||||||||||||||||||||||||||||
| // Or when NumFrames in unavailable | ||||||||||||||||||||||||||||||
| if (next_frame_idx_ >= NumFrames()) { | ||||||||||||||||||||||||||||||
| next_frame_idx_ = -1; | ||||||||||||||||||||||||||||||
| LOG_LINE << "Next frame index out of bounds, setting to -1" << std::endl; | ||||||||||||||||||||||||||||||
|
|
@@ -213,15 +215,15 @@ bool FramesDecoderCpu::SelectVideoStream(int stream_id) { | |||||||||||||||||||||||||||||
| assert(codec_params_); | ||||||||||||||||||||||||||||||
| AVCodecID codec_id = codec_params_->codec_id; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| static constexpr std::array<AVCodecID, 7> codecs = { | ||||||||||||||||||||||||||||||
| AVCodecID::AV_CODEC_ID_H264, | ||||||||||||||||||||||||||||||
| AVCodecID::AV_CODEC_ID_HEVC, | ||||||||||||||||||||||||||||||
| static constexpr std::array<AVCodecID, 3> codecs = { | ||||||||||||||||||||||||||||||
| AVCodecID::AV_CODEC_ID_VP8, | ||||||||||||||||||||||||||||||
| AVCodecID::AV_CODEC_ID_VP9, | ||||||||||||||||||||||||||||||
| AVCodecID::AV_CODEC_ID_MJPEG, | ||||||||||||||||||||||||||||||
| // Those are not supported by our compiled version of libavcodec, | ||||||||||||||||||||||||||||||
| // AVCodecID::AV_CODEC_ID_AV1, | ||||||||||||||||||||||||||||||
| // AVCodecID::AV_CODEC_ID_MPEG4, | ||||||||||||||||||||||||||||||
| // AVCodecID::AV_CODEC_ID_H264, | ||||||||||||||||||||||||||||||
| // AVCodecID::AV_CODEC_ID_HEVC, | ||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if (std::find(codecs.begin(), codecs.end(), codec_id) == codecs.end()) { | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToDoplaceholder.Both
DALI_DEPS_VERSIONandDALI_EXTRA_VERSIONnow contain the stringToDoinstead of a commit SHA. Any CI job that reads these files to fetch the matchingdali_deps/dali_extraartefacts will either fail outright or pick up an incorrect/stale revision, breaking reproducibility for the entire build. These files should be updated to the real commit SHAs before this PR merges (or the dependent PRs should land first).