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-07-20 09:31:46 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b54f9b0f94b28c37ca0be6d58cc86fd303b80795
b54f9b0f
1 parent
3b65af9b
refine the hls, ignore packet when no sequence header. 2.0.179
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
30 行增加
和
17 行删除
README.md
trunk/src/core/srs_core.hpp
trunk/src/kernel/srs_kernel_codec.cpp
trunk/src/kernel/srs_kernel_codec.hpp
README.md
查看文件 @
b54f9b0
...
...
@@ -344,6 +344,7 @@ Remark:
### SRS 2.0 history
*
v2.0, 2015-07-20, refine the hls, ignore packet when no sequence header. 2.0.179
*
v2.0, 2015-07-16, for
[
#441
](
https://github.com/simple-rtmp-server/srs/issues/441
)
use 30s timeout for first msg. 2.0.178
*
v2.0, 2015-07-14, refine hls disable the time jitter, support not mix monotonically increase. 2.0.177
*
v2.0, 2015-07-01, fix
[
#433
](
https://github.com/simple-rtmp-server/srs/issues/433
)
fix the sps parse bug. 2.0.176
...
...
trunk/src/core/srs_core.hpp
查看文件 @
b54f9b0
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 17
8
#define VERSION_REVISION 17
9
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
trunk/src/kernel/srs_kernel_codec.cpp
查看文件 @
b54f9b0
...
...
@@ -423,6 +423,16 @@ SrsAvcAacCodec::~SrsAvcAacCodec()
srs_freep
(
pictureParameterSetNALUnit
);
}
bool
SrsAvcAacCodec
::
is_avc_codec_ok
()
{
return
avc_extra_size
>
0
&&
avc_extra_data
;
}
bool
SrsAvcAacCodec
::
is_aac_codec_ok
()
{
return
aac_extra_size
>
0
&&
aac_extra_data
;
}
int
SrsAvcAacCodec
::
audio_aac_demux
(
char
*
data
,
int
size
,
SrsCodecSample
*
sample
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -441,7 +451,7 @@ int SrsAvcAacCodec::audio_aac_demux(char* data, int size, SrsCodecSample* sample
// audio decode
if
(
!
stream
->
require
(
1
))
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"a
udio code
c decode sound_format failed. ret=%d"
,
ret
);
srs_error
(
"a
a
c decode sound_format failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -468,13 +478,13 @@ int SrsAvcAacCodec::audio_aac_demux(char* data, int size, SrsCodecSample* sample
// only support aac
if
(
audio_codec_id
!=
SrsCodecAudioAAC
)
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"a
udio code
c only support mp3/aac codec. actual=%d, ret=%d"
,
audio_codec_id
,
ret
);
srs_error
(
"a
a
c only support mp3/aac codec. actual=%d, ret=%d"
,
audio_codec_id
,
ret
);
return
ret
;
}
if
(
!
stream
->
require
(
1
))
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"a
udio code
c decode aac_packet_type failed. ret=%d"
,
ret
);
srs_error
(
"a
a
c decode aac_packet_type failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -497,16 +507,15 @@ int SrsAvcAacCodec::audio_aac_demux(char* data, int size, SrsCodecSample* sample
}
}
else
if
(
aac_packet_type
==
SrsCodecAudioTypeRawData
)
{
// ensure the sequence header demuxed
if
(
aac_extra_size
<=
0
||
!
aac_extra_data
)
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"audio codec decode aac failed, sequence header not found. ret=%d"
,
ret
);
if
(
!
is_aac_codec_ok
())
{
srs_warn
(
"aac ignore type=%d for no sequence header. ret=%d"
,
aac_packet_type
,
ret
);
return
ret
;
}
// Raw AAC frame data in UI8 []
// 6.3 Raw Data, aac-iso-13818-7.pdf, page 28
if
((
ret
=
sample
->
add_sample_unit
(
stream
->
data
()
+
stream
->
pos
(),
stream
->
size
()
-
stream
->
pos
()))
!=
ERROR_SUCCESS
)
{
srs_error
(
"a
udio code
c add sample failed. ret=%d"
,
ret
);
srs_error
(
"a
a
c add sample failed. ret=%d"
,
ret
);
return
ret
;
}
}
else
{
...
...
@@ -536,7 +545,7 @@ int SrsAvcAacCodec::audio_aac_demux(char* data, int size, SrsCodecSample* sample
};
}
srs_info
(
"a
udio decoded, type=%d, codec=%d, asize=%d, rate=%d, format=%d, size=%d"
,
srs_info
(
"a
ac decoded, type=%d, codec=%d, asize=%d, rate=%d, format=%d, size=%d"
,
sound_type
,
audio_codec_id
,
sound_size
,
sound_rate
,
sound_format
,
size
);
return
ret
;
...
...
@@ -636,7 +645,7 @@ int SrsAvcAacCodec::video_avc_demux(char* data, int size, SrsCodecSample* sample
// video decode
if
(
!
stream
->
require
(
1
))
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"
video code
c decode frame_type failed. ret=%d"
,
ret
);
srs_error
(
"
av
c decode frame_type failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -650,21 +659,21 @@ int SrsAvcAacCodec::video_avc_demux(char* data, int size, SrsCodecSample* sample
// ignore info frame without error,
// @see https://github.com/simple-rtmp-server/srs/issues/288#issuecomment-69863909
if
(
sample
->
frame_type
==
SrsCodecVideoAVCFrameVideoInfoFrame
)
{
srs_warn
(
"
video code
c igone the info frame, ret=%d"
,
ret
);
srs_warn
(
"
av
c igone the info frame, ret=%d"
,
ret
);
return
ret
;
}
// only support h.264/avc
if
(
codec_id
!=
SrsCodecVideoAVC
)
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"
video code
c only support video h.264/avc codec. actual=%d, ret=%d"
,
codec_id
,
ret
);
srs_error
(
"
av
c only support video h.264/avc codec. actual=%d, ret=%d"
,
codec_id
,
ret
);
return
ret
;
}
video_codec_id
=
codec_id
;
if
(
!
stream
->
require
(
4
))
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"
video code
c decode avc_packet_type failed. ret=%d"
,
ret
);
srs_error
(
"
av
c decode avc_packet_type failed. ret=%d"
,
ret
);
return
ret
;
}
int8_t
avc_packet_type
=
stream
->
read_1bytes
();
...
...
@@ -680,9 +689,8 @@ int SrsAvcAacCodec::video_avc_demux(char* data, int size, SrsCodecSample* sample
}
}
else
if
(
avc_packet_type
==
SrsCodecVideoAVCTypeNALU
){
// ensure the sequence header demuxed
if
(
avc_extra_size
<=
0
||
!
avc_extra_data
)
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"avc decode failed, sequence header not found. ret=%d"
,
ret
);
if
(
!
is_avc_codec_ok
())
{
srs_warn
(
"avc ignore type=%d for no sequence header. ret=%d"
,
avc_packet_type
,
ret
);
return
ret
;
}
...
...
@@ -738,7 +746,7 @@ int SrsAvcAacCodec::video_avc_demux(char* data, int size, SrsCodecSample* sample
// ignored.
}
srs_info
(
"
video decoded, type=%d, codec=%d, avc=%d, cts=%d, size=%d"
,
srs_info
(
"
avc decoded, type=%d, codec=%d, avc=%d, cts=%d, size=%d"
,
frame_type
,
video_codec_id
,
avc_packet_type
,
composition_time
,
size
);
return
ret
;
...
...
trunk/src/kernel/srs_kernel_codec.hpp
查看文件 @
b54f9b0
...
...
@@ -608,6 +608,10 @@ public:
public
:
SrsAvcAacCodec
();
virtual
~
SrsAvcAacCodec
();
public
:
// whether avc or aac codec sequence header or extra data is decoded ok.
virtual
bool
is_avc_codec_ok
();
virtual
bool
is_aac_codec_ok
();
// the following function used for hls to build the sample and codec.
public:
/**
...
...
请
注册
或
登录
后发表评论