Refine RTMP common message.

This commit is contained in:
winlin 2025-09-01 18:51:20 -04:00
parent 3e8cb3f9d5
commit f3059d37a4
28 changed files with 499 additions and 500 deletions

View File

@ -279,7 +279,7 @@ srs_error_t SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader *rr, SrsFlvDecod
return srs_error_wrap(err, "read tag data");
}
SrsCommonMessage *cmsg = NULL;
SrsRtmpCommonMessage *cmsg = NULL;
if ((err = srs_rtmp_create_msg(type, time, data, size, sdk->sid(), &cmsg)) != srs_success) {
return srs_error_wrap(err, "create message");
}

View File

@ -1082,7 +1082,6 @@ private:
public:
// Whether http stream enabled.
// TODO: FIXME: rename to http_static.
virtual bool get_http_stream_enabled();
// Get the http stream listen addresses, support IPv4 and IPv6.
virtual std::vector<std::string> get_http_stream_listens();

View File

@ -125,12 +125,12 @@ srs_error_t SrsEdgeRtmpUpstream::connect(ISrsRequest *r, SrsLbRoundRobin *lb)
return err;
}
srs_error_t SrsEdgeRtmpUpstream::recv_message(SrsCommonMessage **pmsg)
srs_error_t SrsEdgeRtmpUpstream::recv_message(SrsRtmpCommonMessage **pmsg)
{
return sdk->recv_message(pmsg);
}
srs_error_t SrsEdgeRtmpUpstream::decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket)
srs_error_t SrsEdgeRtmpUpstream::decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket)
{
return sdk->decode_message(msg, ppacket);
}
@ -300,7 +300,7 @@ srs_error_t SrsEdgeFlvUpstream::do_connect(ISrsRequest *r, SrsLbRoundRobin *lb,
return err;
}
srs_error_t SrsEdgeFlvUpstream::recv_message(SrsCommonMessage **pmsg)
srs_error_t SrsEdgeFlvUpstream::recv_message(SrsRtmpCommonMessage **pmsg)
{
srs_error_t err = srs_success;
@ -323,7 +323,7 @@ srs_error_t SrsEdgeFlvUpstream::recv_message(SrsCommonMessage **pmsg)
}
int stream_id = 1;
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
if ((err = srs_rtmp_create_msg(type, time, data, size, stream_id, &msg)) != srs_success) {
return srs_error_wrap(err, "create message");
}
@ -333,7 +333,7 @@ srs_error_t SrsEdgeFlvUpstream::recv_message(SrsCommonMessage **pmsg)
return err;
}
srs_error_t SrsEdgeFlvUpstream::decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket)
srs_error_t SrsEdgeFlvUpstream::decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket)
{
srs_error_t err = srs_success;
@ -603,13 +603,13 @@ srs_error_t SrsEdgeIngester::ingest(string &redirect)
}
// read from client.
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
if ((err = upstream->recv_message(&msg_raw)) != srs_success) {
return srs_error_wrap(err, "recv message");
}
srs_assert(msg_raw);
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
if ((err = process_publish_message(msg.get(), redirect)) != srs_success) {
return srs_error_wrap(err, "process message");
@ -619,7 +619,7 @@ srs_error_t SrsEdgeIngester::ingest(string &redirect)
return err;
}
srs_error_t SrsEdgeIngester::process_publish_message(SrsCommonMessage *msg, string &redirect)
srs_error_t SrsEdgeIngester::process_publish_message(SrsRtmpCommonMessage *msg, string &redirect)
{
srs_error_t err = srs_success;
@ -871,7 +871,7 @@ srs_error_t SrsEdgeForwarder::do_cycle()
// read from client.
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
err = sdk->recv_message(&msg);
if (err != srs_success && srs_error_code(err) != ERROR_SOCKET_TIMEOUT) {
@ -914,7 +914,7 @@ srs_error_t SrsEdgeForwarder::do_cycle()
return err;
}
srs_error_t SrsEdgeForwarder::proxy(SrsCommonMessage *msg)
srs_error_t SrsEdgeForwarder::proxy(SrsRtmpCommonMessage *msg)
{
srs_error_t err = srs_success;
@ -1090,7 +1090,7 @@ srs_error_t SrsPublishEdge::on_client_publish()
return err;
}
srs_error_t SrsPublishEdge::on_proxy_publish(SrsCommonMessage *msg)
srs_error_t SrsPublishEdge::on_proxy_publish(SrsRtmpCommonMessage *msg)
{
return forwarder->proxy(msg);
}

View File

@ -21,7 +21,7 @@ class ISrsRequest;
class SrsPlayEdge;
class SrsPublishEdge;
class SrsRtmpClient;
class SrsCommonMessage;
class SrsRtmpCommonMessage;
class SrsMessageQueue;
class ISrsProtocolReadWriter;
class SrsKbps;
@ -65,8 +65,8 @@ public:
public:
virtual srs_error_t connect(ISrsRequest *r, SrsLbRoundRobin *lb) = 0;
virtual srs_error_t recv_message(SrsCommonMessage **pmsg) = 0;
virtual srs_error_t decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket) = 0;
virtual srs_error_t recv_message(SrsRtmpCommonMessage **pmsg) = 0;
virtual srs_error_t decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket) = 0;
virtual void close() = 0;
public:
@ -95,8 +95,8 @@ public:
public:
virtual srs_error_t connect(ISrsRequest *r, SrsLbRoundRobin *lb);
virtual srs_error_t recv_message(SrsCommonMessage **pmsg);
virtual srs_error_t decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual srs_error_t recv_message(SrsRtmpCommonMessage **pmsg);
virtual srs_error_t decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual void close();
public:
@ -134,8 +134,8 @@ private:
virtual srs_error_t do_connect(ISrsRequest *r, SrsLbRoundRobin *lb, int redirect_depth);
public:
virtual srs_error_t recv_message(SrsCommonMessage **pmsg);
virtual srs_error_t decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual srs_error_t recv_message(SrsRtmpCommonMessage **pmsg);
virtual srs_error_t decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual void close();
public:
@ -177,7 +177,7 @@ private:
private:
virtual srs_error_t ingest(std::string &redirect);
virtual srs_error_t process_publish_message(SrsCommonMessage *msg, std::string &redirect);
virtual srs_error_t process_publish_message(SrsRtmpCommonMessage *msg, std::string &redirect);
};
// The edge used to forward stream to origin.
@ -220,7 +220,7 @@ private:
virtual srs_error_t do_cycle();
public:
virtual srs_error_t proxy(SrsCommonMessage *msg);
virtual srs_error_t proxy(SrsRtmpCommonMessage *msg);
};
// The play edge control service.
@ -270,7 +270,7 @@ public:
// When client publish stream on edge.
virtual srs_error_t on_client_publish();
// Proxy publish stream to edge
virtual srs_error_t on_proxy_publish(SrsCommonMessage *msg);
virtual srs_error_t on_proxy_publish(SrsRtmpCommonMessage *msg);
// Proxy unpublish stream to edge.
virtual void on_proxy_unpublish();
};

View File

