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
2017-01-11 11:22:16 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c58dbe4d146fdfa46879d41fcb8953c2e74a50fb
c58dbe4d
1 parent
e3aa34ec
fix #588, kbps interface error. 2.0.228
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
40 行增加
和
11 行删除
README.md
trunk/src/core/srs_core.hpp
trunk/src/protocol/srs_protocol_kbps.cpp
trunk/src/protocol/srs_protocol_kbps.hpp
README.md
查看文件 @
c58dbe4
...
...
@@ -345,6 +345,7 @@ Remark:
## History
*
v2.0, 2017-01-11, fix
[
#588
][
bug #588
]
, kbps interface error. 2.0.228
*
v2.0, 2017-01-11, fix
[
#736
][
bug #736
]
, recovery the hls dispose. 2.0.227
*
v2.0, 2017-01-10, refine hls html5 video template.
*
v2.0, 2017-01-10, fix
[
#635
][
bug #635
]
, hls support NonIDR(open gop). 2.0.226
...
...
@@ -1272,6 +1273,7 @@ Winlin
[
bug #513
]:
https://github.com/ossrs/srs/issues/513
[
bug #730
]:
https://github.com/ossrs/srs/issues/730
[
bug #635
]:
https://github.com/ossrs/srs/issues/635
[
bug #588
]:
https://github.com/ossrs/srs/issues/588
[
bug #xxxxxxxxxx
]:
https://github.com/ossrs/srs/issues/xxxxxxxxxx
[
exo #828
]:
https://github.com/google/ExoPlayer/pull/828
...
...
trunk/src/core/srs_core.hpp
查看文件 @
c58dbe4
...
...
@@ -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 22
7
#define VERSION_REVISION 22
8
// generated by configure, only macros.
#include <srs_auto_headers.hpp>
...
...
trunk/src/protocol/srs_protocol_kbps.cpp
查看文件 @
c58dbe4
...
...
@@ -126,7 +126,7 @@ void SrsKbps::set_io(ISrsProtocolStatistic* in, ISrsProtocolStatistic* out)
is
.
io
.
in
=
in
;
is
.
last_bytes
=
is
.
io_bytes_base
=
0
;
if
(
in
)
{
is
.
last_bytes
=
is
.
io_bytes_base
=
in
->
get_recv_bytes
()
;
is
.
bytes
+=
is
.
io
.
in
->
get_recv_bytes
()
-
is
.
io_bytes_base
;
}
// resample
is
.
sample
();
...
...
@@ -138,7 +138,7 @@ void SrsKbps::set_io(ISrsProtocolStatistic* in, ISrsProtocolStatistic* out)
}
// save the old in bytes.
if
(
os
.
io
.
out
)
{
os
.
bytes
+=
os
.
last_bytes
-
os
.
io_bytes_base
;
os
.
bytes
+=
os
.
io
.
out
->
get_send_bytes
()
-
os
.
io_bytes_base
;
}
// use new io.
os
.
io
.
out
=
out
;
...
...
@@ -192,12 +192,36 @@ int SrsKbps::get_recv_kbps_5m()
int64_t
SrsKbps
::
get_send_bytes
()
{
return
os
.
get_total_bytes
();
// we must calc the send bytes dynamically,
// to not depends on the sample(which used to calc the kbps).
// @read https://github.com/ossrs/srs/issues/588
// session start bytes.
int64_t
bytes
=
os
.
bytes
;
// session delta.
if
(
os
.
io
.
out
)
{
bytes
+=
os
.
io
.
out
->
get_send_bytes
()
-
os
.
io_bytes_base
;
}
return
bytes
;
}
int64_t
SrsKbps
::
get_recv_bytes
()
{
return
is
.
get_total_bytes
();
// we must calc the send bytes dynamically,
// to not depends on the sample(which used to calc the kbps).
// @read https://github.com/ossrs/srs/issues/588
// session start bytes.
int64_t
bytes
=
is
.
bytes
;
// session delta.
if
(
is
.
io
.
in
)
{
bytes
+=
is
.
io
.
in
->
get_recv_bytes
()
-
is
.
io_bytes_base
;
}
return
bytes
;
}
void
SrsKbps
::
resample
()
...
...
trunk/src/protocol/srs_protocol_kbps.hpp
查看文件 @
c58dbe4
...
...
@@ -95,13 +95,9 @@ public:
SrsKbpsSlice
();
virtual
~
SrsKbpsSlice
();
public
:
/**
* get current total bytes.
*/
// Get current total bytes, not depend on sample().
virtual
int64_t
get_total_bytes
();
/**
* resample all samples.
*/
// Resample the slice to calculate the kbps.
virtual
void
sample
();
};
...
...
@@ -162,6 +158,13 @@ public:
* printf("delta is %d/%d", delta->get_send_bytes_delta(), delta->get_recv_bytes_delta());
* delta->cleanup();
* the server never know how many bytes already send/recv, for the connection maybe closed.
* 4. kbps used as ISrsProtocolStatistic, to provides raw bytes:
* SrsKbps* kbps = ...;
* kbps->set_io(in, out);
* // both kbps->get_recv_bytes() and kbps->get_send_bytes() are available.
* // we can use the kbps as the data source of another kbps:
* SrsKbps* user = ...;
* user->set_io(kbps, kbps);
*/
class
SrsKbps
:
public
virtual
ISrsProtocolStatistic
,
public
virtual
IKbpsDelta
{
...
...
请
注册
或
登录
后发表评论