Check obu_type if single_picture_header_flag is 1 - #5322
Open
wantehchang wants to merge 1 commit into
Open
Conversation
If single_picture_header_flag is equal to 1 in the sequence header OBU, frame_type is inferred to be KEY_FRAME. Therefore obu_type needs to be OBU_CLOSED_LOOP_KEY or OBU_OPEN_LOOP_KEY, otherwise frame_type and obu_type will be inconsistent with each other and things will go wrong. Fixes AOMediaCodec#5319.
wantehchang
commented
Aug 25, 2026
| if (obu_type == OBU_LEADING_SEF || obu_type == OBU_REGULAR_SEF) | ||
| return read_show_existing_frame(pbi, obu_type == OBU_REGULAR_SEF, rb); | ||
| if (obu_type == OBU_CLOSED_LOOP_KEY || obu_type == OBU_OPEN_LOOP_KEY) { | ||
| current_frame->frame_type = KEY_FRAME; |
Member
Author
There was a problem hiding this comment.
In the single_picture_header_flag=0 case, OBU_CLOSED_LOOP_KEY and OBU_OPEN_LOOP_KEY are mapped to KEY_FRAME.
| !cm->immediate_output_picture)) { | ||
| avm_internal_error(&cm->error, AVM_CODEC_CORRUPT_FRAME, | ||
| "Still pictures must be coded as shown keyframes"); | ||
| } |
Member
Author
There was a problem hiding this comment.
In the single_picture_header_flag=0 case, if still_picture is equal to 1, we require the OBU type be OBU_CLOSED_LOOP_KEY or OBU_OPEN_LOOP_KEY via the current_frame->frame_type != KEY_FRAME check. The check I added at line 8010 for the single_picture_header_flag=1 case matches this check.
However, I am not sure if we should allow OBU_OPEN_LOOP_KEY in a still-picture sequence. What do you think?
wantehchang
commented
Aug 25, 2026
| if (obu_type != OBU_CLOSED_LOOP_KEY && obu_type != OBU_OPEN_LOOP_KEY) { | ||
| avm_internal_error(&cm->error, AVM_CODEC_CORRUPT_FRAME, | ||
| "Still pictures must be coded as keyframes"); | ||
| } |
Member
Author
There was a problem hiding this comment.
Peter, Urvang: Do you know of a way to check if the still-picture sequence has more than one frame?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If single_picture_header_flag is equal to 1 in the sequence header OBU, frame_type is inferred to be KEY_FRAME. Therefore obu_type needs to be OBU_CLOSED_LOOP_KEY or OBU_OPEN_LOOP_KEY, otherwise frame_type and obu_type will be inconsistent with each other and things will go wrong.
Fixes #5319.