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
394fb56c
Commit
394fb56c
authored
Feb 04, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf: always unref the packet passed to av_interleaved_write_frame() on error
parent
682b2a80
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
avformat.h
libavformat/avformat.h
+2
-1
mux.c
libavformat/mux.c
+18
-7
No files found.
libavformat/avformat.h
View file @
394fb56c
...
...
@@ -1589,7 +1589,8 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
* correct values.
* @endparblock
*
* @return 0 on success, a negative AVERROR on error.
* @return 0 on success, a negative AVERROR on error. Libavformat will always
* take care of freeing the packet, even if this function fails.
*
* @see av_write_frame(), AVFormatContext.max_interleave_delta
*/
...
...
libavformat/mux.c
View file @
394fb56c
...
...
@@ -619,22 +619,26 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
ret
=
check_packet
(
s
,
pkt
);
if
(
ret
<
0
)
return
ret
;
goto
fail
;
if
(
pkt
)
{
AVStream
*
st
=
s
->
streams
[
pkt
->
stream_index
];
//FIXME/XXX/HACK drop zero sized packets
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
&&
pkt
->
size
==
0
)
return
0
;
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
&&
pkt
->
size
==
0
)
{
ret
=
0
;
goto
fail
;
}
av_dlog
(
s
,
"av_interleaved_write_frame size:%d dts:%"
PRId64
" pts:%"
PRId64
"
\n
"
,
pkt
->
size
,
pkt
->
dts
,
pkt
->
pts
);
if
((
ret
=
compute_pkt_fields2
(
s
,
st
,
pkt
))
<
0
&&
!
(
s
->
oformat
->
flags
&
AVFMT_NOTIMESTAMPS
))
return
ret
;
goto
fail
;
if
(
pkt
->
dts
==
AV_NOPTS_VALUE
&&
!
(
s
->
oformat
->
flags
&
AVFMT_NOTIMESTAMPS
))
return
AVERROR
(
EINVAL
);
if
(
pkt
->
dts
==
AV_NOPTS_VALUE
&&
!
(
s
->
oformat
->
flags
&
AVFMT_NOTIMESTAMPS
))
{
ret
=
AVERROR
(
EINVAL
);
goto
fail
;
}
}
else
{
av_dlog
(
s
,
"av_interleaved_write_frame FLUSH
\n
"
);
flush
=
1
;
...
...
@@ -643,6 +647,11 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
for
(;;
)
{
AVPacket
opkt
;
int
ret
=
interleave_packet
(
s
,
&
opkt
,
pkt
,
flush
);
if
(
pkt
)
{
memset
(
pkt
,
0
,
sizeof
(
*
pkt
));
av_init_packet
(
pkt
);
pkt
=
NULL
;
}
if
(
ret
<=
0
)
//FIXME cleanup needed for ret<0 ?
return
ret
;
...
...
@@ -651,11 +660,13 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
s
->
streams
[
opkt
.
stream_index
]
->
nb_frames
++
;
av_free_packet
(
&
opkt
);
pkt
=
NULL
;
if
(
ret
<
0
)
return
ret
;
}
fail:
av_packet_unref
(
pkt
);
return
ret
;
}
int
av_write_trailer
(
AVFormatContext
*
s
)
...
...
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