Skip to content

Commit dafe728

Browse files
committed
fix: The first TODO in avc_functions.c and FIXME in avc_functions.c
1 parent afde4d6 commit dafe728

File tree

5 files changed

+47
-6
lines changed

5 files changed

+47
-6
lines changed

linux/output.p1.svc01.srt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
1
2+
00:00:00,317 --> 00:00:02,183
3+
<font color="#aaaaaa">d</font>
4+
5+
2
6+
00:00:02,184 --> 00:00:04,116
7+
<font color="#aaaaaa">d</font>
8+
<font color="#aaaaaa">1</font>
9+
10+
3
11+
00:00:04,117 --> 00:00:06,383
12+
<font color="#aaaaaa">d</font>
13+
<font color="#aaaaaa">1</font>
14+
<font color="#aaaaaa">h</font>
15+
16+
4
17+
00:00:06,384 --> 00:00:09,999
18+
<font color="#aaaaaa">1</font>
19+
<font color="#aaaaaa">h</font>
20+
<font color="#aaaaaa">m</font>
21+

linux/output.srt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
1
2+
00:00:00,333 --> 00:00:06,332
3+
congratulations to papa plot and
4+
their community for winning ■k71
5+
million in a TV contest through
6+
7+
2
8+
00:00:06,334 --> 00:00:09,998
9+
their community for winning ■k71
10+
million in a TV contest through
11+
Twitch. I mean, just wild. Um
12+

linux/output1.p1.svc01.srt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1
2+
00:00:00,317 --> 00:00:02,183
3+
<font color="#aaaaaa">d</font>
4+

linux/output1.srt

Whitespace-only changes.

src/lib_ccx/avc_functions.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,19 @@ void do_NAL(struct encoder_ctx *enc_ctx, struct lib_cc_decode *dec_ctx, unsigned
9595
NAL_stop = NAL_length + NAL_start;
9696
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
9797

98-
dvprint("BEGIN NAL unit type: %d length %d ref_idc: %d - Buffered captions before: %d\n",
99-
nal_unit_type, NAL_stop - NAL_start - 1, dec_ctx->avc_ctx->nal_ref_idc, !dec_ctx->avc_ctx->cc_buffer_saved);
100-
10198
if (NAL_stop == NULL) // remove_03emu failed.
10299
{
103-
mprint("\rNotice: NAL of type %u had to be skipped because remove_03emu failed.\n", nal_unit_type);
100+
mprint("\rWarning: Invalid emulation prevention bytes detected in NAL unit type %u (0x%02X). "
101+
"This NAL unit contains an illegal byte sequence (0x000000, 0x000001, or 0x000002) or "
102+
"improper emulation prevention byte (0x03). "
103+
"This may indicate a corrupted AVC/H.264 stream. NAL unit skipped.\n",
104+
nal_unit_type, nal_unit_type);
104105
return;
105106
}
106107

108+
dvprint("BEGIN NAL unit type: %d length %d ref_idc: %d - Buffered captions before: %d\n",
109+
nal_unit_type, NAL_stop - NAL_start - 1, dec_ctx->avc_ctx->nal_ref_idc, !dec_ctx->avc_ctx->cc_buffer_saved);
110+
107111
if (nal_unit_type == CCX_NAL_TYPE_ACCESS_UNIT_DELIMITER_9)
108112
{
109113
// Found Access Unit Delimiter
@@ -127,7 +131,7 @@ void do_NAL(struct encoder_ctx *enc_ctx, struct lib_cc_decode *dec_ctx, unsigned
127131
else if (dec_ctx->avc_ctx->got_seq_para && nal_unit_type == CCX_NAL_TYPE_SEI)
128132
{
129133
// Found SEI (used for subtitles)
130-
// set_fts(ctx->timing); // FIXME - check this!!!
134+
set_fts(enc_ctx->timing);
131135
sei_rbsp(dec_ctx->avc_ctx, NAL_start + 1, NAL_stop);
132136
}
133137
else if (dec_ctx->avc_ctx->got_seq_para && nal_unit_type == CCX_NAL_TYPE_PICTURE_PARAMETER_SET)
@@ -301,7 +305,7 @@ u32 avc_remove_emulation_bytes(const unsigned char *buffer_src, unsigned char *b
301305
unsigned char *remove_03emu(unsigned char *from, unsigned char *to)
302306
{
303307
int num = to - from;
304-
int newsize = EBSPtoRBSP(from, num, 0); // TODO: Do something if newsize == -1 (broken NAL)
308+
int newsize = EBSPtoRBSP(from, num, 0);
305309
if (newsize == -1)
306310
return NULL;
307311
return from + newsize;

0 commit comments

Comments
 (0)