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
94025d8a
Commit
94025d8a
authored
Feb 29, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvorbis: check return values for functions that can return errors
parent
c5063e03
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
libvorbis.c
libavcodec/libvorbis.c
+15
-7
No files found.
libavcodec/libvorbis.c
View file @
94025d8a
...
@@ -237,7 +237,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
...
@@ -237,7 +237,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
OggVorbisContext
*
s
=
avctx
->
priv_data
;
OggVorbisContext
*
s
=
avctx
->
priv_data
;
ogg_packet
op
;
ogg_packet
op
;
float
*
audio
=
data
;
float
*
audio
=
data
;
int
pkt_size
;
int
pkt_size
,
ret
;
/* send samples to libvorbis */
/* send samples to libvorbis */
if
(
data
)
{
if
(
data
)
{
...
@@ -253,20 +253,24 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
...
@@ -253,20 +253,24 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
for
(
i
=
0
;
i
<
samples
;
i
++
)
for
(
i
=
0
;
i
<
samples
;
i
++
)
buffer
[
c
][
i
]
=
audio
[
i
*
channels
+
co
];
buffer
[
c
][
i
]
=
audio
[
i
*
channels
+
co
];
}
}
vorbis_analysis_wrote
(
&
s
->
vd
,
samples
);
if
((
ret
=
vorbis_analysis_wrote
(
&
s
->
vd
,
samples
))
<
0
)
return
vorbis_error_to_averror
(
ret
);
}
else
{
}
else
{
if
(
!
s
->
eof
)
if
(
!
s
->
eof
)
vorbis_analysis_wrote
(
&
s
->
vd
,
0
);
if
((
ret
=
vorbis_analysis_wrote
(
&
s
->
vd
,
0
))
<
0
)
return
vorbis_error_to_averror
(
ret
);
s
->
eof
=
1
;
s
->
eof
=
1
;
}
}
/* retrieve available packets from libvorbis */
/* retrieve available packets from libvorbis */
while
(
vorbis_analysis_blockout
(
&
s
->
vd
,
&
s
->
vb
)
==
1
)
{
while
((
ret
=
vorbis_analysis_blockout
(
&
s
->
vd
,
&
s
->
vb
))
==
1
)
{
vorbis_analysis
(
&
s
->
vb
,
NULL
);
if
((
ret
=
vorbis_analysis
(
&
s
->
vb
,
NULL
))
<
0
)
vorbis_bitrate_addblock
(
&
s
->
vb
);
break
;
if
((
ret
=
vorbis_bitrate_addblock
(
&
s
->
vb
))
<
0
)
break
;
/* add any available packets to the output packet buffer */
/* add any available packets to the output packet buffer */
while
(
vorbis_bitrate_flushpacket
(
&
s
->
vd
,
&
op
)
)
{
while
(
(
ret
=
vorbis_bitrate_flushpacket
(
&
s
->
vd
,
&
op
))
==
1
)
{
/* i'd love to say the following line is a hack, but sadly it's
/* i'd love to say the following line is a hack, but sadly it's
* not, apparently the end of stream decision is in libogg. */
* not, apparently the end of stream decision is in libogg. */
if
(
op
.
bytes
==
1
&&
op
.
e_o_s
)
if
(
op
.
bytes
==
1
&&
op
.
e_o_s
)
...
@@ -280,7 +284,11 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
...
@@ -280,7 +284,11 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
memcpy
(
s
->
buffer
+
s
->
buffer_index
,
op
.
packet
,
op
.
bytes
);
memcpy
(
s
->
buffer
+
s
->
buffer_index
,
op
.
packet
,
op
.
bytes
);
s
->
buffer_index
+=
op
.
bytes
;
s
->
buffer_index
+=
op
.
bytes
;
}
}
if
(
ret
<
0
)
break
;
}
}
if
(
ret
<
0
)
return
vorbis_error_to_averror
(
ret
);
/* output then next packet from the output buffer, if available */
/* output then next packet from the output buffer, if available */
pkt_size
=
0
;
pkt_size
=
0
;
...
...
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