Skip to content

Commit

Permalink
fixed potential bug in OBU parsing introduced by c08973c
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed Apr 15, 2024
1 parent e4719b5 commit 05ebaaf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/gpac/internal/media_dev.h
Expand Up @@ -993,6 +993,7 @@ typedef struct

//set to one if a temporal delim is found when calling aom_av1_parse_temporal_unit_from_section5
u8 has_temporal_delim;
u8 has_frame_data;
} AV1State;

GF_Err aom_av1_parse_temporal_unit_from_section5(GF_BitStream *bs, AV1State *state);
Expand Down
7 changes: 6 additions & 1 deletion src/media_tools/av_parsers.c
Expand Up @@ -2622,7 +2622,8 @@ GF_Err aom_av1_parse_temporal_unit_from_section5(GF_BitStream *bs, AV1State *sta
{
if (!state) return GF_BAD_PARAM;
state->has_temporal_delim = 0;
Bool first_obu = GF_TRUE;
//if some OBUs are written, we had a TL before but had to stop parsing due to not enough space
Bool first_obu = state->has_frame_data ? GF_FALSE : GF_TRUE;

while (1) {
GF_Err e;
Expand All @@ -2647,6 +2648,9 @@ GF_Err aom_av1_parse_temporal_unit_from_section5(GF_BitStream *bs, AV1State *sta
break;
}
state->has_temporal_delim = 1;
state->has_frame_data = 0;
} else {
state->has_frame_data = 1;
}
first_obu = GF_FALSE;

Expand Down Expand Up @@ -4038,6 +4042,7 @@ void gf_av1_reset_state(AV1State *state, Bool is_destroy)
l2 = state->frame_state.header_obus;
memset(&state->frame_state, 0, sizeof(AV1StateFrame));
state->frame_state.is_first_frame = GF_TRUE;
state->has_frame_data = 0;

if (is_destroy) {
gf_list_del(l1);
Expand Down

0 comments on commit 05ebaaf

Please sign in to comment.