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-06-09 10:13:25 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f347099fd16fa8ebe9e624a747df8d92b1f5d6f0
f347099f
1 parent
863dddde
for memory leak detect, move the payload create to message.
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
18 行增加
和
7 行删除
trunk/src/kernel/srs_kernel_flv.cpp
trunk/src/kernel/srs_kernel_flv.hpp
trunk/src/protocol/srs_rtmp_stack.cpp
trunk/src/kernel/srs_kernel_flv.cpp
查看文件 @
f347099
...
...
@@ -166,6 +166,18 @@ SrsCommonMessage::~SrsCommonMessage()
srs_freep
(
payload
);
}
void
SrsCommonMessage
::
create_payload
(
int
size
)
{
srs_freep
(
payload
);
payload
=
new
char
[
size
];
srs_verbose
(
"create payload for RTMP message. size=%d"
,
size
);
#ifdef SRS_MEM_WATCH
srs_memory_watch
(
payload
,
"RTMP.msg.payload"
,
size
);
#endif
}
SrsSharedPtrMessage
::
SrsSharedPtrPayload
::
SrsSharedPtrPayload
()
{
payload
=
NULL
;
...
...
trunk/src/kernel/srs_kernel_flv.hpp
查看文件 @
f347099
...
...
@@ -283,8 +283,12 @@ public:
char
*
payload
;
public
:
SrsCommonMessage
();
public
:
virtual
~
SrsCommonMessage
();
public
:
/**
* alloc the payload to specified size of bytes.
*/
virtual
void
create_payload
(
int
size
);
};
/**
...
...
trunk/src/protocol/srs_rtmp_stack.cpp
查看文件 @
f347099
...
...
@@ -30,7 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_utility.hpp>
#include <srs_protocol_buffer.hpp>
#include <srs_rtmp_utility.hpp>
#include <srs_core_mem_watch.hpp>
// for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213
#ifndef _WIN32
...
...
@@ -1411,11 +1410,7 @@ int SrsProtocol::read_message_payload(SrsChunkStream* chunk, SrsCommonMessage**
// create msg payload if not initialized
if
(
!
chunk
->
msg
->
payload
)
{
chunk
->
msg
->
payload
=
new
char
[
chunk
->
header
.
payload_length
];
srs_verbose
(
"create payload for RTMP message. size=%d"
,
chunk
->
header
.
payload_length
);
#ifdef SRS_MEM_WATCH
srs_memory_watch
(
chunk
->
msg
->
payload
,
"msg.payload"
,
chunk
->
header
.
payload_length
);
#endif
chunk
->
msg
->
create_payload
(
chunk
->
header
.
payload_length
);
}
// read payload to buffer
...
...
请
注册
或
登录
后发表评论