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-22 19:44:12 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cdd843a6418f24bd677177c29a9aacefac6d3bc2
cdd843a6
1 parent
c64ed833
rename SrsMessage to SrsCommonMessage
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
78 行增加
和
78 行删除
trunk/src/core/srs_core_client.cpp
trunk/src/core/srs_core_protocol.cpp
trunk/src/core/srs_core_protocol.hpp
trunk/src/core/srs_core_rtmp.cpp
trunk/src/core/srs_core_rtmp.hpp
trunk/src/core/srs_core_source.cpp
trunk/src/core/srs_core_source.hpp
trunk/src/core/srs_core_client.cpp
查看文件 @
cdd843a
...
...
@@ -172,28 +172,28 @@ int SrsClient::streaming_play(SrsSource* source)
// read from client.
if
(
ready
)
{
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
if
((
ret
=
rtmp
->
recv_message
(
&
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"recv client control message failed. ret=%d"
,
ret
);
return
ret
;
}
SrsAutoFree
(
SrsMessage
,
msg
,
false
);
SrsAutoFree
(
Srs
Common
Message
,
msg
,
false
);
// TODO: process it.
}
// get messages from consumer.
SrsMessage
**
msgs
=
NULL
;
Srs
Common
Message
**
msgs
=
NULL
;
int
count
=
0
;
if
((
ret
=
consumer
->
get_packets
(
0
,
msgs
,
count
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"get messages from consumer failed. ret=%d"
,
ret
);
return
ret
;
}
SrsAutoFree
(
SrsMessage
*
,
msgs
,
true
);
SrsAutoFree
(
Srs
Common
Message
*
,
msgs
,
true
);
// sendout messages
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
SrsMessage
*
msg
=
msgs
[
i
];
Srs
Common
Message
*
msg
=
msgs
[
i
];
if
((
ret
=
rtmp
->
send_message
(
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"send message to client failed. ret=%d"
,
ret
);
return
ret
;
...
...
@@ -209,13 +209,13 @@ int SrsClient::streaming_publish(SrsSource* source)
int
ret
=
ERROR_SUCCESS
;
while
(
true
)
{
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
if
((
ret
=
rtmp
->
recv_message
(
&
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"recv identify client message failed. ret=%d"
,
ret
);
return
ret
;
}
SrsAutoFree
(
SrsMessage
,
msg
,
false
);
SrsAutoFree
(
Srs
Common
Message
,
msg
,
false
);
// process audio packet
if
(
msg
->
header
.
is_audio
()
&&
((
ret
=
source
->
on_audio
(
msg
))
!=
ERROR_SUCCESS
))
{
...
...
trunk/src/core/srs_core_protocol.cpp
查看文件 @
cdd843a
...
...
@@ -279,14 +279,14 @@ int SrsProtocol::can_read(int timeout_ms, bool& ready)
return
skt
->
can_read
(
timeout_ms
,
ready
);
}
int
SrsProtocol
::
recv_message
(
SrsMessage
**
pmsg
)
int
SrsProtocol
::
recv_message
(
Srs
Common
Message
**
pmsg
)
{
*
pmsg
=
NULL
;
int
ret
=
ERROR_SUCCESS
;
while
(
true
)
{
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
if
((
ret
=
recv_interlaced_message
(
&
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"recv interlaced message failed. ret=%d"
,
ret
);
...
...
@@ -440,7 +440,7 @@ int SrsProtocol::send_message(SrsOutputableMessage* msg)
return
ret
;
}
int
SrsProtocol
::
on_recv_message
(
SrsMessage
*
msg
)
int
SrsProtocol
::
on_recv_message
(
Srs
Common
Message
*
msg
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -483,7 +483,7 @@ int SrsProtocol::on_send_message(SrsOutputableMessage* msg)
{
int
ret
=
ERROR_SUCCESS
;
Srs
Message
*
common_msg
=
dynamic_cast
<
Srs
Message
*>
(
msg
);
Srs
CommonMessage
*
common_msg
=
dynamic_cast
<
SrsCommon
Message
*>
(
msg
);
if
(
!
msg
)
{
srs_verbose
(
"ignore the shared ptr message."
);
return
ret
;
...
...
@@ -506,7 +506,7 @@ int SrsProtocol::on_send_message(SrsOutputableMessage* msg)
return
ret
;
}
int
SrsProtocol
::
recv_interlaced_message
(
SrsMessage
**
pmsg
)
int
SrsProtocol
::
recv_interlaced_message
(
Srs
Common
Message
**
pmsg
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -545,7 +545,7 @@ int SrsProtocol::recv_interlaced_message(SrsMessage** pmsg)
chunk
->
header
.
payload_length
,
chunk
->
header
.
timestamp
,
chunk
->
header
.
stream_id
);
// read msg payload from chunk stream.
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
int
payload_size
=
0
;
if
((
ret
=
read_message_payload
(
chunk
,
bh_size
,
mh_size
,
payload_size
,
&
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"read message payload failed. ret=%d"
,
ret
);
...
...
@@ -668,7 +668,7 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz
// create msg when new chunk stream start
if
(
!
chunk
->
msg
)
{
chunk
->
msg
=
new
SrsMessage
();
chunk
->
msg
=
new
Srs
Common
Message
();
srs_verbose
(
"create message for new chunk, fmt=%d, cid=%d"
,
fmt
,
chunk
->
cid
);
}
...
...
@@ -794,7 +794,7 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz
return
ret
;
}
int
SrsProtocol
::
read_message_payload
(
SrsChunkStream
*
chunk
,
int
bh_size
,
int
mh_size
,
int
&
payload_size
,
SrsMessage
**
pmsg
)
int
SrsProtocol
::
read_message_payload
(
SrsChunkStream
*
chunk
,
int
bh_size
,
int
mh_size
,
int
&
payload_size
,
Srs
Common
Message
**
pmsg
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -943,19 +943,19 @@ void SrsOutputableMessage::free_payload()
srs_freepa
(
payload
);
}
Srs
Message
::
Srs
Message
()
Srs
CommonMessage
::
SrsCommon
Message
()
{
stream
=
NULL
;
packet
=
NULL
;
}
Srs
Message
::~
Srs
Message
()
Srs
CommonMessage
::~
SrsCommon
Message
()
{
srs_freep
(
packet
);
srs_freep
(
stream
);
}
int
SrsMessage
::
decode_packet
()
int
Srs
Common
Message
::
decode_packet
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -1061,7 +1061,7 @@ int SrsMessage::decode_packet()
return
ret
;
}
SrsPacket
*
SrsMessage
::
get_packet
()
SrsPacket
*
Srs
Common
Message
::
get_packet
()
{
if
(
!
packet
)
{
srs_error
(
"the payload is raw/undecoded, invoke decode_packet to decode it."
);
...
...
@@ -1071,7 +1071,7 @@ SrsPacket* SrsMessage::get_packet()
return
packet
;
}
int
SrsMessage
::
get_perfer_cid
()
int
Srs
Common
Message
::
get_perfer_cid
()
{
if
(
!
packet
)
{
return
RTMP_CID_ProtocolControl
;
...
...
@@ -1086,7 +1086,7 @@ int SrsMessage::get_perfer_cid()
return
packet
->
get_perfer_cid
();
}
void
SrsMessage
::
set_packet
(
SrsPacket
*
pkt
,
int
stream_id
)
void
Srs
Common
Message
::
set_packet
(
SrsPacket
*
pkt
,
int
stream_id
)
{
srs_freep
(
packet
);
...
...
@@ -1097,7 +1097,7 @@ void SrsMessage::set_packet(SrsPacket* pkt, int stream_id)
header
.
stream_id
=
stream_id
;
}
int
SrsMessage
::
encode_packet
()
int
Srs
Common
Message
::
encode_packet
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/core/srs_core_protocol.hpp
查看文件 @
cdd843a
...
...
@@ -42,7 +42,7 @@ class SrsSocket;
class
SrsBuffer
;
class
SrsPacket
;
class
SrsStream
;
class
SrsMessage
;
class
Srs
Common
Message
;
class
SrsChunkStream
;
class
SrsAmf0Object
;
class
SrsAmf0Null
;
...
...
@@ -105,7 +105,7 @@ public:
* @pmsg, user must free it. NULL if not success.
* @remark, only when success, user can use and must free the pmsg.
*/
virtual
int
recv_message
(
SrsMessage
**
pmsg
);
virtual
int
recv_message
(
Srs
Common
Message
**
pmsg
);
/**
* send out message with encoded payload to peer.
* use the message encode method to encode to payload,
...
...
@@ -117,7 +117,7 @@ private:
/**
* when recv message, update the context.
*/
virtual
int
on_recv_message
(
SrsMessage
*
msg
);
virtual
int
on_recv_message
(
Srs
Common
Message
*
msg
);
/**
* when message sentout, update the context.
*/
...
...
@@ -128,7 +128,7 @@ private:
* return success and pmsg set to NULL if no entire message got,
* return success and pmsg set to entire message if got one.
*/
virtual
int
recv_interlaced_message
(
SrsMessage
**
pmsg
);
virtual
int
recv_interlaced_message
(
Srs
Common
Message
**
pmsg
);
/**
* read the chunk basic header(fmt, cid) from chunk stream.
* user can discovery a SrsChunkStream by cid.
...
...
@@ -146,7 +146,7 @@ private:
* if got entire message, set the pmsg.
* @payload_size read size in this roundtrip, generally a chunk size or left message size.
*/
virtual
int
read_message_payload
(
SrsChunkStream
*
chunk
,
int
bh_size
,
int
mh_size
,
int
&
payload_size
,
SrsMessage
**
pmsg
);
virtual
int
read_message_payload
(
SrsChunkStream
*
chunk
,
int
bh_size
,
int
mh_size
,
int
&
payload_size
,
Srs
Common
Message
**
pmsg
);
};
/**
...
...
@@ -222,7 +222,7 @@ public:
/**
* partially read message.
*/
SrsMessage
*
msg
;
Srs
Common
Message
*
msg
;
/**
* decoded msg count, to identify whether the chunk stream is fresh.
*/
...
...
@@ -274,7 +274,7 @@ public:
* common RTMP message defines in rtmp.part2.Message-Formats.pdf.
* cannbe parse and decode.
*/
class
SrsMessage
:
public
SrsOutputableMessage
class
Srs
Common
Message
:
public
SrsOutputableMessage
{
private
:
typedef
SrsOutputableMessage
super
;
...
...
@@ -283,8 +283,8 @@ private:
SrsStream
*
stream
;
SrsPacket
*
packet
;
public
:
SrsMessage
();
virtual
~
SrsMessage
();
SrsCommonMessage
();
virtual
~
SrsCommonMessage
();
/**
* decode functions.
*/
...
...
@@ -959,7 +959,7 @@ protected:
* @remark, only when success, user can use and must free the pmsg/ppacket.
*/
template
<
class
T
>
int
srs_rtmp_expect_message
(
SrsProtocol
*
protocol
,
SrsMessage
**
pmsg
,
T
**
ppacket
)
int
srs_rtmp_expect_message
(
SrsProtocol
*
protocol
,
Srs
Common
Message
**
pmsg
,
T
**
ppacket
)
{
*
pmsg
=
NULL
;
*
ppacket
=
NULL
;
...
...
@@ -967,7 +967,7 @@ int srs_rtmp_expect_message(SrsProtocol* protocol, SrsMessage** pmsg, T** ppacke
int
ret
=
ERROR_SUCCESS
;
while
(
true
)
{
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
if
((
ret
=
protocol
->
recv_message
(
&
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"recv message failed. ret=%d"
,
ret
);
return
ret
;
...
...
trunk/src/core/srs_core_rtmp.cpp
查看文件 @
cdd843a
...
...
@@ -142,7 +142,7 @@ SrsRtmp::~SrsRtmp()
srs_freep
(
protocol
);
}
int
SrsRtmp
::
recv_message
(
SrsMessage
**
pmsg
)
int
SrsRtmp
::
recv_message
(
Srs
Common
Message
**
pmsg
)
{
return
protocol
->
recv_message
(
pmsg
);
}
...
...
@@ -152,7 +152,7 @@ int SrsRtmp::can_read(int timeout_ms, bool& ready)
return
protocol
->
can_read
(
timeout_ms
,
ready
);
}
int
SrsRtmp
::
send_message
(
SrsMessage
*
msg
)
int
SrsRtmp
::
send_message
(
Srs
Common
Message
*
msg
)
{
return
protocol
->
send_message
(
msg
);
}
...
...
@@ -207,13 +207,13 @@ int SrsRtmp::connect_app(SrsRequest* req)
{
int
ret
=
ERROR_SUCCESS
;
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
SrsConnectAppPacket
*
pkt
=
NULL
;
if
((
ret
=
srs_rtmp_expect_message
<
SrsConnectAppPacket
>
(
protocol
,
&
msg
,
&
pkt
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"expect connect app message failed. ret=%d"
,
ret
);
return
ret
;
}
SrsAutoFree
(
SrsMessage
,
msg
,
false
);
SrsAutoFree
(
Srs
Common
Message
,
msg
,
false
);
srs_info
(
"get connect app message"
);
SrsAmf0Any
*
prop
=
NULL
;
...
...
@@ -246,7 +246,7 @@ int SrsRtmp::set_window_ack_size(int ack_size)
{
int
ret
=
ERROR_SUCCESS
;
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsSetWindowAckSizePacket
*
pkt
=
new
SrsSetWindowAckSizePacket
();
pkt
->
ackowledgement_window_size
=
ack_size
;
...
...
@@ -265,7 +265,7 @@ int SrsRtmp::set_peer_bandwidth(int bandwidth, int type)
{
int
ret
=
ERROR_SUCCESS
;
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsSetPeerBandwidthPacket
*
pkt
=
new
SrsSetPeerBandwidthPacket
();
pkt
->
bandwidth
=
bandwidth
;
...
...
@@ -286,7 +286,7 @@ int SrsRtmp::response_connect_app(SrsRequest* req)
{
int
ret
=
ERROR_SUCCESS
;
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsConnectAppResPacket
*
pkt
=
new
SrsConnectAppResPacket
();
pkt
->
props
->
set
(
"fmsVer"
,
new
SrsAmf0String
(
"FMS/"
RTMP_SIG_FMS_VER
));
...
...
@@ -320,7 +320,7 @@ int SrsRtmp::on_bw_done()
{
int
ret
=
ERROR_SUCCESS
;
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsOnBWDonePacket
*
pkt
=
new
SrsOnBWDonePacket
();
msg
->
set_packet
(
pkt
,
0
);
...
...
@@ -340,13 +340,13 @@ int SrsRtmp::identify_client(int stream_id, SrsClientType& type, std::string& st
int
ret
=
ERROR_SUCCESS
;
while
(
true
)
{
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
if
((
ret
=
protocol
->
recv_message
(
&
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"recv identify client message failed. ret=%d"
,
ret
);
return
ret
;
}
SrsAutoFree
(
SrsMessage
,
msg
,
false
);
SrsAutoFree
(
Srs
Common
Message
,
msg
,
false
);
if
(
!
msg
->
header
.
is_amf0_command
()
&&
!
msg
->
header
.
is_amf3_command
())
{
srs_trace
(
"identify ignore messages except "
...
...
@@ -381,7 +381,7 @@ int SrsRtmp::set_chunk_size(int chunk_size)
{
int
ret
=
ERROR_SUCCESS
;
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsSetChunkSizePacket
*
pkt
=
new
SrsSetChunkSizePacket
();
pkt
->
chunk_size
=
chunk_size
;
...
...
@@ -402,7 +402,7 @@ int SrsRtmp::start_play(int stream_id)
// StreamBegin
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsPCUC4BytesPacket
*
pkt
=
new
SrsPCUC4BytesPacket
();
pkt
->
event_type
=
SrcPCUCStreamBegin
;
...
...
@@ -418,7 +418,7 @@ int SrsRtmp::start_play(int stream_id)
// onStatus(NetStream.Play.Reset)
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsOnStatusCallPacket
*
pkt
=
new
SrsOnStatusCallPacket
();
pkt
->
data
->
set
(
StatusLevel
,
new
SrsAmf0String
(
StatusLevelStatus
));
...
...
@@ -438,7 +438,7 @@ int SrsRtmp::start_play(int stream_id)
// onStatus(NetStream.Play.Start)
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsOnStatusCallPacket
*
pkt
=
new
SrsOnStatusCallPacket
();
pkt
->
data
->
set
(
StatusLevel
,
new
SrsAmf0String
(
StatusLevelStatus
));
...
...
@@ -458,7 +458,7 @@ int SrsRtmp::start_play(int stream_id)
// |RtmpSampleAccess(false, false)
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsSampleAccessPacket
*
pkt
=
new
SrsSampleAccessPacket
();
msg
->
set_packet
(
pkt
,
stream_id
);
...
...
@@ -472,7 +472,7 @@ int SrsRtmp::start_play(int stream_id)
// onStatus(NetStream.Data.Start)
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsOnStatusDataPacket
*
pkt
=
new
SrsOnStatusDataPacket
();
pkt
->
data
->
set
(
StatusCode
,
new
SrsAmf0String
(
StatusCodeDataStart
));
...
...
@@ -498,7 +498,7 @@ int SrsRtmp::start_publish(int stream_id)
// FCPublish
double
fc_publish_tid
=
0
;
if
(
true
)
{
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
SrsFMLEStartPacket
*
pkt
=
NULL
;
if
((
ret
=
srs_rtmp_expect_message
<
SrsFMLEStartPacket
>
(
protocol
,
&
msg
,
&
pkt
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"recv FCPublish message failed. ret=%d"
,
ret
);
...
...
@@ -506,12 +506,12 @@ int SrsRtmp::start_publish(int stream_id)
}
srs_info
(
"recv FCPublish request message success."
);
SrsAutoFree
(
SrsMessage
,
msg
,
false
);
SrsAutoFree
(
Srs
Common
Message
,
msg
,
false
);
fc_publish_tid
=
pkt
->
transaction_id
;
}
// FCPublish response
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsFMLEStartResPacket
*
pkt
=
new
SrsFMLEStartResPacket
(
fc_publish_tid
);
msg
->
set_packet
(
pkt
,
0
);
...
...
@@ -526,7 +526,7 @@ int SrsRtmp::start_publish(int stream_id)
// createStream
double
create_stream_tid
=
0
;
if
(
true
)
{
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
SrsCreateStreamPacket
*
pkt
=
NULL
;
if
((
ret
=
srs_rtmp_expect_message
<
SrsCreateStreamPacket
>
(
protocol
,
&
msg
,
&
pkt
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"recv createStream message failed. ret=%d"
,
ret
);
...
...
@@ -534,12 +534,12 @@ int SrsRtmp::start_publish(int stream_id)
}
srs_info
(
"recv createStream request message success."
);
SrsAutoFree
(
SrsMessage
,
msg
,
false
);
SrsAutoFree
(
Srs
Common
Message
,
msg
,
false
);
create_stream_tid
=
pkt
->
transaction_id
;
}
// createStream response
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsCreateStreamResPacket
*
pkt
=
new
SrsCreateStreamResPacket
(
create_stream_tid
,
stream_id
);
msg
->
set_packet
(
pkt
,
0
);
...
...
@@ -553,7 +553,7 @@ int SrsRtmp::start_publish(int stream_id)
// publish
if
(
true
)
{
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
SrsPublishPacket
*
pkt
=
NULL
;
if
((
ret
=
srs_rtmp_expect_message
<
SrsPublishPacket
>
(
protocol
,
&
msg
,
&
pkt
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"recv publish message failed. ret=%d"
,
ret
);
...
...
@@ -561,11 +561,11 @@ int SrsRtmp::start_publish(int stream_id)
}
srs_info
(
"recv publish request message success."
);
SrsAutoFree
(
SrsMessage
,
msg
,
false
);
SrsAutoFree
(
Srs
Common
Message
,
msg
,
false
);
}
// publish response onFCPublish(NetStream.Publish.Start)
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsOnStatusCallPacket
*
pkt
=
new
SrsOnStatusCallPacket
();
pkt
->
command_name
=
RTMP_AMF0_COMMAND_ON_FC_PUBLISH
;
...
...
@@ -582,7 +582,7 @@ int SrsRtmp::start_publish(int stream_id)
}
// publish response onStatus(NetStream.Publish.Start)
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsOnStatusCallPacket
*
pkt
=
new
SrsOnStatusCallPacket
();
pkt
->
data
->
set
(
StatusLevel
,
new
SrsAmf0String
(
StatusLevelStatus
));
...
...
@@ -608,7 +608,7 @@ int SrsRtmp::fmle_unpublish(int stream_id, double unpublish_tid)
// publish response onFCUnpublish(NetStream.unpublish.Success)
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsOnStatusCallPacket
*
pkt
=
new
SrsOnStatusCallPacket
();
pkt
->
command_name
=
RTMP_AMF0_COMMAND_ON_FC_UNPUBLISH
;
...
...
@@ -625,7 +625,7 @@ int SrsRtmp::fmle_unpublish(int stream_id, double unpublish_tid)
}
// FCUnpublish response
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsFMLEStartResPacket
*
pkt
=
new
SrsFMLEStartResPacket
(
unpublish_tid
);
msg
->
set_packet
(
pkt
,
stream_id
);
...
...
@@ -638,7 +638,7 @@ int SrsRtmp::fmle_unpublish(int stream_id, double unpublish_tid)
}
// publish response onStatus(NetStream.Unpublish.Success)
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsOnStatusCallPacket
*
pkt
=
new
SrsOnStatusCallPacket
();
pkt
->
data
->
set
(
StatusLevel
,
new
SrsAmf0String
(
StatusLevelStatus
));
...
...
@@ -665,7 +665,7 @@ int SrsRtmp::identify_create_stream_client(SrsCreateStreamPacket* req, int strea
int
ret
=
ERROR_SUCCESS
;
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsCreateStreamResPacket
*
pkt
=
new
SrsCreateStreamResPacket
(
req
->
transaction_id
,
stream_id
);
msg
->
set_packet
(
pkt
,
0
);
...
...
@@ -678,13 +678,13 @@ int SrsRtmp::identify_create_stream_client(SrsCreateStreamPacket* req, int strea
}
while
(
true
)
{
SrsMessage
*
msg
=
NULL
;
Srs
Common
Message
*
msg
=
NULL
;
if
((
ret
=
protocol
->
recv_message
(
&
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"recv identify client message failed. ret=%d"
,
ret
);
return
ret
;
}
SrsAutoFree
(
SrsMessage
,
msg
,
false
);
SrsAutoFree
(
Srs
Common
Message
,
msg
,
false
);
if
(
!
msg
->
header
.
is_amf0_command
()
&&
!
msg
->
header
.
is_amf3_command
())
{
srs_trace
(
"identify ignore messages except "
...
...
@@ -721,7 +721,7 @@ int SrsRtmp::identify_fmle_publish_client(SrsFMLEStartPacket* req, SrsClientType
// releaseStream response
if
(
true
)
{
Srs
Message
*
msg
=
new
Srs
Message
();
Srs
CommonMessage
*
msg
=
new
SrsCommon
Message
();
SrsFMLEStartResPacket
*
pkt
=
new
SrsFMLEStartResPacket
(
req
->
transaction_id
);
msg
->
set_packet
(
pkt
,
0
);
...
...
trunk/src/core/srs_core_rtmp.hpp
查看文件 @
cdd843a
...
...
@@ -35,7 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <st.h>
class
SrsProtocol
;
class
SrsMessage
;
class
Srs
Common
Message
;
class
SrsCreateStreamPacket
;
class
SrsFMLEStartPacket
;
...
...
@@ -100,9 +100,9 @@ public:
SrsRtmp
(
st_netfd_t
client_stfd
);
virtual
~
SrsRtmp
();
public
:
virtual
int
recv_message
(
SrsMessage
**
pmsg
);
virtual
int
recv_message
(
Srs
Common
Message
**
pmsg
);
virtual
int
can_read
(
int
timeout_ms
,
bool
&
ready
);
virtual
int
send_message
(
SrsMessage
*
msg
);
virtual
int
send_message
(
Srs
Common
Message
*
msg
);
public
:
virtual
int
handshake
();
virtual
int
connect_app
(
SrsRequest
*
req
);
...
...
trunk/src/core/srs_core_source.cpp
查看文件 @
cdd843a
...
...
@@ -47,7 +47,7 @@ SrsConsumer::~SrsConsumer()
{
}
int
SrsConsumer
::
get_packets
(
int
max_count
,
SrsMessage
**&
msgs
,
int
&
count
)
int
SrsConsumer
::
get_packets
(
int
max_count
,
Srs
Common
Message
**&
msgs
,
int
&
count
)
{
msgs
=
NULL
;
count
=
0
;
...
...
@@ -65,7 +65,7 @@ SrsSource::~SrsSource()
{
}
int
SrsSource
::
on_meta_data
(
SrsMessage
*
msg
,
SrsOnMetaDataPacket
*
metadata
)
int
SrsSource
::
on_meta_data
(
Srs
Common
Message
*
msg
,
SrsOnMetaDataPacket
*
metadata
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -75,13 +75,13 @@ int SrsSource::on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata)
return
ret
;
}
int
SrsSource
::
on_audio
(
SrsMessage
*
audio
)
int
SrsSource
::
on_audio
(
Srs
Common
Message
*
audio
)
{
int
ret
=
ERROR_SUCCESS
;
return
ret
;
}
int
SrsSource
::
on_video
(
SrsMessage
*
audio
)
int
SrsSource
::
on_video
(
Srs
Common
Message
*
audio
)
{
int
ret
=
ERROR_SUCCESS
;
return
ret
;
...
...
trunk/src/core/srs_core_source.hpp
查看文件 @
cdd843a
...
...
@@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <map>
#include <string>
class
SrsMessage
;
class
Srs
Common
Message
;
class
SrsOnMetaDataPacket
;
/**
...
...
@@ -51,7 +51,7 @@ public:
* @count the count in array.
* @max_count the max count to dequeue, 0 to dequeue all.
*/
virtual
int
get_packets
(
int
max_count
,
SrsMessage
**&
msgs
,
int
&
count
);
virtual
int
get_packets
(
int
max_count
,
Srs
Common
Message
**&
msgs
,
int
&
count
);
};
/**
...
...
@@ -75,9 +75,9 @@ public:
SrsSource
(
std
::
string
_stream_url
);
virtual
~
SrsSource
();
public
:
virtual
int
on_meta_data
(
SrsMessage
*
msg
,
SrsOnMetaDataPacket
*
metadata
);
virtual
int
on_audio
(
SrsMessage
*
audio
);
virtual
int
on_video
(
SrsMessage
*
video
);
virtual
int
on_meta_data
(
SrsCommonMessage
*
msg
,
SrsOnMetaDataPacket
*
metadata
);
virtual
int
on_audio
(
SrsCommonMessage
*
audio
);
virtual
int
on_video
(
SrsCommonMessage
*
video
);
public
:
virtual
SrsConsumer
*
create_consumer
();
};
...
...
请
注册
或
登录
后发表评论