-
Notifications
You must be signed in to change notification settings - Fork 478
[FIX] The first TODO in avc_functions.c and FIXME in avc_functions.c #1695
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: master
Are you sure you want to change the base?
Changes from all commits
dafe728
d1f2dbb
b2353f8
42e70ab
28ab492
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 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -95,15 +95,19 @@ void do_NAL(struct encoder_ctx *enc_ctx, struct lib_cc_decode *dec_ctx, unsigned | |||||||||||||||||||
| NAL_stop = NAL_length + NAL_start; | ||||||||||||||||||||
| NAL_stop = remove_03emu(NAL_start + 1, NAL_stop); // Add +1 to NAL_stop for TS, without it for MP4. Still don't know why | ||||||||||||||||||||
|
|
||||||||||||||||||||
| dvprint("BEGIN NAL unit type: %d length %d ref_idc: %d - Buffered captions before: %d\n", | ||||||||||||||||||||
| nal_unit_type, NAL_stop - NAL_start - 1, dec_ctx->avc_ctx->nal_ref_idc, !dec_ctx->avc_ctx->cc_buffer_saved); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if (NAL_stop == NULL) // remove_03emu failed. | ||||||||||||||||||||
| { | ||||||||||||||||||||
| mprint("\rNotice: NAL of type %u had to be skipped because remove_03emu failed.\n", nal_unit_type); | ||||||||||||||||||||
| mprint("\rWarning: Invalid prevention bytes detected in NAL unit type %u (0x%02X). " | ||||||||||||||||||||
| "This NAL unit contains an illegal byte sequence (0x000000, 0x000001, or 0x000002) or " | ||||||||||||||||||||
| "improper prevention byte (0x03). " | ||||||||||||||||||||
| "This may indicate a corrupted AVC/H.264 stream. NAL unit skipped.\n", | ||||||||||||||||||||
|
Comment on lines
+100
to
+103
|
||||||||||||||||||||
| mprint("\rWarning: Invalid prevention bytes detected in NAL unit type %u (0x%02X). " | |
| "This NAL unit contains an illegal byte sequence (0x000000, 0x000001, or 0x000002) or " | |
| "improper prevention byte (0x03). " | |
| "This may indicate a corrupted AVC/H.264 stream. NAL unit skipped.\n", | |
| mprint("\rWarning: Failed to process NAL unit type %u (0x%02X) due to emulation prevention byte removal failure. " | |
| "This may indicate a corrupted AVC/H.264 stream or an internal processing error. NAL unit skipped.\n", |
Copilot
AI
Jul 15, 2025
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.
Moving the dvprint statement after the error check means debug information won't be printed for NAL units that fail emulation prevention byte removal. This could make debugging more difficult. Consider keeping the debug print before the error check or adding a separate debug message for failed NAL units.
| return; | |
| } | |
| dvprint("BEGIN NAL unit type: %d length %d ref_idc: %d - Buffered captions before: %d\n", | |
| nal_unit_type, NAL_stop - NAL_start - 1, dec_ctx->avc_ctx->nal_ref_idc, !dec_ctx->avc_ctx->cc_buffer_saved); | |
| dvprint("Failed to process NAL unit type: %d - Emulation prevention byte removal failed.\n", | |
| nal_unit_type); | |
| return; | |
| } |
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.
The error message contains technical inaccuracies. The sequences 0x000000, 0x000001, and 0x000002 are not inherently illegal in H.264 streams - 0x000001 is actually the standard start code prefix. The message should focus on the actual failure rather than speculating about specific byte patterns.
Uh oh!
There was an error while loading. Please reload this page.
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.
I think this suggestion is incorrect, The comment at Line 274 states that 0x000000, 0x000001 or 0x000002 shall not occur at any byte-aligned position