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-07-10 14:46:58 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d86e07b7450e5a282ccbb2b8e5954a0de1ad6abf
d86e07b7
1 parent
2ddd8052
finish basic protocol utest, fix the bug of fmt11 length error.
显示空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
34 行增加
和
16 行删除
trunk/src/core/srs_core.hpp
trunk/src/rtmp/srs_protocol_rtmp_stack.cpp
trunk/src/rtmp/srs_protocol_rtmp_stack.hpp
trunk/src/utest/srs_utest_protocol.cpp
trunk/src/core/srs_core.hpp
查看文件 @
d86e07b
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "15
4
"
#define VERSION_REVISION "15
5
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
trunk/src/rtmp/srs_protocol_rtmp_stack.cpp
查看文件 @
d86e07b
...
...
@@ -1013,6 +1013,11 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz
* 3bytes: payload length, fmt=0,1
* 1bytes: message type, fmt=0,1
* 4bytes: stream id, fmt=0
* where:
* fmt=0, 0x0X
* fmt=1, 0x4X
* fmt=2, 0x8X
* fmt=3, 0xCX
*/
// see also: ngx_rtmp_recv
if
(
fmt
<=
RTMP_FMT_TYPE2
)
{
...
...
@@ -1060,21 +1065,25 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz
}
if
(
fmt
<=
RTMP_FMT_TYPE1
)
{
pp
=
(
char
*
)
&
chunk
->
header
.
payload_length
;
int32_t
payload_length
=
0
;
pp
=
(
char
*
)
&
payload_length
;
pp
[
2
]
=
*
p
++
;
pp
[
1
]
=
*
p
++
;
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
)
{
// always use the actual msg size, for the cache payload length can changed,
// for the fmt type1(stream_id not changed), user can change the payload length.
if
(
chunk
->
msg
->
size
>
0
&&
chunk
->
header
.
payload_length
!=
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
);
chunk
->
header
.
payload_length
,
payload_length
,
ret
);
return
ret
;
}
chunk
->
header
.
payload_length
=
payload_length
;
chunk
->
header
.
message_type
=
*
p
++
;
if
(
fmt
==
RTMP_FMT_TYPE0
)
{
...
...
trunk/src/rtmp/srs_protocol_rtmp_stack.hpp
查看文件 @
d86e07b
...
...
@@ -256,23 +256,27 @@ class SrsMessageHeader
{
public
:
/**
* One byte field to represent the message type. A range of type IDs
* (1-7) are reserved for protocol control messages.
* 3bytes.
* Three-byte field that contains a timestamp delta of the message.
* The 4 bytes are packed in the big-endian order.
* @remark, only used for decoding message from chunk stream.
*/
int
8_t
message_type
;
int
32_t
timestamp_delta
;
/**
* 3bytes.
* Three-byte field that represents the size of the payload in bytes.
* It is set in big-endian format.
*/
int32_t
payload_length
;
/**
* Three-byte field that contains a timestamp delta of the message.
* The 4 bytes are packed in the big-endian order.
* @remark, only used for decoding message from chunk stream.
* 1byte.
* One byte field to represent the message type. A range of type IDs
* (1-7) are reserved for protocol control messages.
*/
int
32_t
timestamp_delta
;
int
8_t
message_type
;
/**
* Three-byte field that identifies the stream of the message. These
* 4bytes.
* Four-byte field that identifies the stream of the message. These
* bytes are set in big-endian format.
*/
int32_t
stream_id
;
...
...
@@ -379,12 +383,17 @@ public:
// 4.2. Message Payload
public:
/**
* The other part which is the payload is the actual data that is
* contained in the message. For example, it could be some audio samples
* or compressed video data. The payload format and interpretation are
* beyond the scope of this document.
* current message parsed size,
* size <= header.payload_length
* for the payload maybe sent in multiple chunks.
*/
int32_t
size
;
/**
* the payload of message, the SrsMessage never know about the detail of payload,
* user must use SrsProtocol.decode_message to get concrete packet.
* @remark, not all message payload can be decoded to packet. for example,
* video/audio packet use raw bytes, no video/audio packet.
*/
int8_t
*
payload
;
protected
:
SrsMessage
();
...
...
trunk/src/utest/srs_utest_protocol.cpp
查看文件 @
d86e07b
此 diff 太大无法显示。
请
注册
或
登录
后发表评论