Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
8c8db25b
Commit
8c8db25b
authored
Jul 25, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up and check sps/pps id validity.
parent
724a7186
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
16 deletions
+33
-16
modules/packetizer/h264.c
modules/packetizer/h264.c
+33
-16
No files found.
modules/packetizer/h264.c
View file @
8c8db25b
...
@@ -83,6 +83,8 @@ typedef struct
...
@@ -83,6 +83,8 @@ typedef struct
int
i_delta_pic_order_cnt1
;
int
i_delta_pic_order_cnt1
;
}
slice_t
;
}
slice_t
;
#define SPS_MAX (32)
#define PPS_MAX (256)
struct
decoder_sys_t
struct
decoder_sys_t
{
{
block_bytestream_t
bytestream
;
block_bytestream_t
bytestream
;
...
@@ -678,24 +680,28 @@ static void PutSPS( decoder_t *p_dec, block_t *p_frag )
...
@@ -678,24 +680,28 @@ static void PutSPS( decoder_t *p_dec, block_t *p_frag )
{
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
uint8_t
*
dec
=
NULL
;
uint8_t
*
pb_
dec
=
NULL
;
int
i_dec
=
0
;
int
i_dec
=
0
;
bs_t
s
;
bs_t
s
;
int
i_tmp
;
int
i_tmp
;
int
i_sps_id
;
if
(
!
p_sys
->
b_sps
)
CreateDecodedNAL
(
&
pb_dec
,
&
i_dec
,
&
p_frag
->
p_buffer
[
5
],
msg_Dbg
(
p_dec
,
"found NAL_SPS"
);
p_sys
->
b_sps
=
true
;
CreateDecodedNAL
(
&
dec
,
&
i_dec
,
&
p_frag
->
p_buffer
[
5
],
p_frag
->
i_buffer
-
5
);
p_frag
->
i_buffer
-
5
);
bs_init
(
&
s
,
dec
,
i_dec
);
bs_init
(
&
s
,
pb_
dec
,
i_dec
);
/* Skip profile(8), constraint_set012, reserver(5), level(8) */
/* Skip profile(8), constraint_set012, reserver(5), level(8) */
bs_skip
(
&
s
,
8
+
1
+
1
+
1
+
5
+
8
);
bs_skip
(
&
s
,
8
+
1
+
1
+
1
+
5
+
8
);
/* sps id */
/* sps id */
bs_read_ue
(
&
s
);
i_sps_id
=
bs_read_ue
(
&
s
);
if
(
i_sps_id
>=
SPS_MAX
)
{
msg_Warn
(
p_dec
,
"invalid SPS (sps_id=%d)"
,
i_sps_id
);
free
(
pb_dec
);
block_Release
(
p_frag
);
return
;
}
/* Skip i_log2_max_frame_num */
/* Skip i_log2_max_frame_num */
p_sys
->
i_log2_max_frame_num
=
bs_read_ue
(
&
s
);
p_sys
->
i_log2_max_frame_num
=
bs_read_ue
(
&
s
);
if
(
p_sys
->
i_log2_max_frame_num
>
12
)
if
(
p_sys
->
i_log2_max_frame_num
>
12
)
...
@@ -802,9 +808,13 @@ static void PutSPS( decoder_t *p_dec, block_t *p_frag )
...
@@ -802,9 +808,13 @@ static void PutSPS( decoder_t *p_dec, block_t *p_frag )
}
}
}
}
free
(
dec
);
free
(
pb_
dec
);
/* We have a new SPS */
/* We have a new SPS */
if
(
!
p_sys
->
b_sps
)
msg_Dbg
(
p_dec
,
"found NAL_SPS (sps_id=%d)"
,
i_sps_id
);
p_sys
->
b_sps
=
true
;
if
(
p_sys
->
p_sps
)
if
(
p_sys
->
p_sps
)
block_Release
(
p_sys
->
p_sps
);
block_Release
(
p_sys
->
p_sps
);
p_sys
->
p_sps
=
p_frag
;
p_sys
->
p_sps
=
p_frag
;
...
@@ -814,20 +824,27 @@ static void PutPPS( decoder_t *p_dec, block_t *p_frag )
...
@@ -814,20 +824,27 @@ static void PutPPS( decoder_t *p_dec, block_t *p_frag )
{
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
bs_t
s
;
bs_t
s
;
int
i_pps_id
;
int
i_sps_id
;
bs_init
(
&
s
,
&
p_frag
->
p_buffer
[
5
],
p_frag
->
i_buffer
-
5
);
bs_init
(
&
s
,
&
p_frag
->
p_buffer
[
5
],
p_frag
->
i_buffer
-
5
);
bs_read_ue
(
&
s
);
// pps id
i_pps_id
=
bs_read_ue
(
&
s
);
// pps id
bs_read_ue
(
&
s
);
// sps id
i_sps_id
=
bs_read_ue
(
&
s
);
// sps id
if
(
i_pps_id
>=
PPS_MAX
||
i_sps_id
>=
SPS_MAX
)
{
msg_Warn
(
p_dec
,
"invalid PPS (pps_id=%d sps_id=%d)"
,
i_pps_id
,
i_sps_id
);
block_Release
(
p_frag
);
return
;
}
bs_skip
(
&
s
,
1
);
// entropy coding mode flag
bs_skip
(
&
s
,
1
);
// entropy coding mode flag
p_sys
->
i_pic_order_present_flag
=
bs_read
(
&
s
,
1
);
p_sys
->
i_pic_order_present_flag
=
bs_read
(
&
s
,
1
);
/* TODO */
/* We have a new PPS */
if
(
!
p_sys
->
b_pps
)
if
(
!
p_sys
->
b_pps
)
msg_Dbg
(
p_dec
,
"found NAL_PPS
"
);
msg_Dbg
(
p_dec
,
"found NAL_PPS
(pps_id=%d sps_id=%d)"
,
i_pps_id
,
i_sps_id
);
p_sys
->
b_pps
=
true
;
p_sys
->
b_pps
=
true
;
/* TODO */
/* We have a new PPS */
if
(
p_sys
->
p_pps
)
if
(
p_sys
->
p_pps
)
block_Release
(
p_sys
->
p_pps
);
block_Release
(
p_sys
->
p_pps
);
p_sys
->
p_pps
=
p_frag
;
p_sys
->
p_pps
=
p_frag
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment