Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
199fb402
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
199fb402
编写于
2月 24, 2015
作者:
M
Martin Storsjö
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rtpdec: Use ffio_free_dyn_buf
Signed-off-by:
N
Martin Storsjö
<
martin@martin.st
>
上级
8a273a74
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
39 addition
and
127 deletion
+39
-127
libavformat/rtpdec_ac3.c
libavformat/rtpdec_ac3.c
+5
-14
libavformat/rtpdec_asf.c
libavformat/rtpdec_asf.c
+2
-10
libavformat/rtpdec_dv.c
libavformat/rtpdec_dv.c
+3
-10
libavformat/rtpdec_h261.c
libavformat/rtpdec_h261.c
+3
-12
libavformat/rtpdec_h263_rfc2190.c
libavformat/rtpdec_h263_rfc2190.c
+3
-9
libavformat/rtpdec_jpeg.c
libavformat/rtpdec_jpeg.c
+4
-13
libavformat/rtpdec_latm.c
libavformat/rtpdec_latm.c
+3
-9
libavformat/rtpdec_mpa_robust.c
libavformat/rtpdec_mpa_robust.c
+4
-13
libavformat/rtpdec_svq3.c
libavformat/rtpdec_svq3.c
+3
-10
libavformat/rtpdec_vp8.c
libavformat/rtpdec_vp8.c
+5
-14
libavformat/rtpdec_xiph.c
libavformat/rtpdec_xiph.c
+4
-13
未找到文件。
libavformat/rtpdec_ac3.c
浏览文件 @
199fb402
...
...
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
#include "avio_internal.h"
#include "rtpdec_formats.h"
#define RTP_AC3_PAYLOAD_HEADER_SIZE 2
...
...
@@ -31,19 +32,9 @@ struct PayloadContext {
AVIOContext
*
fragment
;
};
static
void
free_fragment
(
PayloadContext
*
data
)
{
if
(
data
->
fragment
)
{
uint8_t
*
p
;
avio_close_dyn_buf
(
data
->
fragment
,
&
p
);
av_free
(
p
);
data
->
fragment
=
NULL
;
}
}
static
void
ac3_free_context
(
PayloadContext
*
data
)
{
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
}
static
int
ac3_handle_packet
(
AVFormatContext
*
ctx
,
PayloadContext
*
data
,
...
...
@@ -82,7 +73,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
case
1
:
case
2
:
/* First fragment */
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
data
->
last_frame
=
1
;
data
->
nr_frames
=
nr_frames
;
...
...
@@ -102,7 +93,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
}
if
(
nr_frames
!=
data
->
nr_frames
||
data
->
timestamp
!=
*
timestamp
)
{
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid packet received
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
@@ -115,7 +106,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
return
AVERROR
(
EAGAIN
);
if
(
data
->
last_frame
!=
data
->
nr_frames
)
{
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Missed %d packets
\n
"
,
data
->
nr_frames
-
data
->
last_frame
);
return
AVERROR_INVALIDDATA
;
...
...
libavformat/rtpdec_asf.c
浏览文件 @
199fb402
...
...
@@ -213,10 +213,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
* multiple RTP packets.
*/
if
(
asf
->
pktbuf
&&
len_off
!=
avio_tell
(
asf
->
pktbuf
))
{
uint8_t
*
p
;
avio_close_dyn_buf
(
asf
->
pktbuf
,
&
p
);
asf
->
pktbuf
=
NULL
;
av_free
(
p
);
ffio_free_dyn_buf
(
&
asf
->
pktbuf
);
}
if
(
!
len_off
&&
!
asf
->
pktbuf
&&
(
res
=
avio_open_dyn_buf
(
&
asf
->
pktbuf
))
<
0
)
...
...
@@ -279,12 +276,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
static
void
asfrtp_free_context
(
PayloadContext
*
asf
)
{
if
(
asf
->
pktbuf
)
{
uint8_t
*
p
=
NULL
;
avio_close_dyn_buf
(
asf
->
pktbuf
,
&
p
);
asf
->
pktbuf
=
NULL
;
av_free
(
p
);
}
ffio_free_dyn_buf
(
&
asf
->
pktbuf
);
av_freep
(
&
asf
->
buf
);
av_free
(
asf
);
}
...
...
libavformat/rtpdec_dv.c
浏览文件 @
199fb402
...
...
@@ -23,6 +23,7 @@
#include "libavcodec/bytestream.h"
#include "avio_internal.h"
#include "rtpdec_formats.h"
struct
PayloadContext
{
...
...
@@ -31,17 +32,9 @@ struct PayloadContext {
int
bundled_audio
;
};
static
void
dv_free_dyn_buffer
(
AVIOContext
**
dyn_buf
)
{
uint8_t
*
ptr_dyn_buffer
;
avio_close_dyn_buf
(
*
dyn_buf
,
&
ptr_dyn_buffer
);
av_free
(
ptr_dyn_buffer
);
*
dyn_buf
=
NULL
;
}
static
av_cold
void
dv_free_context
(
PayloadContext
*
data
)
{
dv_free_dyn_buffer
(
&
data
->
buf
);
ffio_free_dyn_buf
(
&
data
->
buf
);
}
static
av_cold
int
dv_sdp_parse_fmtp_config
(
AVFormatContext
*
s
,
...
...
@@ -104,7 +97,7 @@ static int dv_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_dv_ctx,
/* drop data of previous packets in case of non-continuous (lossy) packet stream */
if
(
rtp_dv_ctx
->
buf
&&
rtp_dv_ctx
->
timestamp
!=
*
timestamp
)
{
dv_free_dyn_buffer
(
&
rtp_dv_ctx
->
buf
);
ffio_free_dyn_buf
(
&
rtp_dv_ctx
->
buf
);
}
/* sanity check for size of input packet: 1 byte payload at least */
...
...
libavformat/rtpdec_h261.c
浏览文件 @
199fb402
...
...
@@ -21,6 +21,7 @@
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "avio_internal.h"
#include "rtpdec_formats.h"
#define RTP_H261_PAYLOAD_HEADER_SIZE 4
...
...
@@ -32,14 +33,6 @@ struct PayloadContext {
uint32_t
timestamp
;
};
static
void
h261_free_dyn_buffer
(
AVIOContext
**
dyn_buf
)
{
uint8_t
*
ptr_dyn_buffer
;
avio_close_dyn_buf
(
*
dyn_buf
,
&
ptr_dyn_buffer
);
av_free
(
ptr_dyn_buffer
);
*
dyn_buf
=
NULL
;
}
static
av_cold
void
h261_free_context
(
PayloadContext
*
pl_ctx
)
{
/* return if context is invalid */
...
...
@@ -47,9 +40,7 @@ static av_cold void h261_free_context(PayloadContext *pl_ctx)
return
;
/* free buffer if it is valid */
if
(
pl_ctx
->
buf
)
{
h261_free_dyn_buffer
(
&
pl_ctx
->
buf
);
}
ffio_free_dyn_buf
(
&
pl_ctx
->
buf
);
}
static
int
h261_handle_packet
(
AVFormatContext
*
ctx
,
PayloadContext
*
rtp_h261_ctx
,
...
...
@@ -62,7 +53,7 @@ static int h261_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_h261_ctx
/* drop data of previous packets in case of non-continuous (lossy) packet stream */
if
(
rtp_h261_ctx
->
buf
&&
rtp_h261_ctx
->
timestamp
!=
*
timestamp
)
{
h261_free_dyn_buffer
(
&
rtp_h261_ctx
->
buf
);
ffio_free_dyn_buf
(
&
rtp_h261_ctx
->
buf
);
rtp_h261_ctx
->
endbyte_bits
=
0
;
}
...
...
libavformat/rtpdec_h263_rfc2190.c
浏览文件 @
199fb402
...
...
@@ -26,6 +26,7 @@
*/
#include "avformat.h"
#include "avio_internal.h"
#include "rtpdec_formats.h"
#include "libavutil/attributes.h"
#include "libavutil/intreadwrite.h"
...
...
@@ -41,11 +42,7 @@ struct PayloadContext {
static
void
h263_free_context
(
PayloadContext
*
data
)
{
if
(
data
->
buf
)
{
uint8_t
*
p
;
avio_close_dyn_buf
(
data
->
buf
,
&
p
);
av_free
(
p
);
}
ffio_free_dyn_buf
(
&
data
->
buf
);
}
static
int
h263_handle_packet
(
AVFormatContext
*
ctx
,
PayloadContext
*
data
,
...
...
@@ -63,10 +60,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
if
(
data
->
buf
&&
data
->
timestamp
!=
*
timestamp
)
{
/* Dropping old buffered, unfinished data */
uint8_t
*
p
;
avio_close_dyn_buf
(
data
->
buf
,
&
p
);
av_free
(
p
);
data
->
buf
=
NULL
;
ffio_free_dyn_buf
(
&
data
->
buf
);
data
->
endbyte_bits
=
0
;
}
...
...
libavformat/rtpdec_jpeg.c
浏览文件 @
199fb402
...
...
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
#include "avio_internal.h"
#include "rtpdec.h"
#include "rtpdec_formats.h"
#include "libavutil/intreadwrite.h"
...
...
@@ -59,19 +60,9 @@ static const uint8_t default_quantizers[128] = {
99
,
99
,
99
,
99
,
99
,
99
,
99
,
99
};
static
void
free_frame
(
PayloadContext
*
jpeg
)
{
if
(
jpeg
->
frame
)
{
uint8_t
*
p
;
avio_close_dyn_buf
(
jpeg
->
frame
,
&
p
);
av_free
(
p
);
jpeg
->
frame
=
NULL
;
}
}
static
void
jpeg_free_context
(
PayloadContext
*
jpeg
)
{
f
ree_frame
(
jpeg
);
f
fio_free_dyn_buf
(
&
jpeg
->
frame
);
}
static
int
jpeg_create_huffman_table
(
PutByteContext
*
p
,
int
table_class
,
...
...
@@ -315,7 +306,7 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
/* Skip the current frame in case of the end packet
* has been lost somewhere. */
f
ree_frame
(
jpeg
);
f
fio_free_dyn_buf
(
&
jpeg
->
frame
);
if
((
ret
=
avio_open_dyn_buf
(
&
jpeg
->
frame
))
<
0
)
return
ret
;
...
...
@@ -341,7 +332,7 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
if
(
jpeg
->
timestamp
!=
*
timestamp
)
{
/* Skip the current frame if timestamp is incorrect.
* A start packet has been lost somewhere. */
f
ree_frame
(
jpeg
);
f
fio_free_dyn_buf
(
&
jpeg
->
frame
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"RTP timestamps don't match.
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
libavformat/rtpdec_latm.c
浏览文件 @
199fb402
...
...
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avio_internal.h"
#include "rtpdec_formats.h"
#include "internal.h"
#include "libavutil/avstring.h"
...
...
@@ -33,11 +34,7 @@ struct PayloadContext {
static
void
latm_free_context
(
PayloadContext
*
data
)
{
if
(
data
->
dyn_buf
)
{
uint8_t
*
p
;
avio_close_dyn_buf
(
data
->
dyn_buf
,
&
p
);
av_free
(
p
);
}
ffio_free_dyn_buf
(
&
data
->
dyn_buf
);
av_free
(
data
->
buf
);
}
...
...
@@ -51,10 +48,7 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data,
if
(
buf
)
{
if
(
!
data
->
dyn_buf
||
data
->
timestamp
!=
*
timestamp
)
{
av_freep
(
&
data
->
buf
);
if
(
data
->
dyn_buf
)
avio_close_dyn_buf
(
data
->
dyn_buf
,
&
data
->
buf
);
data
->
dyn_buf
=
NULL
;
av_freep
(
&
data
->
buf
);
ffio_free_dyn_buf
(
&
data
->
dyn_buf
);
data
->
timestamp
=
*
timestamp
;
if
((
ret
=
avio_open_dyn_buf
(
&
data
->
dyn_buf
))
<
0
)
...
...
libavformat/rtpdec_mpa_robust.c
浏览文件 @
199fb402
...
...
@@ -22,6 +22,7 @@
#include "libavutil/attributes.h"
#include "libavutil/intreadwrite.h"
#include "avio_internal.h"
#include "rtpdec_formats.h"
struct
PayloadContext
{
...
...
@@ -33,19 +34,9 @@ struct PayloadContext {
AVIOContext
*
fragment
;
};
static
void
free_fragment
(
PayloadContext
*
data
)
{
if
(
data
->
fragment
)
{
uint8_t
*
p
;
avio_close_dyn_buf
(
data
->
fragment
,
&
p
);
av_free
(
p
);
data
->
fragment
=
NULL
;
}
}
static
void
mpa_robust_free_context
(
PayloadContext
*
data
)
{
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
av_free
(
data
->
split_buf
);
}
...
...
@@ -154,7 +145,7 @@ static int mpa_robust_parse_packet(AVFormatContext *ctx, PayloadContext *data,
return
0
;
}
else
if
(
!
continuation
)
{
/* && adu_size > len */
/* First fragment */
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
data
->
adu_size
=
adu_size
;
data
->
cur_size
=
len
;
...
...
@@ -177,7 +168,7 @@ static int mpa_robust_parse_packet(AVFormatContext *ctx, PayloadContext *data,
}
if
(
adu_size
=
data
->
adu_size
||
data
->
timestamp
!=
*
timestamp
)
{
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid packet received
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
libavformat/rtpdec_svq3.c
浏览文件 @
199fb402
...
...
@@ -28,6 +28,7 @@
#include <string.h>
#include "libavutil/intreadwrite.h"
#include "avio_internal.h"
#include "rtp.h"
#include "rtpdec.h"
#include "rtpdec_formats.h"
...
...
@@ -82,11 +83,7 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
if
(
start_packet
)
{
int
res
;
if
(
sv
->
pktbuf
)
{
uint8_t
*
tmp
;
avio_close_dyn_buf
(
sv
->
pktbuf
,
&
tmp
);
av_free
(
tmp
);
}
ffio_free_dyn_buf
(
&
sv
->
pktbuf
);
if
((
res
=
avio_open_dyn_buf
(
&
sv
->
pktbuf
))
<
0
)
return
res
;
sv
->
timestamp
=
*
timestamp
;
...
...
@@ -111,11 +108,7 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
static
void
svq3_extradata_free
(
PayloadContext
*
sv
)
{
if
(
sv
->
pktbuf
)
{
uint8_t
*
buf
;
avio_close_dyn_buf
(
sv
->
pktbuf
,
&
buf
);
av_free
(
buf
);
}
ffio_free_dyn_buf
(
&
sv
->
pktbuf
);
}
RTPDynamicProtocolHandler
ff_svq3_dynamic_handler
=
{
...
...
libavformat/rtpdec_vp8.c
浏览文件 @
199fb402
...
...
@@ -29,6 +29,7 @@
#include "libavcodec/bytestream.h"
#include "avio_internal.h"
#include "rtpdec_formats.h"
struct
PayloadContext
{
...
...
@@ -52,22 +53,12 @@ struct PayloadContext {
int
got_keyframe
;
};
static
void
vp8_free_buffer
(
PayloadContext
*
vp8
)
{
uint8_t
*
tmp
;
if
(
!
vp8
->
data
)
return
;
avio_close_dyn_buf
(
vp8
->
data
,
&
tmp
);
av_free
(
tmp
);
vp8
->
data
=
NULL
;
}
static
int
vp8_broken_sequence
(
AVFormatContext
*
ctx
,
PayloadContext
*
vp8
,
const
char
*
msg
)
{
vp8
->
sequence_ok
=
0
;
av_log
(
ctx
,
AV_LOG_WARNING
,
"%s"
,
msg
);
vp8_free_buffer
(
vp8
);
ffio_free_dyn_buf
(
&
vp8
->
data
);
return
AVERROR
(
EAGAIN
);
}
...
...
@@ -150,7 +141,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
int
res
;
int
non_key
=
buf
[
0
]
&
0x01
;
if
(
!
non_key
)
{
vp8_free_buffer
(
vp8
);
ffio_free_dyn_buf
(
&
vp8
->
data
);
// Keyframe, decoding ok again
vp8
->
sequence_ok
=
1
;
vp8
->
sequence_dirty
=
0
;
...
...
@@ -205,7 +196,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
old_timestamp
=
vp8
->
timestamp
;
}
else
{
// Shouldn't happen
vp8_free_buffer
(
vp8
);
ffio_free_dyn_buf
(
&
vp8
->
data
);
}
}
}
...
...
@@ -277,7 +268,7 @@ static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp
static
void
vp8_free_context
(
PayloadContext
*
vp8
)
{
vp8_free_buffer
(
vp8
);
ffio_free_dyn_buf
(
&
vp8
->
data
);
}
static
int
vp8_need_keyframe
(
PayloadContext
*
vp8
)
...
...
libavformat/rtpdec_xiph.c
浏览文件 @
199fb402
...
...
@@ -34,6 +34,7 @@
#include <assert.h>
#include "avio_internal.h"
#include "rtpdec.h"
#include "rtpdec_formats.h"
...
...
@@ -49,19 +50,9 @@ struct PayloadContext {
int
split_pkts
;
};
static
void
free_fragment
(
PayloadContext
*
data
)
{
if
(
data
->
fragment
)
{
uint8_t
*
p
;
avio_close_dyn_buf
(
data
->
fragment
,
&
p
);
av_free
(
p
);
data
->
fragment
=
NULL
;
}
}
static
void
xiph_free_context
(
PayloadContext
*
data
)
{
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
av_free
(
data
->
split_buf
);
}
...
...
@@ -168,7 +159,7 @@ static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
int
res
;
// end packet has been lost somewhere, so drop buffered data
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
if
((
res
=
avio_open_dyn_buf
(
&
data
->
fragment
))
<
0
)
return
res
;
...
...
@@ -181,7 +172,7 @@ static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
if
(
data
->
timestamp
!=
*
timestamp
)
{
// skip if fragmented timestamp is incorrect;
// a start packet has been lost somewhere
f
ree_fragment
(
data
);
f
fio_free_dyn_buf
(
&
data
->
fragment
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"RTP timestamps don't match!
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录