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-08-19 15:31:19 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
170ad05148aa938cd06f69a00c5baabc76dcc04c
170ad051
1 parent
e7714cd4
add gfps and nb_packets
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
25 行增加
和
24 行删除
README.md
trunk/research/librtmp/srs_rtmp_dump.c
trunk/src/libs/srs_librtmp.cpp
README.md
查看文件 @
170ad05
...
...
@@ -759,18 +759,6 @@ About the HLS overhead of SRS, we compare the overhead to FLV by remux the HLS t
The HLS overhead is calc by: (HLS - FLV) / FLV
*
100%
### Bytes Api
The api provides bytes of vhost, stream and srs.
| Connections | tcpdump | srs | deviation |
| ----------- | ---------- | ---------- | --------- |
| 1 | 201687968 | 201687968 | 0% |
| 100 | 12456042662 | 12458284053 | 0.018% |
| 500 | 11623083989 | 11633158616 | 0.087% |
The tcpdump command is
`tcpdump src 192.168.1.151 and port 1935 -i eth0 and tcp -ql`
.
## Architecture
SRS always use the most simple architecture to support complex transaction.
...
...
trunk/research/librtmp/srs_rtmp_dump.c
查看文件 @
170ad05
...
...
@@ -258,8 +258,8 @@ int main(int argc, char** argv)
int64_t
nb_packets
=
0
;
u_int32_t
pre_timestamp
=
0
;
int64_t
pre_now
=
srs_utils_time_ms
();
int64_t
start_time
=
pre_now
;
int64_t
pre_now
=
-
1
;
int64_t
start_time
=
-
1
;
for
(;;)
{
int
size
;
char
type
;
...
...
@@ -271,6 +271,13 @@ int main(int argc, char** argv)
goto
rtmp_destroy
;
}
if
(
pre_now
==
-
1
)
{
pre_now
=
srs_utils_time_ms
();
}
if
(
start_time
==
-
1
)
{
start_time
=
srs_utils_time_ms
();
}
if
(
srs_human_print_rtmp_packet4
(
type
,
timestamp
,
data
,
size
,
pre_timestamp
,
pre_now
,
start_time
,
nb_packets
++
)
!=
0
)
{
srs_human_trace
(
"print rtmp packet failed."
);
goto
rtmp_destroy
;
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
170ad05
...
...
@@ -2338,6 +2338,12 @@ int srs_human_print_rtmp_packet4(char type, u_int32_t timestamp, char* data, int
pi
=
(
pre_now
-
starttime
)
/
(
double
)
nb_packets
;
}
// global fps(video and audio mixed fps).
double
gfps
=
0
;
if
(
pi
>
0
)
{
gfps
=
1000
/
pi
;
}
int
diff
=
0
;
if
(
pre_timestamp
>
0
)
{
diff
=
(
int
)
timestamp
-
(
int
)
pre_timestamp
;
...
...
@@ -2350,22 +2356,22 @@ int srs_human_print_rtmp_packet4(char type, u_int32_t timestamp, char* data, int
u_int32_t
pts
;
if
(
srs_utils_parse_timestamp
(
timestamp
,
type
,
data
,
size
,
&
pts
)
!=
0
)
{
srs_human_trace
(
"Rtmp packet id=%"
PRId64
"/%.1f, type=%s, dts=%d, diff=%d, ndiff=%d, size=%d, DecodeError"
,
nb_packets
,
pi
,
srs_human_flv_tag_type2string
(
type
),
timestamp
,
diff
,
ndiff
,
size
srs_human_trace
(
"Rtmp packet id=%"
PRId64
"/%.1f/%.1f, type=%s, dts=%d, diff=%d, ndiff=%d, size=%d, DecodeError"
,
nb_packets
,
pi
,
gfps
,
srs_human_flv_tag_type2string
(
type
),
timestamp
,
diff
,
ndiff
,
size
);
return
ret
;
}
if
(
type
==
SRS_RTMP_TYPE_VIDEO
)
{
srs_human_trace
(
"Video packet id=%"
PRId64
"/%.1f, type=%s, dts=%d, pts=%d, diff=%d, ndiff=%d, size=%d, %s(%s,%s)"
,
nb_packets
,
pi
,
srs_human_flv_tag_type2string
(
type
),
timestamp
,
pts
,
diff
,
ndiff
,
size
,
srs_human_trace
(
"Video packet id=%"
PRId64
"/%.1f/%.1f, type=%s, dts=%d, pts=%d, diff=%d, ndiff=%d, size=%d, %s(%s,%s)"
,
nb_packets
,
pi
,
gfps
,
srs_human_flv_tag_type2string
(
type
),
timestamp
,
pts
,
diff
,
ndiff
,
size
,
srs_human_flv_video_codec_id2string
(
srs_utils_flv_video_codec_id
(
data
,
size
)),
srs_human_flv_video_avc_packet_type2string
(
srs_utils_flv_video_avc_packet_type
(
data
,
size
)),
srs_human_flv_video_frame_type2string
(
srs_utils_flv_video_frame_type
(
data
,
size
))
);
}
else
if
(
type
==
SRS_RTMP_TYPE_AUDIO
)
{
srs_human_trace
(
"Audio packet id=%"
PRId64
"/%.1f, type=%s, dts=%d, pts=%d, diff=%d, ndiff=%d, size=%d, %s(%s,%s,%s,%s)"
,
nb_packets
,
pi
,
srs_human_flv_tag_type2string
(
type
),
timestamp
,
pts
,
diff
,
ndiff
,
size
,
srs_human_trace
(
"Audio packet id=%"
PRId64
"/%.1f/%.1f, type=%s, dts=%d, pts=%d, diff=%d, ndiff=%d, size=%d, %s(%s,%s,%s,%s)"
,
nb_packets
,
pi
,
gfps
,
srs_human_flv_tag_type2string
(
type
),
timestamp
,
pts
,
diff
,
ndiff
,
size
,
srs_human_flv_audio_sound_format2string
(
srs_utils_flv_audio_sound_format
(
data
,
size
)),
srs_human_flv_audio_sound_rate2string
(
srs_utils_flv_audio_sound_rate
(
data
,
size
)),
srs_human_flv_audio_sound_size2string
(
srs_utils_flv_audio_sound_size
(
data
,
size
)),
...
...
@@ -2373,8 +2379,8 @@ int srs_human_print_rtmp_packet4(char type, u_int32_t timestamp, char* data, int
srs_human_flv_audio_aac_packet_type2string
(
srs_utils_flv_audio_aac_packet_type
(
data
,
size
))
);
}
else
if
(
type
==
SRS_RTMP_TYPE_SCRIPT
)
{
srs_human_verbose
(
"Data packet id=%"
PRId64
"/%.1f, type=%s, time=%d, diff=%d, ndiff=%d, size=%d"
,
nb_packets
,
pi
,
srs_human_flv_tag_type2string
(
type
),
timestamp
,
diff
,
ndiff
,
size
);
srs_human_verbose
(
"Data packet id=%"
PRId64
"/%.1f/%.1f, type=%s, time=%d, diff=%d, ndiff=%d, size=%d"
,
nb_packets
,
pi
,
gfps
,
srs_human_flv_tag_type2string
(
type
),
timestamp
,
diff
,
ndiff
,
size
);
int
nparsed
=
0
;
while
(
nparsed
<
size
)
{
int
nb_parsed_this
=
0
;
...
...
@@ -2390,8 +2396,8 @@ int srs_human_print_rtmp_packet4(char type, u_int32_t timestamp, char* data, int
srs_freep
(
amf0_str
);
}
}
else
{
srs_human_trace
(
"Rtmp packet id=%"
PRId64
"/%.1f, type=%#x, dts=%d, pts=%d, diff=%d, ndiff=%d, size=%d"
,
nb_packets
,
pi
,
type
,
timestamp
,
pts
,
diff
,
ndiff
,
size
);
srs_human_trace
(
"Rtmp packet id=%"
PRId64
"/%.1f/%.1f, type=%#x, dts=%d, pts=%d, diff=%d, ndiff=%d, size=%d"
,
nb_packets
,
pi
,
gfps
,
type
,
timestamp
,
pts
,
diff
,
ndiff
,
size
);
}
return
ret
;
...
...
请
注册
或
登录
后发表评论