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
2013-10-28 22:09:11 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3c8e1f8ff70b755bc2d1da3719b9208e3add60f9
3c8e1f8f
1 parent
0ed88077
fix bug of extended-timestamp, support librtmp/ffmpeg publish
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
29 行增加
和
3 行删除
trunk/src/core/srs_core_buffer.cpp
trunk/src/core/srs_core_error.hpp
trunk/src/core/srs_core_protocol.cpp
trunk/src/core/srs_core_buffer.cpp
查看文件 @
3c8e1f8
...
...
@@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_error.hpp>
#include <srs_core_socket.hpp>
#include <srs_core_log.hpp>
#define SOCKET_READ_SIZE 4096
...
...
@@ -62,7 +63,11 @@ int SrsBuffer::ensure_buffer_bytes(SrsSocket* skt, int required_size)
{
int
ret
=
ERROR_SUCCESS
;
srs_assert
(
required_size
>=
0
);
if
(
required_size
<
0
)
{
ret
=
ERROR_SYSTEM_SIZE_NEGATIVE
;
srs_error
(
"size is negative. size=%d, ret=%d"
,
required_size
,
ret
);
return
ret
;
}
while
(
size
()
<
required_size
)
{
char
buffer
[
SOCKET_READ_SIZE
];
...
...
trunk/src/core/srs_core_error.hpp
查看文件 @
3c8e1f8
...
...
@@ -64,11 +64,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ERROR_RTMP_CHUNK_SIZE 310
#define ERROR_RTMP_TRY_SIMPLE_HS 311
#define ERROR_RTMP_CH_SCHEMA 312
#define ERROR_RTMP_PACKET_SIZE 313
#define ERROR_SYSTEM_STREAM_INIT 400
#define ERROR_SYSTEM_PACKET_INVALID 401
#define ERROR_SYSTEM_CLIENT_INVALID 402
#define ERROR_SYSTEM_ASSERT_FAILED 403
#define ERROR_SYSTEM_SIZE_NEGATIVE 404
// see librtmp.
// failed when open ssl create the dh
...
...
trunk/src/core/srs_core_protocol.cpp
查看文件 @
3c8e1f8
...
...
@@ -827,6 +827,15 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz
pp
[
0
]
=
*
p
++
;
pp
[
3
]
=
0
;
// if msg exists in cache, the size must not changed.
if
(
chunk
->
msg
->
size
>
0
&&
chunk
->
msg
->
size
!=
chunk
->
header
.
payload_length
)
{
ret
=
ERROR_RTMP_PACKET_SIZE
;
srs_error
(
"msg exists in chunk cache, "
"size=%d cannot change to %d, ret=%d"
,
chunk
->
msg
->
size
,
chunk
->
header
.
payload_length
,
ret
);
return
ret
;
}
chunk
->
header
.
message_type
=
*
p
++
;
if
(
fmt
==
0
)
{
...
...
@@ -867,11 +876,21 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz
return
ret
;
}
char
*
pp
=
(
char
*
)
&
chunk
->
header
.
timestamp
;
// ffmpeg/librtmp may donot send this filed, need to detect the value.
// @see also: http://blog.csdn.net/win_lin/article/details/13363699
int32_t
timestamp
=
0x00
;
char
*
pp
=
(
char
*
)
&
timestamp
;
pp
[
3
]
=
*
p
++
;
pp
[
2
]
=
*
p
++
;
pp
[
1
]
=
*
p
++
;
pp
[
0
]
=
*
p
++
;
if
(
chunk
->
header
.
timestamp
>
RTMP_EXTENDED_TIMESTAMP
&&
chunk
->
header
.
timestamp
!=
timestamp
)
{
mh_size
-=
4
;
srs_verbose
(
"ignore the 4bytes extended timestamp. mh_size=%d"
,
mh_size
);
}
else
{
chunk
->
header
.
timestamp
=
timestamp
;
}
srs_verbose
(
"header read ext_time completed. time=%d"
,
chunk
->
header
.
timestamp
);
}
...
...
@@ -897,7 +916,7 @@ int SrsProtocol::read_message_payload(SrsChunkStream* chunk, int bh_size, int mh
int
ret
=
ERROR_SUCCESS
;
// empty message
if
(
chunk
->
header
.
payload_length
=
=
0
)
{
if
(
chunk
->
header
.
payload_length
<
=
0
)
{
// need erase the header in buffer.
buffer
->
erase
(
bh_size
+
mh_size
);
...
...
请
注册
或
登录
后发表评论