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-14 15:47:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3b0b2e0b852d5392608b3bc365ee1e539fe56ef9
3b0b2e0b
1 parent
a0a89a8c
fix the bug to support dump packets with count.
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
12 行增加
和
6 行删除
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_source.hpp
trunk/src/app/srs_app_source.cpp
查看文件 @
3b0b2e0
...
...
@@ -301,8 +301,7 @@ int SrsMessageQueue::dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, in
}
srs_assert
(
max_count
>
0
);
// when count is 0, dumps all; otherwise, dumps no more than count.
count
=
srs_min
(
max_count
,
count
?
count
:
nb_msgs
);
count
=
srs_min
(
max_count
,
nb_msgs
);
SrsSharedPtrMessage
**
omsgs
=
msgs
.
data
();
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -312,7 +311,7 @@ int SrsMessageQueue::dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, in
SrsSharedPtrMessage
*
last
=
omsgs
[
count
-
1
];
av_start_time
=
last
->
timestamp
;
if
(
count
>=
nb_msgs
)
{
if
(
count
>=
(
int
)
msgs
.
size
()
)
{
// the pmsgs is big enough and clear msgs at most time.
msgs
.
clear
();
}
else
{
...
...
@@ -502,8 +501,16 @@ int SrsConsumer::dump_packets(SrsMessageArray* msgs, int& count)
{
int
ret
=
ERROR_SUCCESS
;
srs_assert
(
count
>=
0
);
srs_assert
(
msgs
->
max
>
0
);
// the count used as input to reset the max if positive.
int
max
=
count
?
srs_min
(
count
,
msgs
->
max
)
:
msgs
->
max
;
// the count specifies the max acceptable count,
// here maybe 1+, and we must set to 0 when got nothing.
count
=
0
;
if
(
should_update_source_id
)
{
srs_trace
(
"update source_id=%d[%d]"
,
source
->
source_id
(),
source
->
source_id
());
should_update_source_id
=
false
;
...
...
@@ -515,7 +522,7 @@ int SrsConsumer::dump_packets(SrsMessageArray* msgs, int& count)
}
// pump msgs from queue.
if
((
ret
=
queue
->
dump_packets
(
m
sgs
->
m
ax
,
msgs
->
msgs
,
count
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
queue
->
dump_packets
(
max
,
msgs
->
msgs
,
count
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
...
...
trunk/src/app/srs_app_source.hpp
查看文件 @
3b0b2e0
...
...
@@ -175,9 +175,8 @@ public:
/**
* get packets in consumer queue.
* @pmsgs SrsSharedPtrMessage*[], used to store the msgs, user must alloc it.
* @count the count in array,
input and
output param.
* @count the count in array, output param.
* @max_count the max count to dequeue, must be positive.
* @remark user can specifies the count to get specified msgs; 0 to get all if possible.
*/
virtual
int
dump_packets
(
int
max_count
,
SrsSharedPtrMessage
**
pmsgs
,
int
&
count
);
/**
...
...
请
注册
或
登录
后发表评论