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
f3449062
Commit
f3449062
authored
Feb 23, 2015
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtpdec_hevc: Reduce indentation level by returning early on errors
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
8633fb47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
rtpdec_hevc.c
libavformat/rtpdec_hevc.c
+29
-29
No files found.
libavformat/rtpdec_hevc.c
View file @
f3449062
...
...
@@ -315,39 +315,39 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx
av_dlog
(
ctx
,
" FU type %d with %d bytes
\n
"
,
fu_type
,
len
);
if
(
len
>
0
)
{
new_nal_header
[
0
]
=
(
rtp_pl
[
0
]
&
0x81
)
|
(
fu_type
<<
1
);
new_nal_header
[
1
]
=
rtp_pl
[
1
];
/* start fragment vs. subsequent fragments */
if
(
first_fragment
)
{
if
(
!
last_fragment
)
{
/* create A/V packet which is big enough */
if
((
res
=
av_new_packet
(
pkt
,
sizeof
(
start_sequence
)
+
sizeof
(
new_nal_header
)
+
len
))
<
0
)
return
res
;
/* A/V packet: copy start sequence */
memcpy
(
pkt
->
data
,
start_sequence
,
sizeof
(
start_sequence
));
/* A/V packet: copy new NAL header */
memcpy
(
pkt
->
data
+
sizeof
(
start_sequence
),
new_nal_header
,
sizeof
(
new_nal_header
));
/* A/V packet: copy NAL unit data */
memcpy
(
pkt
->
data
+
sizeof
(
start_sequence
)
+
sizeof
(
new_nal_header
),
buf
,
len
);
}
else
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Illegal combination of S and E bit in RTP/HEVC packet
\n
"
);
res
=
AVERROR_INVALIDDATA
;
}
}
else
{
/* create A/V packet */
if
((
res
=
av_new_packet
(
pkt
,
len
))
<
0
)
return
res
;
/* A/V packet: copy NAL unit data */
memcpy
(
pkt
->
data
,
buf
,
len
);
}
}
else
{
if
(
len
<=
0
)
{
/* sanity check for size of input packet: 1 byte payload at least */
av_log
(
ctx
,
AV_LOG_ERROR
,
"Too short RTP/HEVC packet, got %d bytes of NAL unit type %d
\n
"
,
len
,
nal_type
);
res
=
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
if
(
first_fragment
&&
last_fragment
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Illegal combination of S and E bit in RTP/HEVC packet
\n
"
);
return
AVERROR_INVALIDDATA
;
}
new_nal_header
[
0
]
=
(
rtp_pl
[
0
]
&
0x81
)
|
(
fu_type
<<
1
);
new_nal_header
[
1
]
=
rtp_pl
[
1
];
/* start fragment vs. subsequent fragments */
if
(
first_fragment
)
{
/* create A/V packet which is big enough */
if
((
res
=
av_new_packet
(
pkt
,
sizeof
(
start_sequence
)
+
sizeof
(
new_nal_header
)
+
len
))
<
0
)
return
res
;
/* A/V packet: copy start sequence */
memcpy
(
pkt
->
data
,
start_sequence
,
sizeof
(
start_sequence
));
/* A/V packet: copy new NAL header */
memcpy
(
pkt
->
data
+
sizeof
(
start_sequence
),
new_nal_header
,
sizeof
(
new_nal_header
));
/* A/V packet: copy NAL unit data */
memcpy
(
pkt
->
data
+
sizeof
(
start_sequence
)
+
sizeof
(
new_nal_header
),
buf
,
len
);
}
else
{
/* create A/V packet */
if
((
res
=
av_new_packet
(
pkt
,
len
))
<
0
)
return
res
;
/* A/V packet: copy NAL unit data */
memcpy
(
pkt
->
data
,
buf
,
len
);
}
break
;
...
...
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