Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-06-06 21:23:57 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a1dd73431864b6285bc94e557ddbc8d9b077383b
a1dd7343
1 parent
679b4317
fix #421, drop video for unkown RTMP header.
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
42 行增加
和
1 行删除
README.md
trunk/src/app/srs_app_source.cpp
trunk/src/kernel/srs_kernel_codec.cpp
trunk/src/kernel/srs_kernel_codec.hpp
README.md
查看文件 @
a1dd734
...
...
@@ -344,7 +344,8 @@ Remark:
### SRS 2.0 history
*
v2.0, 2015-05-30, fix
[
#420
](
https://github.com/simple-rtmp-server/srs/issues/420
)
remove ts for hls ram mode.
*
v2.0, 2015-06-06, fix
[
#421
](
https://github.com/simple-rtmp-server/srs/issues/421
)
drop video for unkown RTMP header.
*
v2.0, 2015-06-05, fix
[
#420
](
https://github.com/simple-rtmp-server/srs/issues/420
)
remove ts for hls ram mode.
*
v2.0, 2015-05-30, fix
[
#209
](
https://github.com/simple-rtmp-server/srs/issues/209
)
cleanup hls when stop and timeout. 2.0.173.
*
v2.0, 2015-05-29, fix
[
#409
](
https://github.com/simple-rtmp-server/srs/issues/409
)
support pure video hls. 2.0.172.
*
v2.0, 2015-05-28, support
[
srs-dolphin
][
srs-dolphin
]
, the multiple-process SRS.
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
a1dd734
...
...
@@ -1633,6 +1633,18 @@ int SrsSource::on_video(SrsCommonMessage* shared_video)
{
int
ret
=
ERROR_SUCCESS
;
// drop any unknown header video.
// @see https://github.com/simple-rtmp-server/srs/issues/421
if
(
!
SrsFlvCodec
::
video_is_acceptable
(
shared_video
->
payload
,
shared_video
->
size
))
{
char
b0
=
0x00
;
if
(
shared_video
->
size
>
0
)
{
b0
=
shared_video
->
payload
[
0
];
}
srs_warn
(
"drop unknown header video, size=%d, bytes[0]=%#x"
,
shared_video
->
size
,
b0
);
return
ret
;
}
// convert shared_video to msg, user should not use shared_video again.
// the payload is transfer to msg, and set to NULL in shared_video.
SrsSharedPtrMessage
msg
;
...
...
trunk/src/kernel/srs_kernel_codec.cpp
查看文件 @
a1dd734
...
...
@@ -266,6 +266,28 @@ bool SrsFlvCodec::audio_is_aac(char* data, int size)
return
sound_format
==
SrsCodecAudioAAC
;
}
bool
SrsFlvCodec
::
video_is_acceptable
(
char
*
data
,
int
size
)
{
// 1bytes required.
if
(
size
<
1
)
{
return
false
;
}
char
frame_type
=
data
[
0
];
char
codec_id
=
frame_type
&
0x0f
;
frame_type
=
(
frame_type
>>
4
)
&
0x0f
;
if
(
frame_type
<
1
||
frame_type
>
5
)
{
return
false
;
}
if
(
codec_id
<
2
||
codec_id
>
7
)
{
return
false
;
}
return
true
;
}
string
srs_codec_avc_nalu2str
(
SrsAvcNaluType
nalu_type
)
{
switch
(
nalu_type
)
{
...
...
trunk/src/kernel/srs_kernel_codec.hpp
查看文件 @
a1dd734
...
...
@@ -222,6 +222,12 @@ public:
* check codec aac.
*/
static
bool
audio_is_aac
(
char
*
data
,
int
size
);
/**
* check the video RTMP/flv header info,
* @return true if video RTMP/flv header is ok.
* @remark all type of audio is possible, no need to check audio.
*/
static
bool
video_is_acceptable
(
char
*
data
,
int
size
);
};
/**
...
...
请
注册
或
登录
后发表评论