Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
c18838f5
Commit
c18838f5
authored
Aug 19, 2013
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264_ps: Use more meaningful error values
parent
330ad1f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
h264_ps.c
libavcodec/h264_ps.c
+12
-12
No files found.
libavcodec/h264_ps.c
View file @
c18838f5
...
@@ -110,7 +110,7 @@ static inline int decode_hrd_parameters(H264Context *h, SPS *sps)
...
@@ -110,7 +110,7 @@ static inline int decode_hrd_parameters(H264Context *h, SPS *sps)
if
(
cpb_count
>
32U
)
{
if
(
cpb_count
>
32U
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"cpb_count %d invalid
\n
"
,
cpb_count
);
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"cpb_count %d invalid
\n
"
,
cpb_count
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
get_bits
(
&
h
->
gb
,
4
);
/* bit_rate_scale */
get_bits
(
&
h
->
gb
,
4
);
/* bit_rate_scale */
...
@@ -144,7 +144,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
...
@@ -144,7 +144,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
sps
->
sar
=
pixel_aspect
[
aspect_ratio_idc
];
sps
->
sar
=
pixel_aspect
[
aspect_ratio_idc
];
}
else
{
}
else
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"illegal aspect ratio
\n
"
);
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"illegal aspect ratio
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
}
else
{
}
else
{
sps
->
sar
.
num
=
sps
->
sar
.
num
=
...
@@ -188,7 +188,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
...
@@ -188,7 +188,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"time_scale/num_units_in_tick invalid or unsupported (%d/%d)
\n
"
,
"time_scale/num_units_in_tick invalid or unsupported (%d/%d)
\n
"
,
sps
->
time_scale
,
sps
->
num_units_in_tick
);
sps
->
time_scale
,
sps
->
num_units_in_tick
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
sps
->
fixed_frame_rate_flag
=
get_bits1
(
&
h
->
gb
);
sps
->
fixed_frame_rate_flag
=
get_bits1
(
&
h
->
gb
);
}
}
...
@@ -196,11 +196,11 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
...
@@ -196,11 +196,11 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
sps
->
nal_hrd_parameters_present_flag
=
get_bits1
(
&
h
->
gb
);
sps
->
nal_hrd_parameters_present_flag
=
get_bits1
(
&
h
->
gb
);
if
(
sps
->
nal_hrd_parameters_present_flag
)
if
(
sps
->
nal_hrd_parameters_present_flag
)
if
(
decode_hrd_parameters
(
h
,
sps
)
<
0
)
if
(
decode_hrd_parameters
(
h
,
sps
)
<
0
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
sps
->
vcl_hrd_parameters_present_flag
=
get_bits1
(
&
h
->
gb
);
sps
->
vcl_hrd_parameters_present_flag
=
get_bits1
(
&
h
->
gb
);
if
(
sps
->
vcl_hrd_parameters_present_flag
)
if
(
sps
->
vcl_hrd_parameters_present_flag
)
if
(
decode_hrd_parameters
(
h
,
sps
)
<
0
)
if
(
decode_hrd_parameters
(
h
,
sps
)
<
0
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
if
(
sps
->
nal_hrd_parameters_present_flag
||
if
(
sps
->
nal_hrd_parameters_present_flag
||
sps
->
vcl_hrd_parameters_present_flag
)
sps
->
vcl_hrd_parameters_present_flag
)
get_bits1
(
&
h
->
gb
);
/* low_delay_hrd_flag */
get_bits1
(
&
h
->
gb
);
/* low_delay_hrd_flag */
...
@@ -225,7 +225,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
...
@@ -225,7 +225,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
/* max_dec_frame_buffering || max_dec_frame_buffering > 16 */
)
{
/* max_dec_frame_buffering || max_dec_frame_buffering > 16 */
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"illegal num_reorder_frames %d
\n
"
,
sps
->
num_reorder_frames
);
"illegal num_reorder_frames %d
\n
"
,
sps
->
num_reorder_frames
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
}
}
if
(
get_bits_left
(
&
h
->
gb
)
<
0
)
{
if
(
get_bits_left
(
&
h
->
gb
)
<
0
)
{
...
@@ -310,11 +310,11 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
...
@@ -310,11 +310,11 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
if
(
sps_id
>=
MAX_SPS_COUNT
)
{
if
(
sps_id
>=
MAX_SPS_COUNT
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"sps_id (%d) out of range
\n
"
,
sps_id
);
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"sps_id (%d) out of range
\n
"
,
sps_id
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
sps
=
av_mallocz
(
sizeof
(
SPS
));
sps
=
av_mallocz
(
sizeof
(
SPS
));
if
(
sps
==
NULL
)
if
(
!
sps
)
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
sps
->
time_offset_length
=
24
;
sps
->
time_offset_length
=
24
;
sps
->
profile_idc
=
profile_idc
;
sps
->
profile_idc
=
profile_idc
;
...
@@ -521,7 +521,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
...
@@ -521,7 +521,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
if
(
pps_id
>=
MAX_PPS_COUNT
)
{
if
(
pps_id
>=
MAX_PPS_COUNT
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"pps_id (%d) out of range
\n
"
,
pps_id
);
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"pps_id (%d) out of range
\n
"
,
pps_id
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
else
if
(
h
->
sps
.
bit_depth_luma
>
10
)
{
}
else
if
(
h
->
sps
.
bit_depth_luma
>
10
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"Unimplemented luma bit depth=%d (max=10)
\n
"
,
"Unimplemented luma bit depth=%d (max=10)
\n
"
,
...
@@ -530,8 +530,8 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
...
@@ -530,8 +530,8 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
}
}
pps
=
av_mallocz
(
sizeof
(
PPS
));
pps
=
av_mallocz
(
sizeof
(
PPS
));
if
(
pps
==
NULL
)
if
(
!
pps
)
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
pps
->
sps_id
=
get_ue_golomb_31
(
&
h
->
gb
);
pps
->
sps_id
=
get_ue_golomb_31
(
&
h
->
gb
);
if
((
unsigned
)
pps
->
sps_id
>=
MAX_SPS_COUNT
||
if
((
unsigned
)
pps
->
sps_id
>=
MAX_SPS_COUNT
||
h
->
sps_buffers
[
pps
->
sps_id
]
==
NULL
)
{
h
->
sps_buffers
[
pps
->
sps_id
]
==
NULL
)
{
...
...
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