@ -274,7 +274,7 @@ srs_error_t SrsForwarder::forward()
// read from client.
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
err = sdk->recv_message(&msg);
if (err != srs_success && srs_error_code(err) != ERROR_SOCKET_TIMEOUT) {

View File

@ -2107,7 +2107,7 @@ srs_error_t SrsGbMuxer::rtmp_write_packet(char type, uint32_t timestamp, char *d
return srs_error_wrap(err, "connect");
}
SrsCommonMessage *cmsg = NULL;
SrsRtmpCommonMessage *cmsg = NULL;
if ((err = srs_rtmp_create_msg(type, timestamp, data, size, sdk_->sid(), &cmsg)) != srs_success) {
return srs_error_wrap(err, "create message");
}

View File

@ -604,7 +604,7 @@ srs_error_t SrsMpegtsOverUdp::rtmp_write_packet(char type, uint32_t timestamp, c
return srs_error_wrap(err, "connect");
}
SrsCommonMessage *cmsg = NULL;
SrsRtmpCommonMessage *cmsg = NULL;
if ((err = srs_rtmp_create_msg(type, timestamp, data, size, sdk->sid(), &cmsg)) != srs_success) {
return srs_error_wrap(err, "create message");
}

View File

@ -123,7 +123,7 @@ srs_error_t SrsRecvThread::do_cycle()
continue;
}
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
// Process the received message.
if ((err = rtmp->recv_message(&msg)) == srs_success) {
@ -157,9 +157,9 @@ SrsQueueRecvThread::~SrsQueueRecvThread()
stop();
// clear all messages.
std::vector<SrsCommonMessage *>::iterator it;
std::vector<SrsRtmpCommonMessage *>::iterator it;
for (it = queue.begin(); it != queue.end(); ++it) {
SrsCommonMessage *msg = *it;
SrsRtmpCommonMessage *msg = *it;
srs_freep(msg);
}
queue.clear();
@ -193,11 +193,11 @@ int SrsQueueRecvThread::size()
return (int)queue.size();
}
SrsCommonMessage *SrsQueueRecvThread::pump()
SrsRtmpCommonMessage *SrsQueueRecvThread::pump()
{
srs_assert(!queue.empty());
SrsCommonMessage *msg = *queue.begin();
SrsRtmpCommonMessage *msg = *queue.begin();
queue.erase(queue.begin());
@ -209,7 +209,7 @@ srs_error_t SrsQueueRecvThread::error_code()
return srs_error_copy(recv_error);
}
srs_error_t SrsQueueRecvThread::consume(SrsCommonMessage *msg)
srs_error_t SrsQueueRecvThread::consume(SrsRtmpCommonMessage *msg)
{
// put into queue, the send thread will get and process it,
// @see SrsRtmpConn::process_play_control_msg
@ -348,7 +348,7 @@ void SrsPublishRecvThread::stop()
trd.stop();
}
srs_error_t SrsPublishRecvThread::consume(SrsCommonMessage *msg)
srs_error_t SrsPublishRecvThread::consume(SrsRtmpCommonMessage *msg)
{
srs_error_t err = srs_success;

View File

@ -19,7 +19,7 @@
#include <srs_protocol_stream.hpp>
class SrsRtmpServer;
class SrsCommonMessage;
class SrsRtmpCommonMessage;
class SrsRtmpConn;
class SrsLiveSource;
class ISrsRequest;
@ -37,7 +37,7 @@ public:
public:
// Consume the received message.
// @remark user must free this message.
virtual srs_error_t consume(SrsCommonMessage *msg) = 0;
virtual srs_error_t consume(SrsRtmpCommonMessage *msg) = 0;
};
// The message pumper to pump messages to processer.
@ -99,7 +99,7 @@ private:
class SrsQueueRecvThread : public ISrsMessagePumper
{
private:
std::vector<SrsCommonMessage *> queue;
std::vector<SrsRtmpCommonMessage *> queue;
SrsRecvThread trd;
SrsRtmpServer *rtmp;
// The recv thread error code.
@ -118,11 +118,11 @@ public:
public:
virtual bool empty();
virtual int size();
virtual SrsCommonMessage *pump();
virtual SrsRtmpCommonMessage *pump();
virtual srs_error_t error_code();
// Interface ISrsMessagePumper
public:
virtual srs_error_t consume(SrsCommonMessage *msg);
virtual srs_error_t consume(SrsRtmpCommonMessage *msg);
virtual bool interrupted();
virtual void interrupt(srs_error_t err);
virtual void on_start();
@ -183,7 +183,7 @@ public:
virtual void stop();
// Interface ISrsMessagePumper
public:
virtual srs_error_t consume(SrsCommonMessage *msg);
virtual srs_error_t consume(SrsRtmpCommonMessage *msg);
virtual bool interrupted();
virtual void interrupt(srs_error_t err);
virtual void on_start();

View File

@ -1864,7 +1864,7 @@ srs_error_t SrsRtcFrameBuilder::transcode_audio(SrsRtpPacket *pkt)
uint8_t *header = NULL;
audio_transcoder_->aac_codec_header(&header, &header_len);
SrsCommonMessage out_rtmp;
SrsRtmpCommonMessage out_rtmp;
packet_aac(&out_rtmp, (char *)header, header_len, ts, is_first_audio_);
SrsMediaPacket msg;
@ -1892,7 +1892,7 @@ srs_error_t SrsRtcFrameBuilder::transcode_audio(SrsRtpPacket *pkt)
}
for (std::vector<SrsParsedAudioPacket *>::iterator it = out_pkts.begin(); it != out_pkts.end(); ++it) {
SrsCommonMessage out_rtmp;
SrsRtmpCommonMessage out_rtmp;
// TODO: FIXME: Should never directly use it, please define a variable with class name.
out_rtmp.header.timestamp = (*it)->dts;
packet_aac(&out_rtmp, (*it)->samples[0].bytes, (*it)->samples[0].size, ts, is_first_audio_);
@ -1910,7 +1910,7 @@ srs_error_t SrsRtcFrameBuilder::transcode_audio(SrsRtpPacket *pkt)
return err;
}
void SrsRtcFrameBuilder::packet_aac(SrsCommonMessage *audio, char *data, int len, uint32_t pts, bool is_header)
void SrsRtcFrameBuilder::packet_aac(SrsRtmpCommonMessage *audio, char *data, int len, uint32_t pts, bool is_header)
{
int rtmp_len = len + 2;
audio->header.initialize_audio(rtmp_len, pts, 1);
@ -2069,7 +2069,7 @@ srs_error_t SrsRtcFrameBuilder::do_packet_sequence_header_avc(SrsRtpPacket *pkt,
SrsMessageHeader header;
header.initialize_video(nb_flv, pkt->get_avsync_time(), 1);
SrsCommonMessage rtmp;
SrsRtmpCommonMessage rtmp;
if ((err = rtmp.create(&header, flv, nb_flv)) != srs_success) {
return srs_error_wrap(err, "create rtmp");
}
@ -2166,7 +2166,7 @@ srs_error_t SrsRtcFrameBuilder::do_packet_sequence_header_hevc(SrsRtpPacket *pkt
SrsMessageHeader header;
header.initialize_video(nb_flv, pkt->get_avsync_time(), 1);
SrsCommonMessage rtmp;
SrsRtmpCommonMessage rtmp;
if ((err = rtmp.create(&header, flv, nb_flv)) != srs_success) {
return srs_error_wrap(err, "create rtmp");
}
@ -2394,7 +2394,7 @@ srs_error_t SrsRtcFrameBuilder::packet_video_rtmp(const uint16_t start, const ui
frame_type = SrsVideoAvcFrameTypeKeyFrame;
}
SrsCommonMessage rtmp;
SrsRtmpCommonMessage rtmp;
rtmp.header.initialize_video(nb_payload, pkt->get_avsync_time(), 1);
rtmp.create_payload(nb_payload);
SrsBuffer payload(rtmp.payload(), rtmp.size());

View File

@ -25,7 +25,7 @@
class ISrsRequest;
class SrsMetaCache;
class SrsMediaPacket;
class SrsCommonMessage;
class SrsRtmpCommonMessage;
class SrsMessageArray;
class SrsRtcSource;
class SrsFrameToRtcBridge;
@ -498,7 +498,7 @@ public:
private:
srs_error_t packet_audio(SrsRtpPacket *pkt);
srs_error_t transcode_audio(SrsRtpPacket *pkt);
void packet_aac(SrsCommonMessage *audio, char *data, int len, uint32_t pts, bool is_header);
void packet_aac(SrsRtmpCommonMessage *audio, char *data, int len, uint32_t pts, bool is_header);
private:
srs_error_t packet_video(SrsRtpPacket *pkt);

View File

@ -774,7 +774,7 @@ srs_error_t SrsRtmpConn::do_playing(SrsSharedPtr<SrsLiveSource> source, SrsLiveC
// to use isolate thread to recv, can improve about 33% performance.
while (!rtrd->empty()) {
SrsCommonMessage *msg = rtrd->pump();
SrsRtmpCommonMessage *msg = rtrd->pump();
if ((err = process_play_control_msg(consumer, msg)) != srs_success) {
return srs_error_wrap(err, "rtmp: play control message");
}
@ -1103,7 +1103,7 @@ void SrsRtmpConn::release_publish(SrsSharedPtr<SrsLiveSource> source)
}
}
srs_error_t SrsRtmpConn::handle_publish_message(SrsSharedPtr<SrsLiveSource> &source, SrsCommonMessage *msg)
srs_error_t SrsRtmpConn::handle_publish_message(SrsSharedPtr<SrsLiveSource> &source, SrsRtmpCommonMessage *msg)
{
srs_error_t err = srs_success;
@ -1144,7 +1144,7 @@ srs_error_t SrsRtmpConn::handle_publish_message(SrsSharedPtr<SrsLiveSource> &sou
return err;
}
srs_error_t SrsRtmpConn::process_publish_message(SrsSharedPtr<SrsLiveSource> &source, SrsCommonMessage *msg)
srs_error_t SrsRtmpConn::process_publish_message(SrsSharedPtr<SrsLiveSource> &source, SrsRtmpCommonMessage *msg)
{
srs_error_t err = srs_success;
@ -1200,14 +1200,14 @@ srs_error_t SrsRtmpConn::process_publish_message(SrsSharedPtr<SrsLiveSource> &so
return err;
}
srs_error_t SrsRtmpConn::process_play_control_msg(SrsLiveConsumer *consumer, SrsCommonMessage *msg_raw)
srs_error_t SrsRtmpConn::process_play_control_msg(SrsLiveConsumer *consumer, SrsRtmpCommonMessage *msg_raw)
{
srs_error_t err = srs_success;
if (!msg_raw) {
return err;
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
if (!msg->header.is_amf0_command() && !msg->header.is_amf3_command()) {
return err;

View File

@ -25,7 +25,7 @@ class SrsResponse;
class SrsLiveSource;
class SrsRefer;
class SrsLiveConsumer;
class SrsCommonMessage;
class SrsRtmpCommonMessage;
class SrsStSocket;
class SrsHttpHooks;
class SrsBandwidth;
@ -36,7 +36,7 @@ class SrsQueueRecvThread;
class SrsPublishRecvThread;
class SrsSecurity;
class ISrsWakable;
class SrsCommonMessage;
class SrsRtmpCommonMessage;
class SrsRtmpCommand;
class SrsNetworkDelta;
@ -195,9 +195,9 @@ private:
virtual srs_error_t do_publishing(SrsSharedPtr<SrsLiveSource> source, SrsPublishRecvThread *trd);
virtual srs_error_t acquire_publish(SrsSharedPtr<SrsLiveSource> source);
virtual void release_publish(SrsSharedPtr<SrsLiveSource> source);
virtual srs_error_t handle_publish_message(SrsSharedPtr<SrsLiveSource> &source, SrsCommonMessage *msg);
virtual srs_error_t process_publish_message(SrsSharedPtr<SrsLiveSource> &source, SrsCommonMessage *msg);
virtual srs_error_t process_play_control_msg(SrsLiveConsumer *consumer, SrsCommonMessage *msg);
virtual srs_error_t handle_publish_message(SrsSharedPtr<SrsLiveSource> &source, SrsRtmpCommonMessage *msg);
virtual srs_error_t process_publish_message(SrsSharedPtr<SrsLiveSource> &source, SrsRtmpCommonMessage *msg);
virtual srs_error_t process_play_control_msg(SrsLiveConsumer *consumer, SrsRtmpCommonMessage *msg);
virtual void set_sock_options();
private:

View File

@ -1525,7 +1525,7 @@ srs_error_t SrsMetaCache::update_data(SrsMessageHeader *header, SrsOnMetaDataPac
// dump message to shared ptr message.
// the payload/size managed by cache_metadata, user should not free it.
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
if ((err = common_msg.create(header, payload, size)) != srs_success) {
return srs_error_wrap(err, "create metadata");
}
@ -1912,7 +1912,7 @@ bool SrsLiveSource::can_publish(bool is_edge)
return can_publish_;
}
srs_error_t SrsLiveSource::on_meta_data(SrsCommonMessage *msg, SrsOnMetaDataPacket *metadata)
srs_error_t SrsLiveSource::on_meta_data(SrsRtmpCommonMessage *msg, SrsOnMetaDataPacket *metadata)
{
srs_error_t err = srs_success;
@ -1962,7 +1962,7 @@ srs_error_t SrsLiveSource::on_meta_data(SrsCommonMessage *msg, SrsOnMetaDataPack
return hub->on_meta_data(meta->data(), metadata);
}
srs_error_t SrsLiveSource::on_audio(SrsCommonMessage *shared_audio)
srs_error_t SrsLiveSource::on_audio(SrsRtmpCommonMessage *shared_audio)
{
// Detect where stream is monotonically increasing.
@ -2093,7 +2093,7 @@ srs_error_t SrsLiveSource::on_audio_imp(SrsMediaPacket *msg)
return err;
}
srs_error_t SrsLiveSource::on_video(SrsCommonMessage *shared_video)
srs_error_t SrsLiveSource::on_video(SrsRtmpCommonMessage *shared_video)
{
srs_error_t err = srs_success;
@ -2207,7 +2207,7 @@ srs_error_t SrsLiveSource::on_video_imp(SrsMediaPacket *msg)
return err;
}
srs_error_t SrsLiveSource::on_aggregate(SrsCommonMessage *msg)
srs_error_t SrsLiveSource::on_aggregate(SrsRtmpCommonMessage *msg)
{
srs_error_t err = srs_success;
@ -2261,7 +2261,7 @@ srs_error_t SrsLiveSource::on_aggregate(SrsCommonMessage *msg)
}
// to common message.
SrsCommonMessage o;
SrsRtmpCommonMessage o;
o.header.message_type = type;
o.header.payload_length = data_size;
@ -2512,7 +2512,7 @@ srs_error_t SrsLiveSource::on_edge_start_publish()
}
// TODO: FIXME: Use edge strategy pattern.
srs_error_t SrsLiveSource::on_edge_proxy_publish(SrsCommonMessage *msg)
srs_error_t SrsLiveSource::on_edge_proxy_publish(SrsRtmpCommonMessage *msg)
{
return publish_edge->on_proxy_publish(msg);
}

View File

@ -27,7 +27,7 @@ class SrsLiveConsumer;
class SrsPlayEdge;
class SrsPublishEdge;
class SrsLiveSource;
class SrsCommonMessage;
class SrsRtmpCommonMessage;
class SrsOnMetaDataPacket;
class SrsMediaPacket;
class SrsForwarder;
@ -592,11 +592,11 @@ public:
public:
virtual bool can_publish(bool is_edge);
virtual srs_error_t on_meta_data(SrsCommonMessage *msg, SrsOnMetaDataPacket *metadata);
virtual srs_error_t on_meta_data(SrsRtmpCommonMessage *msg, SrsOnMetaDataPacket *metadata);
public:
// TODO: FIXME: Use SrsMediaPacket instead.
virtual srs_error_t on_audio(SrsCommonMessage *audio);
virtual srs_error_t on_audio(SrsRtmpCommonMessage *audio);
srs_error_t on_frame(SrsMediaPacket *msg);
private:
@ -604,13 +604,13 @@ private:
public:
// TODO: FIXME: Use SrsMediaPacket instead.
virtual srs_error_t on_video(SrsCommonMessage *video);
virtual srs_error_t on_video(SrsRtmpCommonMessage *video);
private:
virtual srs_error_t on_video_imp(SrsMediaPacket *video);
public:
virtual srs_error_t on_aggregate(SrsCommonMessage *msg);
virtual srs_error_t on_aggregate(SrsRtmpCommonMessage *msg);
// Publish stream event notify.
// @param _req the request from client, the source will deep copy it,
// for when reload the request of client maybe invalid.
@ -635,7 +635,7 @@ public:
// For edge, when publish edge stream, check the state
virtual srs_error_t on_edge_start_publish();
// For edge, proxy the publish
virtual srs_error_t on_edge_proxy_publish(SrsCommonMessage *msg);
virtual srs_error_t on_edge_proxy_publish(SrsRtmpCommonMessage *msg);
// For edge, proxy stop publish
virtual void on_edge_proxy_unpublish();

View File

@ -502,7 +502,7 @@ srs_error_t SrsSrtFrameBuilder::check_sps_pps_change(SrsTsMessage *msg)
SrsMessageHeader header;
header.initialize_video(nb_flv, dts, video_streamid_);
SrsCommonMessage rtmp;
SrsRtmpCommonMessage rtmp;
if ((err = rtmp.create(&header, flv, nb_flv)) != srs_success) {
return srs_error_wrap(err, "create rtmp");
}
@ -541,7 +541,7 @@ srs_error_t SrsSrtFrameBuilder::on_h264_frame(SrsTsMessage *msg, vector<pair<cha
}
}
SrsCommonMessage rtmp;
SrsRtmpCommonMessage rtmp;
rtmp.header.initialize_video(frame_size, dts, video_streamid_);
rtmp.create_payload(frame_size);
SrsBuffer payload(rtmp.payload(), rtmp.size());
@ -688,7 +688,7 @@ srs_error_t SrsSrtFrameBuilder::check_vps_sps_pps_change(SrsTsMessage *msg)
SrsMessageHeader header;
header.initialize_video(nb_flv, dts, video_streamid_);
SrsCommonMessage rtmp;
SrsRtmpCommonMessage rtmp;
if ((err = rtmp.create(&header, flv, nb_flv)) != srs_success) {
return srs_error_wrap(err, "create rtmp");
}
@ -730,7 +730,7 @@ srs_error_t SrsSrtFrameBuilder::on_hevc_frame(SrsTsMessage *msg, vector<pair<cha
}
}
SrsCommonMessage rtmp;
SrsRtmpCommonMessage rtmp;
rtmp.header.initialize_video(frame_size, dts, video_streamid_);
rtmp.create_payload(frame_size);
SrsBuffer payload(rtmp.payload(), rtmp.size());
@ -862,7 +862,7 @@ srs_error_t SrsSrtFrameBuilder::check_audio_sh_change(SrsTsMessage *msg, uint32_
int rtmp_len = audio_sh_.size() + 2;
SrsCommonMessage rtmp;
SrsRtmpCommonMessage rtmp;
rtmp.header.initialize_audio(rtmp_len, pts, audio_streamid_);
rtmp.create_payload(rtmp_len);
@ -888,7 +888,7 @@ srs_error_t SrsSrtFrameBuilder::on_aac_frame(SrsTsMessage *msg, uint32_t pts, ch
int rtmp_len = data_size + 2 /* 2 bytes of flv audio tag header*/;
SrsCommonMessage rtmp;
SrsRtmpCommonMessage rtmp;
rtmp.header.initialize_audio(rtmp_len, pts, audio_streamid_);
rtmp.create_payload(rtmp_len);

View File

@ -287,24 +287,24 @@ void SrsMessageHeader::initialize_video(int size, uint32_t time, int stream)
stream_id = (int32_t)stream;
}
SrsCommonMessage::SrsCommonMessage()
SrsRtmpCommonMessage::SrsRtmpCommonMessage()
{
payload_ = SrsSharedPtr<SrsMemoryBlock>(NULL);
}
SrsCommonMessage::~SrsCommonMessage()
SrsRtmpCommonMessage::~SrsRtmpCommonMessage()
{
// payload_ automatically cleaned up by SrsSharedPtr
}
void SrsCommonMessage::create_payload(int size)
void SrsRtmpCommonMessage::create_payload(int size)
{
payload_ = SrsSharedPtr<SrsMemoryBlock>(new SrsMemoryBlock());
payload_->create(size);
srs_verbose("create payload for RTMP message. size=%d", size);
}
srs_error_t SrsCommonMessage::create(SrsMessageHeader *pheader, char *body, int size)
srs_error_t SrsRtmpCommonMessage::create(SrsMessageHeader *pheader, char *body, int size)
{
srs_error_t err = srs_success;
@ -323,7 +323,7 @@ srs_error_t SrsCommonMessage::create(SrsMessageHeader *pheader, char *body, int
return err;
}
void SrsCommonMessage::to_msg(SrsMediaPacket *msg)
void SrsRtmpCommonMessage::to_msg(SrsMediaPacket *msg)
{
msg->payload_ = payload_;
msg->timestamp = header.timestamp;

View File

@ -189,7 +189,7 @@ public:
// protcol always recv RTMP message, and can send RTMP message or RTMP packet.
// The common message is read from underlay protocol sdk.
// while the shared ptr message used to copy and send.
class SrsCommonMessage
class SrsRtmpCommonMessage
{
public:
// 4.1. Message Header
@ -200,8 +200,8 @@ public:
SrsSharedPtr<SrsMemoryBlock> payload_;
public:
SrsCommonMessage();
virtual ~SrsCommonMessage();
SrsRtmpCommonMessage();
virtual ~SrsRtmpCommonMessage();
public:
// Backward compatibility accessors

View File

@ -201,12 +201,12 @@ int SrsBasicRtmpClient::sid()
return stream_id;
}
srs_error_t SrsBasicRtmpClient::recv_message(SrsCommonMessage **pmsg)
srs_error_t SrsBasicRtmpClient::recv_message(SrsRtmpCommonMessage **pmsg)
{
return client->recv_message(pmsg);
}
srs_error_t SrsBasicRtmpClient::decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket)
srs_error_t SrsBasicRtmpClient::decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket)
{
return client->decode_message(msg, ppacket);
}

View File

@ -14,7 +14,7 @@
class ISrsRequest;
class SrsTcpClient;
class SrsRtmpClient;
class SrsCommonMessage;
class SrsRtmpCommonMessage;
class SrsMediaPacket;
class SrsRtmpCommand;
class SrsNetworkKbps;
@ -74,8 +74,8 @@ public:
virtual int sid();
public:
virtual srs_error_t recv_message(SrsCommonMessage **pmsg);
virtual srs_error_t decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual srs_error_t recv_message(SrsRtmpCommonMessage **pmsg);
virtual srs_error_t decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual srs_error_t send_and_free_messages(SrsMediaPacket **msgs, int nb_msgs);
virtual srs_error_t send_and_free_message(SrsMediaPacket *msg);

View File

@ -87,7 +87,7 @@ SrsRtmpCommand::~SrsRtmpCommand()
{
}
srs_error_t SrsRtmpCommand::to_msg(SrsCommonMessage *msg, int stream_id)
srs_error_t SrsRtmpCommand::to_msg(SrsRtmpCommonMessage *msg, int stream_id)
{
srs_error_t err = srs_success;
@ -313,14 +313,14 @@ srs_error_t SrsProtocol::set_in_window_ack_size(int ack_size)
return srs_success;
}
srs_error_t SrsProtocol::recv_message(SrsCommonMessage **pmsg)
srs_error_t SrsProtocol::recv_message(SrsRtmpCommonMessage **pmsg)
{
*pmsg = NULL;
srs_error_t err = srs_success;
while (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
if ((err = recv_interlaced_message(&msg)) != srs_success) {
srs_freep(msg);
@ -351,7 +351,7 @@ srs_error_t SrsProtocol::recv_message(SrsCommonMessage **pmsg)
return err;
}
srs_error_t SrsProtocol::decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket)
srs_error_t SrsProtocol::decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket)
{
*ppacket = NULL;
@ -548,7 +548,7 @@ srs_error_t SrsProtocol::do_send_and_free_packet(SrsRtmpCommand *packet_raw, int
srs_assert(packet_raw);
SrsUniquePtr<SrsRtmpCommand> packet(packet_raw);
SrsUniquePtr<SrsCommonMessage> msg(new SrsCommonMessage());
SrsUniquePtr<SrsRtmpCommonMessage> msg(new SrsRtmpCommonMessage());
if ((err = packet->to_msg(msg.get(), stream_id)) != srs_success) {
return srs_error_wrap(err, "to message");
@ -768,7 +768,7 @@ srs_error_t SrsProtocol::send_and_free_packet(SrsRtmpCommand *packet, int stream
return err;
}
srs_error_t SrsProtocol::recv_interlaced_message(SrsCommonMessage **pmsg)
srs_error_t SrsProtocol::recv_interlaced_message(SrsRtmpCommonMessage **pmsg)
{
srs_error_t err = srs_success;
@ -804,7 +804,7 @@ srs_error_t SrsProtocol::recv_interlaced_message(SrsCommonMessage **pmsg)
}
// read msg payload from chunk stream.
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
if ((err = read_message_payload(chunk, &msg)) != srs_success) {
return srs_error_wrap(err, "read message payload");
}
@ -968,7 +968,7 @@ srs_error_t SrsProtocol::read_message_header(SrsChunkStream *chunk, char fmt)
// create msg when new chunk stream start
if (!chunk->msg) {
chunk->msg = new SrsCommonMessage();
chunk->msg = new SrsRtmpCommonMessage();
chunk->writing_pos_ = chunk->msg->payload();
}
@ -1174,7 +1174,7 @@ srs_error_t SrsProtocol::read_message_header(SrsChunkStream *chunk, char fmt)
return err;
}
srs_error_t SrsProtocol::read_message_payload(SrsChunkStream *chunk, SrsCommonMessage **pmsg)
srs_error_t SrsProtocol::read_message_payload(SrsChunkStream *chunk, SrsRtmpCommonMessage **pmsg)
{
srs_error_t err = srs_success;
@ -1223,7 +1223,7 @@ srs_error_t SrsProtocol::read_message_payload(SrsChunkStream *chunk, SrsCommonMe
return err;
}
srs_error_t SrsProtocol::on_recv_message(SrsCommonMessage *msg)
srs_error_t SrsProtocol::on_recv_message(SrsRtmpCommonMessage *msg)
{
srs_error_t err = srs_success;
@ -1810,12 +1810,12 @@ int64_t SrsRtmpClient::get_send_bytes()
return protocol->get_send_bytes();
}
srs_error_t SrsRtmpClient::recv_message(SrsCommonMessage **pmsg)
srs_error_t SrsRtmpClient::recv_message(SrsRtmpCommonMessage **pmsg)
{
return protocol->recv_message(pmsg);
}
srs_error_t SrsRtmpClient::decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket)
srs_error_t SrsRtmpClient::decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket)
{
return protocol->decode_message(msg, ppacket);
}
@ -1942,13 +1942,13 @@ srs_error_t SrsRtmpClient::connect_app(string app, string tcUrl, ISrsRequest *r,
}
// expect connect _result
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
SrsConnectAppResPacket *pkt_raw = NULL;
if ((err = expect_message<SrsConnectAppResPacket>(&msg_raw, &pkt_raw)) != srs_success) {
return srs_error_wrap(err, "expect connect app response");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsConnectAppResPacket> pkt(pkt_raw);
// server info
@ -2010,13 +2010,13 @@ srs_error_t SrsRtmpClient::create_stream(int &stream_id)
// CreateStream _result.
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
SrsCreateStreamResPacket *pkt_raw = NULL;
if ((err = expect_message<SrsCreateStreamResPacket>(&msg_raw, &pkt_raw)) != srs_success) {
return srs_error_wrap(err, "expect create stream response");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsCreateStreamResPacket> pkt(pkt_raw);
stream_id = (int)pkt->stream_id;
@ -2122,13 +2122,13 @@ srs_error_t SrsRtmpClient::fmle_publish(string stream, int &stream_id)
// expect result of CreateStream
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
SrsCreateStreamResPacket *pkt_raw = NULL;
if ((err = expect_message<SrsCreateStreamResPacket>(&msg_raw, &pkt_raw)) != srs_success) {
return srs_error_wrap(err, "expect create stream response message failed");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsCreateStreamResPacket> pkt(pkt_raw);
stream_id = (int)pkt->stream_id;
@ -2211,12 +2211,12 @@ int64_t SrsRtmpServer::get_send_bytes()
return protocol->get_send_bytes();
}
srs_error_t SrsRtmpServer::recv_message(SrsCommonMessage **pmsg)
srs_error_t SrsRtmpServer::recv_message(SrsRtmpCommonMessage **pmsg)
{
return protocol->recv_message(pmsg);
}
srs_error_t SrsRtmpServer::decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket)
srs_error_t SrsRtmpServer::decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket)
{
return protocol->decode_message(msg, ppacket);
}
@ -2265,13 +2265,13 @@ srs_error_t SrsRtmpServer::connect_app(ISrsRequest *req)
{
srs_error_t err = srs_success;
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
SrsConnectAppPacket *pkt_raw = NULL;
if ((err = expect_message<SrsConnectAppPacket>(&msg_raw, &pkt_raw)) != srs_success) {
return srs_error_wrap(err, "expect connect app response");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsConnectAppPacket> pkt(pkt_raw);
SrsAmf0Any *prop = NULL;
@ -2407,7 +2407,7 @@ srs_error_t SrsRtmpServer::redirect(ISrsRequest *r, string url, bool &accepted)
// or we never know whether the client is ok to redirect.
protocol->set_recv_timeout(SRS_RTMP_REDIRECT_TIMEOUT);
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
SrsCallPacket *pkt_raw = NULL;
if ((err = expect_message<SrsCallPacket>(&msg_raw, &pkt_raw)) != srs_success) {
srs_freep(err);
@ -2415,7 +2415,7 @@ srs_error_t SrsRtmpServer::redirect(ISrsRequest *r, string url, bool &accepted)
return srs_success;
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsCallPacket> pkt(pkt_raw);
string message;
@ -2463,12 +2463,12 @@ srs_error_t SrsRtmpServer::identify_client(int stream_id, SrsRtmpConnType &type,
srs_error_t err = srs_success;
while (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
if ((err = protocol->recv_message(&msg_raw)) != srs_success) {
return srs_error_wrap(err, "recv identify message");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsMessageHeader &h = msg->header;
if (h.is_ackledgement() || h.is_set_chunk_size() || h.is_window_ackledgement_size() || h.is_user_control_message()) {
@ -2671,13 +2671,13 @@ srs_error_t SrsRtmpServer::start_fmle_publish(int stream_id)
// FCPublish
double fc_publish_tid = 0;
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
SrsFMLEStartPacket *pkt_raw = NULL;
if ((err = expect_message<SrsFMLEStartPacket>(&msg_raw, &pkt_raw)) != srs_success) {
return srs_error_wrap(err, "recv FCPublish");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsFMLEStartPacket> pkt(pkt_raw);
fc_publish_tid = pkt->transaction_id;
@ -2693,13 +2693,13 @@ srs_error_t SrsRtmpServer::start_fmle_publish(int stream_id)
// createStream
double create_stream_tid = 0;
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
SrsCreateStreamPacket *pkt_raw = NULL;
if ((err = expect_message<SrsCreateStreamPacket>(&msg_raw, &pkt_raw)) != srs_success) {
return srs_error_wrap(err, "recv createStream");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsCreateStreamPacket> pkt(pkt_raw);
create_stream_tid = pkt->transaction_id;
@ -2714,13 +2714,13 @@ srs_error_t SrsRtmpServer::start_fmle_publish(int stream_id)
// publish
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
SrsPublishPacket *pkt_raw = NULL;
if ((err = expect_message<SrsPublishPacket>(&msg_raw, &pkt_raw)) != srs_success) {
return srs_error_wrap(err, "recv publish");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsPublishPacket> pkt(pkt_raw);
}
// publish response onFCPublish(NetStream.Publish.Start)
@ -2745,13 +2745,13 @@ srs_error_t SrsRtmpServer::start_haivision_publish(int stream_id)
// publish
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
SrsPublishPacket *pkt_raw = NULL;
if ((err = expect_message<SrsPublishPacket>(&msg_raw, &pkt_raw)) != srs_success) {
return srs_error_wrap(err, "recv publish");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsPublishPacket> pkt(pkt_raw);
}
@ -2854,12 +2854,12 @@ srs_error_t SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket *
}
while (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
if ((err = protocol->recv_message(&msg_raw)) != srs_success) {
return srs_error_wrap(err, "recv identify");
}
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
SrsMessageHeader &h = msg->header;
if (h.is_ackledgement() || h.is_set_chunk_size() || h.is_window_ackledgement_size() || h.is_user_control_message()) {

View File

@ -38,7 +38,7 @@ class SrsFMLEStartPacket;
class SrsPublishPacket;
class SrsOnMetaDataPacket;
class SrsPlayPacket;
class SrsCommonMessage;
class SrsRtmpCommonMessage;
class SrsRtmpCommand;
class SrsAmf0Object;
class IMergeReadHandler;
@ -100,7 +100,7 @@ public:
public:
// Covert packet to common message.
virtual srs_error_t to_msg(SrsCommonMessage *msg, int stream_id);
virtual srs_error_t to_msg(SrsRtmpCommonMessage *msg, int stream_id);
public:
// The subpacket can override this encode,
@ -256,12 +256,12 @@ public:
// NULL for unknown packet but return success.
// never NULL if decode success.
// @remark, drop message when msg is empty or payload length is empty.
virtual srs_error_t recv_message(SrsCommonMessage **pmsg);
virtual srs_error_t recv_message(SrsRtmpCommonMessage **pmsg);
// Decode bytes oriented RTMP message to RTMP packet,
// @param ppacket, output decoded packet,
// always NULL if error, never NULL if success.
// @return error when unknown packet, error when decode failed.
virtual srs_error_t decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual srs_error_t decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket);
// Send the RTMP message and always free it.
// user must never free or use the msg after this method,
// For it will always free the msg.
@ -288,7 +288,7 @@ public:
// @ppacket, user must free it, which decode from payload of message. NULL if not success.
// @remark, only when success, user can use and must free the pmsg and ppacket.
// For example:
// SrsCommonMessage* msg = NULL;
// SrsRtmpCommonMessage* msg = NULL;
// SrsConnectAppResPacket* pkt = NULL;
// if ((ret = protocol->expect_message<SrsConnectAppResPacket>(protocol, &msg, &pkt)) != ERROR_SUCCESS) {
// return ret;
@ -299,7 +299,7 @@ public:
// user should never recv message and convert it, use this method instead.
// if need to set timeout, use set timeout of SrsProtocol.
template <class T>
srs_error_t expect_message(SrsCommonMessage **pmsg, T **ppacket)
srs_error_t expect_message(SrsRtmpCommonMessage **pmsg, T **ppacket)
{
*pmsg = NULL;
*ppacket = NULL;
@ -307,7 +307,7 @@ public:
srs_error_t err = srs_success;
while (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
if ((err = recv_message(&msg)) != srs_success) {
return srs_error_wrap(err, "recv message");
}
@ -348,7 +348,7 @@ private:
// return error if error occur and nerver set the pmsg,
// return success and pmsg set to NULL if no entire message got,
// return success and pmsg set to entire message if got one.
virtual srs_error_t recv_interlaced_message(SrsCommonMessage **pmsg);
virtual srs_error_t recv_interlaced_message(SrsRtmpCommonMessage **pmsg);
// Read the chunk basic header(fmt, cid) from chunk stream.
// user can discovery a SrsChunkStream by cid.
virtual srs_error_t read_basic_header(char &fmt, int &cid);
@ -357,9 +357,9 @@ private:
virtual srs_error_t read_message_header(SrsChunkStream *chunk, char fmt);
// Read the chunk payload, remove the used bytes in buffer,
// if got entire message, set the pmsg.
virtual srs_error_t read_message_payload(SrsChunkStream *chunk, SrsCommonMessage **pmsg);
virtual srs_error_t read_message_payload(SrsChunkStream *chunk, SrsRtmpCommonMessage **pmsg);
// When recv message, update the context.
virtual srs_error_t on_recv_message(SrsCommonMessage *msg);
virtual srs_error_t on_recv_message(SrsRtmpCommonMessage *msg);
// When message sentout, update the context.
virtual srs_error_t on_send_packet(SrsMessageHeader *mh, SrsRtmpCommand *packet);
@ -389,7 +389,7 @@ public:
// Whether the chunk message header has extended timestamp.
bool has_extended_timestamp;
// The partially read message.
SrsCommonMessage *msg;
SrsRtmpCommonMessage *msg;
// Current writing position of message.
char *writing_pos_;
// Decoded msg count, to identify whether the chunk stream is fresh.
@ -598,8 +598,8 @@ public:
virtual void set_send_timeout(srs_utime_t tm);
virtual int64_t get_recv_bytes();
virtual int64_t get_send_bytes();
virtual srs_error_t recv_message(SrsCommonMessage **pmsg);
virtual srs_error_t decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual srs_error_t recv_message(SrsRtmpCommonMessage **pmsg);
virtual srs_error_t decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual srs_error_t send_and_free_message(SrsMediaPacket *msg, int stream_id);
virtual srs_error_t send_and_free_messages(SrsMediaPacket **msgs, int nb_msgs, int stream_id);
virtual srs_error_t send_and_free_packet(SrsRtmpCommand *packet, int stream_id);
@ -636,7 +636,7 @@ public:
// @ppacket, user must free it, which decode from payload of message. NULL if not success.
// @remark, only when success, user can use and must free the pmsg and ppacket.
// For example:
// SrsCommonMessage* msg = NULL;
// SrsRtmpCommonMessage* msg = NULL;
// SrsConnectAppResPacket* pkt = NULL;
// if ((ret = client->expect_message<SrsConnectAppResPacket>(protocol, &msg, &pkt)) != ERROR_SUCCESS) {
// return ret;
@ -647,7 +647,7 @@ public:
// user should never recv message and convert it, use this method instead.
// if need to set timeout, use set timeout of SrsProtocol.
template <class T>
srs_error_t expect_message(SrsCommonMessage **pmsg, T **ppacket)
srs_error_t expect_message(SrsRtmpCommonMessage **pmsg, T **ppacket)
{
return protocol->expect_message<T>(pmsg, ppacket);
}
@ -707,12 +707,12 @@ public:
// NULL for unknown packet but return success.
// never NULL if decode success.
// @remark, drop message when msg is empty or payload length is empty.
virtual srs_error_t recv_message(SrsCommonMessage **pmsg);
virtual srs_error_t recv_message(SrsRtmpCommonMessage **pmsg);
// Decode bytes oriented RTMP message to RTMP packet,
// @param ppacket, output decoded packet,
// always NULL if error, never NULL if success.
// @return error when unknown packet, error when decode failed.
virtual srs_error_t decode_message(SrsCommonMessage *msg, SrsRtmpCommand **ppacket);
virtual srs_error_t decode_message(SrsRtmpCommonMessage *msg, SrsRtmpCommand **ppacket);
// Send the RTMP message and always free it.
// user must never free or use the msg after this method,
// For it will always free the msg.
@ -808,7 +808,7 @@ public:
// @ppacket, user must free it, which decode from payload of message. NULL if not success.
// @remark, only when success, user can use and must free the pmsg and ppacket.
// For example:
// SrsCommonMessage* msg = NULL;
// SrsRtmpCommonMessage* msg = NULL;
// SrsConnectAppResPacket* pkt = NULL;
// if ((ret = server->expect_message<SrsConnectAppResPacket>(&msg, &pkt)) != ERROR_SUCCESS) {
// return ret;
@ -819,7 +819,7 @@ public:
// user should never recv message and convert it, use this method instead.
// if need to set timeout, use set timeout of SrsProtocol.
template <class T>
srs_error_t expect_message(SrsCommonMessage **pmsg, T **ppacket)
srs_error_t expect_message(SrsRtmpCommonMessage **pmsg, T **ppacket)
{
return protocol->expect_message<T>(pmsg, ppacket);
}
@ -1308,7 +1308,7 @@ protected:
};
// onStatus command, AMF0 Call
// @remark, user must set the stream_id by SrsCommonMessage.set_packet().
// @remark, user must set the stream_id by SrsRtmpCommonMessage.set_packet().
class SrsOnStatusCallPacket : public SrsRtmpCommand
{
public:
@ -1341,7 +1341,7 @@ protected:
};
// onStatus data, AMF0 Data
// @remark, user must set the stream_id by SrsCommonMessage.set_packet().
// @remark, user must set the stream_id by SrsRtmpCommonMessage.set_packet().
class SrsOnStatusDataPacket : public SrsRtmpCommand
{
public:
@ -1369,7 +1369,7 @@ protected:
};
// AMF0Data RtmpSampleAccess
// @remark, user must set the stream_id by SrsCommonMessage.set_packet().
// @remark, user must set the stream_id by SrsRtmpCommonMessage.set_packet().
class SrsNaluSampleAccessPacket : public SrsRtmpCommand
{
public:

View File

@ -283,18 +283,18 @@ string srs_net_url_encode_rtmp_url(string server, int port, string host, string
return url;
}
srs_error_t srs_do_rtmp_create_msg(char type, uint32_t timestamp, char *data, int size, int stream_id, SrsCommonMessage **ppmsg)
srs_error_t srs_do_rtmp_create_msg(char type, uint32_t timestamp, char *data, int size, int stream_id, SrsRtmpCommonMessage **ppmsg)
{
srs_error_t err = srs_success;
*ppmsg = NULL;
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
if (type == SrsFrameTypeAudio) {
SrsMessageHeader header;
header.initialize_audio(size, timestamp, stream_id);
msg = new SrsCommonMessage();
msg = new SrsRtmpCommonMessage();
if ((err = msg->create(&header, data, size)) != srs_success) {
srs_freep(msg);
return srs_error_wrap(err, "create message");
@ -303,7 +303,7 @@ srs_error_t srs_do_rtmp_create_msg(char type, uint32_t timestamp, char *data, in
SrsMessageHeader header;
header.initialize_video(size, timestamp, stream_id);
msg = new SrsCommonMessage();
msg = new SrsRtmpCommonMessage();
if ((err = msg->create(&header, data, size)) != srs_success) {
srs_freep(msg);
return srs_error_wrap(err, "create message");
@ -312,7 +312,7 @@ srs_error_t srs_do_rtmp_create_msg(char type, uint32_t timestamp, char *data, in
SrsMessageHeader header;
header.initialize_amf0_script(size, stream_id);
msg = new SrsCommonMessage();
msg = new SrsRtmpCommonMessage();
if ((err = msg->create(&header, data, size)) != srs_success) {
srs_freep(msg);
return srs_error_wrap(err, "create message");
@ -326,7 +326,7 @@ srs_error_t srs_do_rtmp_create_msg(char type, uint32_t timestamp, char *data, in
return err;
}
srs_error_t srs_rtmp_create_msg(char type, uint32_t timestamp, char *data, int size, int stream_id, SrsCommonMessage **ppmsg)
srs_error_t srs_rtmp_create_msg(char type, uint32_t timestamp, char *data, int size, int stream_id, SrsRtmpCommonMessage **ppmsg)
{
srs_error_t err = srs_success;

View File

@ -33,7 +33,7 @@ class ISrsHttpMessage;
class SrsMessageHeader;
class SrsMediaPacket;
class SrsCommonMessage;
class SrsRtmpCommonMessage;
class ISrsProtocolReadWriter;
class ISrsReader;
@ -101,7 +101,7 @@ extern std::string srs_net_url_encode_rtmp_url(std::string server, int port, std
* @param data the packet bytes. user should never free it.
* @param ppmsg output the shared ptr message. user should free it.
*/
extern srs_error_t srs_rtmp_create_msg(char type, uint32_t timestamp, char *data, int size, int stream_id, SrsCommonMessage **ppmsg);
extern srs_error_t srs_rtmp_create_msg(char type, uint32_t timestamp, char *data, int size, int stream_id, SrsRtmpCommonMessage **ppmsg);
// write large numbers of iovs.
extern srs_error_t srs_write_large_iovs(ISrsProtocolReadWriter *skt, iovec *iovs, int size, ssize_t *pnwrite = NULL);

View File

@ -967,7 +967,7 @@ VOID TEST(KernelFLVTest, CoverWriterErrorCase)
SrsMessageHeader h;
h.initialize_video(10, 30, 20);
SrsMediaPacket msg;
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
HELPER_EXPECT_SUCCESS(common_msg.create(&h, new char[1], 1));
common_msg.to_msg(&msg);
@ -986,7 +986,7 @@ VOID TEST(KernelFLVTest, CoverWriterErrorCase)
SrsMessageHeader h;
h.initialize_audio(10, 30, 20);
SrsMediaPacket msg;
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
HELPER_EXPECT_SUCCESS(common_msg.create(&h, new char[1], 1));
common_msg.to_msg(&msg);
@ -1005,7 +1005,7 @@ VOID TEST(KernelFLVTest, CoverWriterErrorCase)
SrsMessageHeader h;
h.initialize_amf0_script(10, 20);
SrsMediaPacket msg;
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
HELPER_EXPECT_SUCCESS(common_msg.create(&h, new char[1], 1));
common_msg.to_msg(&msg);
@ -5287,7 +5287,7 @@ VOID TEST(KernelFLVTest, CoverAll)
SrsMessageHeader h;
h.initialize_video(10, 30, 20);
SrsCommonMessage m;
SrsRtmpCommonMessage m;
HELPER_EXPECT_SUCCESS(m.create(&h, NULL, 0));
EXPECT_EQ(RTMP_MSG_VideoMessage, m.header.message_type);
EXPECT_EQ(10, m.header.payload_length);
@ -5311,7 +5311,7 @@ VOID TEST(KernelFLVTest, CoverAll)
h.initialize_video(10, 30, 20);
SrsMediaPacket m;
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
HELPER_EXPECT_SUCCESS(common_msg.create(&h, new char[1], 1));
common_msg.to_msg(&m);
@ -5329,7 +5329,7 @@ VOID TEST(KernelFLVTest, CoverSharedPtrMessage)
if (true) {
SrsMessageHeader h;
SrsMediaPacket m;
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
HELPER_EXPECT_SUCCESS(common_msg.create(&h, new char[1], 1));
common_msg.to_msg(&m);
}
@ -5337,7 +5337,7 @@ VOID TEST(KernelFLVTest, CoverSharedPtrMessage)
if (true) {
SrsMessageHeader h;
SrsMediaPacket m;
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
HELPER_EXPECT_SUCCESS(common_msg.create(&h, NULL, 0));
common_msg.to_msg(&m);
}
@ -5345,7 +5345,7 @@ VOID TEST(KernelFLVTest, CoverSharedPtrMessage)
if (true) {
SrsMessageHeader h;
SrsMediaPacket m;
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
HELPER_EXPECT_FAILED(common_msg.create(&h, NULL, -1));
}
@ -5353,7 +5353,7 @@ VOID TEST(KernelFLVTest, CoverSharedPtrMessage)
SrsMessageHeader h;
SrsMediaPacket m;
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
HELPER_EXPECT_SUCCESS(common_msg.create(&h, NULL, 0));
common_msg.to_msg(&m);

View File

@ -898,7 +898,7 @@ VOID TEST(ProtocolMsgArrayTest, MessageArray)
SrsMessageHeader header;
SrsMediaPacket msg;
char *payload = new char[1024];
SrsCommonMessage common_msg;
SrsRtmpCommonMessage common_msg;
HELPER_EXPECT_SUCCESS(common_msg.create(&header, payload, 1024));
common_msg.to_msg(&msg);
@ -1010,9 +1010,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvMessage)
0x67, 0x00, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt = NULL;
HELPER_EXPECT_SUCCESS(proto.decode_message(msg, &pkt));
@ -1047,9 +1047,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvMessageBug98)
};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt = NULL;
HELPER_EXPECT_SUCCESS(proto.decode_message(msg, &pkt));
@ -1083,9 +1083,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAckSizeMessage)
0x00, 0x00, 0x07, 0x63};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt = NULL;
HELPER_EXPECT_SUCCESS(proto.decode_message(msg, &pkt));
@ -1118,9 +1118,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVMessage)
0x00, 0x00, 0x07, 0x63};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -1146,9 +1146,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAMessage)
0x00, 0x00, 0x07, 0x63};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_audio());
}
@ -1193,9 +1193,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVMessage2Trunk)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -1402,15 +1402,15 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAMessage)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_audio());
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
}
@ -1641,15 +1641,15 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAFmt1)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_audio());
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
}
@ -1876,15 +1876,15 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAFmt2)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_audio());
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
}
@ -2108,15 +2108,15 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAFmt3)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_audio());
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
}
@ -2487,25 +2487,25 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVMessage)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
@ -2891,25 +2891,25 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVFmt1)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x22, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
@ -3293,25 +3293,25 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVFmt2)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x22, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
@ -3694,25 +3694,25 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVFmt3)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
@ -3763,9 +3763,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid1BNormal)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -3813,9 +3813,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid1BMax)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -3863,9 +3863,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid2BMin)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -3913,9 +3913,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid2BNormal)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -3963,9 +3963,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid2BNormal2)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -4013,9 +4013,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid2BMax)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -4063,9 +4063,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BMin)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -4113,9 +4113,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BNormal)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -4163,9 +4163,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BNormal2)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -4213,9 +4213,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BNormal3)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -4263,9 +4263,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BNormal4)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -4313,9 +4313,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid3BMax)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
}
@ -4350,9 +4350,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvV0LenMessage)
0x00, 0x00, 0x07, 0x63};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_video());
// protocol stack will ignore the empty video message.
EXPECT_EQ(4, msg->header.payload_length);
@ -4370,8 +4370,8 @@ VOID TEST(ProtocolStackTest, ProtocolSendVMessage)
uint8_t data[] = {0x01, 0x02, 0x03, 0x04};
SrsCommonMessage *msg = new SrsCommonMessage();
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = new SrsRtmpCommonMessage();
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->create_payload(sizeof(data));
memcpy(msg->payload(), data, sizeof(data));
@ -4909,7 +4909,7 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVMessageFmtInvalid)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(proto.recv_message(&msg));
}
@ -4931,8 +4931,8 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
}
if (true) {
SrsCommonMessage *msg = new SrsCommonMessage();
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = new SrsRtmpCommonMessage();
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->create_payload(4096);
msg->header.payload_length = 4096;
@ -4953,16 +4953,16 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
// recv SrsSetWindowAckSizePacket
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
ASSERT_TRUE(msg->header.is_window_ackledgement_size());
}
// recv video
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
ASSERT_TRUE(msg->header.is_video());
}
@ -4973,16 +4973,16 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
}
// recv auto send acked size. #1
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
ASSERT_TRUE(msg->header.is_ackledgement());
}
// send again
if (true) {
SrsCommonMessage *msg = new SrsCommonMessage();
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = new SrsRtmpCommonMessage();
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->header.payload_length = 4096;
msg->create_payload(4096);
@ -5001,9 +5001,9 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
}
// recv video
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
ASSERT_TRUE(msg->header.is_video());
}
@ -5014,9 +5014,9 @@ VOID TEST(ProtocolStackTest, ProtocolAckSizeFlow)
}
// recv auto send acked size. #2
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
ASSERT_TRUE(msg->header.is_ackledgement());
}
}
@ -5045,9 +5045,9 @@ VOID TEST(ProtocolStackTest, ProtocolPingFlow)
}
// recv ping
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_TRUE(msg->header.is_user_control_message());
}
@ -5059,9 +5059,9 @@ VOID TEST(ProtocolStackTest, ProtocolPingFlow)
}
// recv ping
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
ASSERT_TRUE(msg->header.is_user_control_message());
SrsRtmpCommand *pkt = NULL;
@ -5123,10 +5123,10 @@ VOID TEST(ProtocolStackTest, ProtocolExcpectMessage)
0x67, 0x00, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsConnectAppPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(proto.expect_message<SrsConnectAppPacket>(&msg, &pkt));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsConnectAppPacket> pkt_uptr(pkt);
ASSERT_TRUE(NULL != pkt);
}

