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
2014-04-16 15:58:06 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0c91fa6bedc6c3c5b6d8125e276cc0e3640bc82e
0c91fa6b
1 parent
36c2c37b
fix dvr mem leak, free msg when not use it.
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
27 行增加
和
0 行删除
trunk/src/app/srs_app_dvr.cpp
trunk/src/app/srs_app_encoder.cpp
trunk/src/app/srs_app_thread.cpp
trunk/src/app/srs_app_thread.hpp
trunk/src/core/srs_core.hpp
trunk/src/app/srs_app_dvr.cpp
查看文件 @
0c91fa6
...
...
@@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef SRS_AUTO_DVR
#include <srs_kernel_error.hpp>
#include <srs_protocol_rtmp_stack.hpp>
SrsDvr
::
SrsDvr
(
SrsSource
*
source
)
{
...
...
@@ -55,12 +56,14 @@ int SrsDvr::on_meta_data(SrsAmf0Object* metadata)
int
SrsDvr
::
on_audio
(
SrsSharedPtrMessage
*
audio
)
{
int
ret
=
ERROR_SUCCESS
;
srs_freep
(
audio
);
return
ret
;
}
int
SrsDvr
::
on_video
(
SrsSharedPtrMessage
*
video
)
{
int
ret
=
ERROR_SUCCESS
;
srs_freep
(
video
);
return
ret
;
}
...
...
trunk/src/app/srs_app_encoder.cpp
查看文件 @
0c91fa6
...
...
@@ -79,6 +79,7 @@ int SrsEncoder::on_publish(SrsRequest* req)
srs_error
(
"st_thread_create failed. ret=%d"
,
ret
);
return
ret
;
}
srs_trace
(
"encoder thread cid=%d, current_cid=%d"
,
pthread
->
cid
(),
_srs_context
->
get_id
());
return
ret
;
}
...
...
trunk/src/app/srs_app_thread.cpp
查看文件 @
0c91fa6
...
...
@@ -61,6 +61,7 @@ SrsThread::SrsThread(ISrsThreadHandler* thread_handler, int64_t interval_us)
tid
=
NULL
;
loop
=
false
;
_cid
=
-
1
;
}
SrsThread
::~
SrsThread
()
...
...
@@ -68,6 +69,11 @@ SrsThread::~SrsThread()
stop
();
}
int
SrsThread
::
cid
()
{
return
_cid
;
}
int
SrsThread
::
start
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -83,6 +89,11 @@ int SrsThread::start()
return
ret
;
}
// wait for cid to ready, for parent thread to get the cid.
while
(
_cid
<
0
)
{
st_usleep
(
10
*
SRS_TIME_MILLISECONDS
);
}
return
ret
;
}
...
...
@@ -111,6 +122,7 @@ void SrsThread::thread_cycle()
{
int
ret
=
ERROR_SUCCESS
;
_cid
=
_srs_context
->
get_id
();
srs_assert
(
handler
);
_srs_context
->
generate_id
();
...
...
trunk/src/app/srs_app_thread.hpp
查看文件 @
0c91fa6
...
...
@@ -84,6 +84,7 @@ class SrsThread
{
private
:
st_thread_t
tid
;
int
_cid
;
bool
loop
;
private
:
ISrsThreadHandler
*
handler
;
...
...
@@ -98,6 +99,12 @@ public:
virtual
~
SrsThread
();
public
:
/**
* get the context id. @see: ISrsThreadContext.get_id().
* used for parent thread to get the id.
* @remark when start thread, parent thread will block and wait for this id ready.
*/
virtual
int
cid
();
/**
* start the thread, invoke the cycle of handler util
* user stop the thread.
* @remark ignore any error of cycle of handler.
...
...
trunk/src/core/srs_core.hpp
查看文件 @
0c91fa6
...
...
@@ -124,4 +124,8 @@ extern bool srs_is_little_endian();
className(const className&); \
className& operator= (const className&)
// const time for st to convert to us
#define SRS_TIME_MILLISECONDS 1000
#define SRS_TIME_SECONDS 1000000
#endif
...
...
请
注册
或
登录
后发表评论