winlin

fix bug #72, also need stream_id for send_and_free_message. 0.9.101

... ... @@ -76,9 +76,9 @@ start() {
# TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000"
if [[ -z $log_file ]]; then
(cd ${ROOT}; ${APP} -c ${CONFIG} >/dev/null 2>&1)
(ulimit -c unlimited && cd ${ROOT}; ${APP} -c ${CONFIG} >/dev/null 2>&1)
else
(cd ${ROOT}; ${APP} -c ${CONFIG} >> $log_file 2>&1)
(ulimit -c unlimited && cd ${ROOT}; ${APP} -c ${CONFIG} >> $log_file 2>&1)
fi
# check again after start server
... ...
... ... @@ -491,7 +491,7 @@ int SrsEdgeForwarder::cycle()
srs_assert(msg);
msgs[i] = NULL;
if ((ret = client->send_and_free_message(msg)) != ERROR_SUCCESS) {
if ((ret = client->send_and_free_message(msg, stream_id)) != ERROR_SUCCESS) {
srs_error("edge publish forwarder send message to server failed. ret=%d", ret);
return ret;
}
... ...
... ... @@ -370,7 +370,7 @@ int SrsForwarder::forward()
srs_assert(msg);
msgs[i] = NULL;
if ((ret = client->send_and_free_message(msg)) != ERROR_SUCCESS) {
if ((ret = client->send_and_free_message(msg, stream_id)) != ERROR_SUCCESS) {
srs_error("forwarder send message to server failed. ret=%d", ret);
return ret;
}
... ...
... ... @@ -538,7 +538,7 @@ int SrsRtmpConn::playing(SrsSource* source)
duration += msg->header.timestamp - starttime;
starttime = msg->header.timestamp;
if ((ret = rtmp->send_and_free_message(msg)) != ERROR_SUCCESS) {
if ((ret = rtmp->send_and_free_message(msg, res->stream_id)) != ERROR_SUCCESS) {
srs_error("send message to client failed. ret=%d", ret);
return ret;
}
... ...
... ... @@ -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 "100"
#define VERSION_REVISION "101"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "srs"
... ...
... ... @@ -365,7 +365,7 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data,
if (msg) {
// send out encoded msg.
if ((ret = context->rtmp->send_and_free_message(msg)) != ERROR_SUCCESS) {
if ((ret = context->rtmp->send_and_free_message(msg, context->stream_id)) != ERROR_SUCCESS) {
return ret;
}
} else {
... ...
... ... @@ -385,9 +385,9 @@ int SrsRtmpClient::decode_message(SrsMessage* msg, SrsPacket** ppacket)
return protocol->decode_message(msg, ppacket);
}
int SrsRtmpClient::send_and_free_message(SrsMessage* msg)
int SrsRtmpClient::send_and_free_message(SrsMessage* msg, int stream_id)
{
return protocol->send_and_free_message(msg);
return protocol->send_and_free_message(msg, stream_id);
}
int SrsRtmpClient::send_and_free_packet(SrsPacket* packet, int stream_id)
... ... @@ -730,9 +730,9 @@ int SrsRtmpServer::decode_message(SrsMessage* msg, SrsPacket** ppacket)
return protocol->decode_message(msg, ppacket);
}
int SrsRtmpServer::send_and_free_message(SrsMessage* msg)
int SrsRtmpServer::send_and_free_message(SrsMessage* msg, int stream_id)
{
return protocol->send_and_free_message(msg);
return protocol->send_and_free_message(msg, stream_id);
}
int SrsRtmpServer::send_and_free_packet(SrsPacket* packet, int stream_id)
... ...
... ... @@ -164,7 +164,7 @@ public:
virtual int64_t get_send_bytes();
virtual int recv_message(SrsMessage** pmsg);
virtual int decode_message(SrsMessage* msg, SrsPacket** ppacket);
virtual int send_and_free_message(SrsMessage* msg);
virtual int send_and_free_message(SrsMessage* msg, int stream_id);
virtual int send_and_free_packet(SrsPacket* packet, int stream_id);
public:
// try complex, then simple handshake.
... ... @@ -209,7 +209,7 @@ public:
virtual int64_t get_send_bytes();
virtual int recv_message(SrsMessage** pmsg);
virtual int decode_message(SrsMessage* msg, SrsPacket** ppacket);
virtual int send_and_free_message(SrsMessage* msg);
virtual int send_and_free_message(SrsMessage* msg, int stream_id);
virtual int send_and_free_packet(SrsPacket* packet, int stream_id);
public:
virtual int handshake();
... ...
... ... @@ -725,8 +725,11 @@ int SrsProtocol::do_decode_message(SrsMessageHeader& header, SrsStream* stream,
return ret;
}
int SrsProtocol::send_and_free_message(SrsMessage* msg)
int SrsProtocol::send_and_free_message(SrsMessage* msg, int stream_id)
{
if (msg) {
msg->header.stream_id = stream_id;
}
return do_send_and_free_message(msg, NULL);
}
... ...
... ... @@ -161,8 +161,9 @@ public:
* user must never free or use the msg after this method,
* for it will always free the msg.
* @param msg, the msg to send out, never be NULL.
* @param stream_id, the stream id of packet to send over, 0 for control message.
*/
virtual int send_and_free_message(SrsMessage* msg);
virtual int send_and_free_message(SrsMessage* msg, int stream_id);
/**
* send the RTMP packet and always free it.
* user must never free or use the packet after this method,
... ...