View File

@ -560,36 +560,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt11)
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x40, msg->header.timestamp);
@ -1140,36 +1140,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt11Length)
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x40, msg->header.timestamp);
@ -1716,36 +1716,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt12)
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x40, msg->header.timestamp);
@ -2295,9 +2295,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt12Length)
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
@ -2305,18 +2305,18 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt12Length)
EXPECT_EQ(0x110, msg->header.payload_length);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
@ -2324,9 +2324,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt12Length)
EXPECT_EQ(0x120, msg->header.payload_length);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x40, msg->header.timestamp);
@ -2371,9 +2371,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvExtTimeMessage)
0x00, 0x00, 0x07, 0x63};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
@ -2415,9 +2415,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvExtTimeMessage2)
0x00, 0x00, 0x07, 0x63};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x7f010203, msg->header.timestamp);
@ -2460,9 +2460,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvExtTimeMessage3)
0x00, 0x00, 0x07, 0x63};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
// always use 31bits timestamp
@ -2535,9 +2535,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVExtTime2Trunk)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
// 0xCX with extended timestamp.
@ -2592,9 +2592,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVExtTime2Trunk2)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
// 0xCX without extended timestamp.
@ -3199,36 +3199,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaStream)
if (true) {
bio.in_buffer.append((char *)audio_data1, sizeof(audio_data1));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x00002710, msg->header.timestamp);
}
if (true) {
bio.in_buffer.append((char *)video_data1, sizeof(video_data1));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x00002af8, msg->header.timestamp);
}
if (true) {
bio.in_buffer.append((char *)audio_data2, sizeof(audio_data2));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x01002710, msg->header.timestamp);
}
if (true) {
bio.in_buffer.append((char *)video_data2, sizeof(video_data2));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x01002710, msg->header.timestamp);
}
@ -3539,18 +3539,18 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaAudio)
if (true) {
bio.in_buffer.append((char *)audio_data1, sizeof(audio_data1));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x00002710, msg->header.timestamp);
}
if (true) {
bio.in_buffer.append((char *)audio_data2, sizeof(audio_data2));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x01002710, msg->header.timestamp);
}
@ -3861,18 +3861,18 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaVideo)
if (true) {
bio.in_buffer.append((char *)video_data1, sizeof(video_data1));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x00002af8, msg->header.timestamp);
}
if (true) {
bio.in_buffer.append((char *)video_data2, sizeof(video_data2));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x01002710, msg->header.timestamp);
}
@ -4203,18 +4203,18 @@ VOID TEST(ProtocolStackTest, ProtocolRecvAVExtTimedeltaVideoFmt3)
if (true) {
bio.in_buffer.append((char *)video_data1, sizeof(video_data1));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x00002af8, msg->header.timestamp);
}
if (true) {
bio.in_buffer.append((char *)video_data2, sizeof(video_data2));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x01002710, msg->header.timestamp);
}
@ -4264,9 +4264,9 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVCid1BMin)
0x2e, 0x73, 0x77, 0x66, 0x3f, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e};
bio.in_buffer.append((char *)data, sizeof(data));
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
}
@ -5952,36 +5952,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVMessage)
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x30, msg->header.timestamp);
@ -6530,36 +6530,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt1)
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x30, msg->header.timestamp);
@ -7104,36 +7104,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt2)
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x30, msg->header.timestamp);
@ -7676,36 +7676,36 @@ VOID TEST(ProtocolStackTest, ProtocolRecvVAVVFmt3)
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x10, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_audio());
EXPECT_EQ(0x15, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x20, msg->header.timestamp);
EXPECT_EQ(0x01, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg_raw = NULL;
SrsRtmpCommonMessage *msg_raw = NULL;
HELPER_ASSERT_SUCCESS(proto.recv_message(&msg_raw));
SrsUniquePtr<SrsCommonMessage> msg(msg_raw);
SrsUniquePtr<SrsRtmpCommonMessage> msg(msg_raw);
EXPECT_TRUE(msg->header.is_video());
EXPECT_EQ(0x30, msg->header.timestamp);

View File

@ -246,7 +246,7 @@ VOID TEST(ProtocolRTMPTest, SendPacketsError)
MockBufferIO io;
SrsProtocol p(&io);
SrsCommonMessage pkt;
SrsRtmpCommonMessage pkt;
pkt.header.initialize_audio(200, 1000, 1);
pkt.create_payload(256);
@ -341,7 +341,7 @@ VOID TEST(ProtocolRTMPTest, HugeMessages)
MockBufferIO io;
SrsProtocol p(&io);
SrsCommonMessage pkt;
SrsRtmpCommonMessage pkt;
pkt.header.initialize_audio(200, 1000, 1);
pkt.create_payload(256);
@ -356,7 +356,7 @@ VOID TEST(ProtocolRTMPTest, HugeMessages)
MockBufferIO io;
SrsProtocol p(&io);
SrsCommonMessage pkt;
SrsRtmpCommonMessage pkt;
pkt.header.initialize_audio(200, 1000, 1);
pkt.create_payload(256);
@ -377,7 +377,7 @@ VOID TEST(ProtocolRTMPTest, HugeMessages)
MockBufferIO io;
SrsProtocol p(&io);
SrsCommonMessage pkt;
SrsRtmpCommonMessage pkt;
pkt.header.initialize_audio(200, 1000, 1);
pkt.create_payload(256);
@ -404,7 +404,7 @@ VOID TEST(ProtocolRTMPTest, DecodeMessages)
SrsProtocol p(&io);
// AMF0 message with 1B should fail.
SrsCommonMessage msg;
SrsRtmpCommonMessage msg;
msg.header.initialize_amf0_script(1, 1);
msg.create_payload(1);
@ -437,16 +437,16 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages)
// Always response ACK message.
HELPER_EXPECT_SUCCESS(p.set_in_window_ack_size(1));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
io.in_buffer.append(&bytes);
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
}
SrsCommonMessage *_create_amf0(char *bytes, int size, int stream_id)
SrsRtmpCommonMessage *_create_amf0(char *bytes, int size, int stream_id)
{
SrsCommonMessage *msg = new SrsCommonMessage();
SrsRtmpCommonMessage *msg = new SrsRtmpCommonMessage();
msg->header.initialize_amf0_script(size, stream_id);
msg->create_payload(size);
memcpy(msg->payload(), bytes, size);
@ -462,8 +462,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages2)
SrsProtocol p(&io);
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x01, 's', 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0x03, 0, 0, 9};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->header.message_type = RTMP_MSG_AMF3CommandMessage;
SrsRtmpCommand *pkt;
@ -479,8 +479,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages2)
SrsProtocol p(&io);
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x01, 's'};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->header.message_type = RTMP_MSG_AMF3CommandMessage;
SrsRtmpCommand *pkt;
@ -493,8 +493,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages2)
SrsProtocol p(&io);
uint8_t bytes[] = {0x00};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->header.message_type = 0xff;
SrsRtmpCommand *pkt;
@ -507,8 +507,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages2)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 0x01, 's'};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->header.message_type = RTMP_MSG_AMF0DataMessage;
SrsRtmpCommand *pkt;
@ -526,8 +526,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't'};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->header.message_type = RTMP_MSG_AMF0DataMessage;
SrsRtmpCommand *pkt;
@ -541,8 +541,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
SrsProtocol p(&io);
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't'};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->header.message_type = RTMP_MSG_AMF3DataMessage;
SrsRtmpCommand *pkt;
@ -556,8 +556,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
SrsProtocol p(&io);
uint8_t bytes[] = {0x17, 0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
msg->header.message_type = RTMP_MSG_AMF3CommandMessage;
SrsRtmpCommand *pkt;
@ -575,8 +575,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
HELPER_EXPECT_SUCCESS(p.send_and_free_packet(request, 1));
uint8_t bytes[] = {0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the response packet.
@ -593,8 +593,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
HELPER_EXPECT_SUCCESS(p.send_and_free_packet(request, 1));
uint8_t bytes[] = {0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the response packet.
@ -611,8 +611,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
HELPER_EXPECT_SUCCESS(p.send_and_free_packet(request, 1));
uint8_t bytes[] = {0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the response packet.
@ -629,8 +629,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
HELPER_EXPECT_SUCCESS(p.send_and_free_packet(request, 1));
uint8_t bytes[] = {0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the response packet.
@ -648,8 +648,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
HELPER_EXPECT_SUCCESS(p.send_and_free_packet(request, 1));
uint8_t bytes[] = {0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the response packet.
@ -667,8 +667,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages3)
HELPER_EXPECT_SUCCESS(p.send_and_free_packet(request, 1));
uint8_t bytes[] = {0x02, 0x00, 0x07, '_', 'r', 'e', 's', 'u', 'l', 't', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the response packet.
@ -686,8 +686,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 0x07, 'c', 'o', 'n', 'n', 'e', 'c', 't', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -700,8 +700,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 12, 'c', 'r', 'e', 'a', 't', 'e', 'S', 't', 'r', 'e', 'a', 'm', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -714,8 +714,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 4, 'p', 'l', 'a', 'y', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -728,8 +728,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 5, 'p', 'a', 'u', 's', 'e', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -742,8 +742,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 13, 'r', 'e', 'l', 'e', 'a', 's', 'e', 'S', 't', 'r', 'e', 'a', 'm', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -756,8 +756,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 9, 'F', 'C', 'P', 'u', 'b', 'l', 'i', 's', 'h', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -770,8 +770,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 7, 'p', 'u', 'b', 'l', 'i', 's', 'h', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -784,8 +784,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 11, 'F', 'C', 'U', 'n', 'p', 'u', 'b', 'l', 'i', 's', 'h', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -798,8 +798,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 13, '@', 's', 'e', 't', 'D', 'a', 't', 'a', 'F', 'r', 'a', 'm', 'e', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -812,8 +812,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 10, 'o', 'n', 'M', 'e', 't', 'a', 'D', 'a', 't', 'a', 03, 0, 0, 9};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
HELPER_EXPECT_SUCCESS(p.decode_message(msg, &pkt));
@ -825,8 +825,8 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 11, 'c', 'l', 'o', 's', 'e', 'S', 't', 'r', 'e', 'a', 'm', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -839,9 +839,9 @@ VOID TEST(ProtocolRTMPTest, OnDecodeMessages4)
SrsProtocol p(&io);
uint8_t bytes[] = {0x02, 0x00, 3, 's', 'r', 's', 0x00, 0, 0, 0, 0, 0, 0, 0, 0};
SrsCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
SrsRtmpCommonMessage *msg = _create_amf0((char *)bytes, sizeof(bytes), 1);
msg->header.message_type = RTMP_MSG_AMF0CommandMessage;
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt;
// Without enough data, it fail when decoding the request packet.
@ -861,9 +861,9 @@ VOID TEST(ProtocolRTMPTest, RecvMessage)
uint8_t bytes[] = {0x01, 0x00, 0x00};
io.in_buffer.append((char *)bytes, sizeof(bytes));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
if (true) {
@ -873,9 +873,9 @@ VOID TEST(ProtocolRTMPTest, RecvMessage)
uint8_t bytes[] = {0x00, 0x00};
io.in_buffer.append((char *)bytes, sizeof(bytes));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
if (true) {
@ -885,18 +885,18 @@ VOID TEST(ProtocolRTMPTest, RecvMessage)
uint8_t bytes[] = {0x00};
io.in_buffer.append((char *)bytes, sizeof(bytes));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
if (true) {
MockBufferIO io;
SrsProtocol p(&io);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
}
@ -911,9 +911,9 @@ VOID TEST(ProtocolRTMPTest, RecvMessage2)
uint8_t bytes[] = {0x03, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 1, 2, 3};
io.in_buffer.append((char *)bytes, sizeof(bytes));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
if (true) {
@ -926,16 +926,16 @@ VOID TEST(ProtocolRTMPTest, RecvMessage2)
io.in_buffer.append((char *)bytes, sizeof(bytes));
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
uint8_t bytes2[] = {0x43, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 1, 2, 3};
io.in_buffer.append((char *)bytes2, sizeof(bytes2));
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
if (true) {
@ -945,9 +945,9 @@ VOID TEST(ProtocolRTMPTest, RecvMessage2)
uint8_t bytes[] = {0x03};
io.in_buffer.append((char *)bytes, sizeof(bytes));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
if (true) {
@ -957,9 +957,9 @@ VOID TEST(ProtocolRTMPTest, RecvMessage2)
uint8_t bytes[] = {0x43, 0, 0, 0, 0, 0, 0, 0};
io.in_buffer.append((char *)bytes, sizeof(bytes));
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
}
@ -1041,9 +1041,9 @@ VOID TEST(ProtocolRTMPTest, RecvMessage4)
io.in_buffer.append(&io.out_buffer);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_EQ(256, p.out_chunk_size);
}
@ -1059,9 +1059,9 @@ VOID TEST(ProtocolRTMPTest, RecvMessage4)
io.in_buffer.append(&io.out_buffer);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_EQ(256, p.in_buffer_length);
}
@ -1430,7 +1430,7 @@ VOID TEST(ProtocolRTMPTest, ServerCommandMessage)
SrsProtocol p(&tio);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsSetWindowAckSizePacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
EXPECT_EQ(1024, pkt->ackowledgement_window_size);
@ -1464,7 +1464,7 @@ VOID TEST(ProtocolRTMPTest, ServerCommandMessage)
HELPER_EXPECT_SUCCESS(p.send_and_free_packet(pkt, 0));
}
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsConnectAppResPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
@ -1499,7 +1499,7 @@ VOID TEST(ProtocolRTMPTest, ServerCommandMessage)
SrsProtocol p(&tio);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
@ -1535,9 +1535,9 @@ VOID TEST(ProtocolRTMPTest, ServerCommandMessage)
SrsProtocol p(&tio);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_EQ(1024, p.in_chunk_size);
}
@ -1569,7 +1569,7 @@ VOID TEST(ProtocolRTMPTest, ServerRedirect)
SrsProtocol p(&tio);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
@ -1636,7 +1636,7 @@ VOID TEST(ProtocolRTMPTest, ServerRedirect)
SrsProtocol p(&tio);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
@ -1882,7 +1882,7 @@ VOID TEST(ProtocolRTMPTest, ServerFMLEStart)
// FCPublish response
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsFMLEStartResPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
srs_freep(msg);
@ -1891,7 +1891,7 @@ VOID TEST(ProtocolRTMPTest, ServerFMLEStart)
// createStream response
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCreateStreamResPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
EXPECT_EQ(1, pkt->stream_id);
@ -1900,7 +1900,7 @@ VOID TEST(ProtocolRTMPTest, ServerFMLEStart)
}
// publish response onFCPublish(NetStream.Publish.Start)
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
srs_freep(msg);
@ -1913,7 +1913,7 @@ VOID TEST(ProtocolRTMPTest, ServerFMLEStart)
tio.in_buffer.append(&io.out_buffer);
// publish response onStatus(NetStream.Publish.Start)
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
srs_freep(msg);
@ -1947,7 +1947,7 @@ VOID TEST(ProtocolRTMPTest, ServerHaivisionPublish)
tio.in_buffer.append(&io.out_buffer);
// publish response onFCPublish(NetStream.Publish.Start)
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
srs_freep(msg);
@ -1960,7 +1960,7 @@ VOID TEST(ProtocolRTMPTest, ServerHaivisionPublish)
tio.in_buffer.append(&io.out_buffer);
// publish response onStatus(NetStream.Publish.Start)
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
srs_freep(msg);
@ -1996,7 +1996,7 @@ VOID TEST(ProtocolRTMPTest, ServerFMLEUnpublish)
// publish response onFCUnpublish(NetStream.unpublish.Success)
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
srs_freep(msg);
@ -2005,7 +2005,7 @@ VOID TEST(ProtocolRTMPTest, ServerFMLEUnpublish)
// FCUnpublish response
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsFMLEStartResPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
srs_freep(msg);
@ -2013,7 +2013,7 @@ VOID TEST(ProtocolRTMPTest, ServerFMLEUnpublish)
}
// publish response onStatus(NetStream.Unpublish.Success)
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
srs_freep(msg);
@ -2039,7 +2039,7 @@ VOID TEST(ProtocolRTMPTest, ServerFlashPublish)
tio.in_buffer.append(&io.out_buffer);
// publish response onStatus(NetStream.Publish.Start)
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
srs_freep(msg);
@ -2119,7 +2119,7 @@ VOID TEST(ProtocolRTMPTest, ServerResponseCommands)
SrsProtocol p(&tio);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
// onStatus(NetStream.Play.Reset)
@ -2152,7 +2152,7 @@ VOID TEST(ProtocolRTMPTest, ServerResponseCommands)
SrsProtocol p(&tio);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
// onStatus(NetStream.Pause.Notify)
@ -2174,7 +2174,7 @@ VOID TEST(ProtocolRTMPTest, ServerResponseCommands)
SrsProtocol p(&tio);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsCallPacket *pkt = NULL;
// onStatus(NetStream.Pause.Notify)
@ -2257,9 +2257,9 @@ VOID TEST(ProtocolRTMPTest, CoverAll)
EXPECT_EQ(0, r.get_recv_bytes());
EXPECT_EQ(0, r.get_send_bytes());
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(r.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsCallPacket *pkt = new SrsCallPacket();
HELPER_EXPECT_SUCCESS(r.send_and_free_packet(pkt, 0));
@ -2281,9 +2281,9 @@ VOID TEST(ProtocolRTMPTest, CoverAll)
EXPECT_EQ(0, r.get_recv_bytes());
EXPECT_EQ(0, r.get_send_bytes());
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(r.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsCallPacket *pkt = new SrsCallPacket();
HELPER_EXPECT_SUCCESS(r.send_and_free_packet(pkt, 0));
@ -2320,7 +2320,7 @@ VOID TEST(ProtocolRTMPTest, CoverAll)
HELPER_ASSERT_SUCCESS(r.send_and_free_packet(ack, 0));
io.in_buffer.append(&io.out_buffer);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsAcknowledgementPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(r.expect_message(&msg, &pkt));
EXPECT_EQ(1024, (int)pkt->sequence_number);
@ -2627,10 +2627,10 @@ VOID TEST(ProtocolRTMPTest, ConnectAppWithArgs)
if (true) {
tio.in_buffer.append(&io.out_buffer);
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
SrsConnectAppPacket *pkt = NULL;
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsConnectAppPacket> pkt_uptr(pkt);
SrsAmf0Any *prop = pkt->command_object->get_property("tcUrl");
@ -2660,9 +2660,9 @@ VOID TEST(ProtocolRTMPTest, AgentMessageCodec)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
}
@ -2677,9 +2677,9 @@ VOID TEST(ProtocolRTMPTest, AgentMessageCodec)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt = NULL;
HELPER_EXPECT_SUCCESS(p.decode_message(msg, &pkt));
@ -2698,9 +2698,9 @@ VOID TEST(ProtocolRTMPTest, AgentMessageCodec)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
}
@ -2715,9 +2715,9 @@ VOID TEST(ProtocolRTMPTest, AgentMessageCodec)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_ASSERT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
SrsRtmpCommand *pkt = NULL;
HELPER_EXPECT_SUCCESS(p.decode_message(msg, &pkt));
@ -2730,8 +2730,8 @@ srs_error_t _mock_packet_to_shared_msg(SrsRtmpCommand *packet, int stream_id, Sr
{
srs_error_t err = srs_success;
SrsCommonMessage *msg = new SrsCommonMessage();
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsRtmpCommonMessage *msg = new SrsRtmpCommonMessage();
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
if ((err = packet->to_msg(msg, stream_id)) != srs_success) {
srs_freep(msg);
@ -2773,16 +2773,16 @@ VOID TEST(ProtocolRTMPTest, CheckStreamID)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_EQ(1, msg->header.stream_id);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
EXPECT_EQ(2, msg->header.stream_id);
}
}
@ -2807,9 +2807,9 @@ VOID TEST(ProtocolRTMPTest, AgentMessageTransform)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
}
@ -2828,9 +2828,9 @@ VOID TEST(ProtocolRTMPTest, AgentMessageTransform)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
}
@ -2849,9 +2849,9 @@ VOID TEST(ProtocolRTMPTest, AgentMessageTransform)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
}
@ -2870,9 +2870,9 @@ VOID TEST(ProtocolRTMPTest, AgentMessageTransform)
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(p.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
}
}
@ -2907,9 +2907,9 @@ VOID TEST(ProtocolRTMPTest, MergeReadHandler)
r.set_merge_read(true, &h);
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(r.recv_message(&msg));
SrsUniquePtr<SrsCommonMessage> msg_uptr(msg);
SrsUniquePtr<SrsRtmpCommonMessage> msg_uptr(msg);
}
EXPECT_TRUE(h.nn > 0);
@ -2926,19 +2926,19 @@ VOID TEST(ProtocolRTMPTest, CreateRTMPMessage)
// Invalid message type.
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(srs_rtmp_create_msg(SrsFrameTypeForbidden, 0, _strcpy("Hello"), 5, 0, &msg));
EXPECT_TRUE(NULL == msg);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_FAILED(srs_rtmp_create_msg(SrsFrameTypeForbidden, 0, _strcpy("Hello"), 5, 0, &msg));
EXPECT_TRUE(NULL == msg);
}
// Normal script message.
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(srs_rtmp_create_msg(SrsFrameTypeScript, 0, _strcpy("Hello"), 5, 0, &msg));
EXPECT_STREQ("Hello", msg->payload());
srs_freep(msg);
@ -2946,7 +2946,7 @@ VOID TEST(ProtocolRTMPTest, CreateRTMPMessage)
// Normal video message.
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(srs_rtmp_create_msg(SrsFrameTypeVideo, 0, _strcpy("Hello"), 5, 0, &msg));
EXPECT_STREQ("Hello", msg->payload());
srs_freep(msg);
@ -2954,13 +2954,13 @@ VOID TEST(ProtocolRTMPTest, CreateRTMPMessage)
// Normal audio message.
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(srs_rtmp_create_msg(SrsFrameTypeAudio, 0, _strcpy("Hello"), 5, 0, &msg));
EXPECT_STREQ("Hello", msg->payload());
srs_freep(msg);
}
if (true) {
SrsCommonMessage *msg = NULL;
SrsRtmpCommonMessage *msg = NULL;
HELPER_EXPECT_SUCCESS(srs_rtmp_create_msg(SrsFrameTypeAudio, 0, _strcpy("Hello"), 5, 0, &msg));
EXPECT_STREQ("Hello", msg->payload());
srs_freep(msg);