winlin

add shared ptr message

... ... @@ -61,4 +61,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
} \
(void)0
// server info.
#define RTMP_SIG_SRS_NAME "srs(simple rtmp server)"
#define RTMP_SIG_SRS_URL "https://github.com/winlinvip/simple-rtmp-server"
#define RTMP_SIG_SRS_VERSION "0.1"
#endif
\ No newline at end of file
... ...
... ... @@ -238,7 +238,7 @@ int SrsClient::streaming_publish(SrsSource* source)
SrsPacket* pkt = msg->get_packet();
if (dynamic_cast<SrsOnMetaDataPacket*>(pkt)) {
SrsOnMetaDataPacket* metadata = dynamic_cast<SrsOnMetaDataPacket*>(pkt);
if ((ret = source->on_meta_data(metadata)) != ERROR_SUCCESS) {
if ((ret = source->on_meta_data(msg, metadata)) != ERROR_SUCCESS) {
srs_error("process onMetaData message failed. ret=%d", ret);
return ret;
}
... ...
... ... @@ -1089,6 +1089,14 @@ int SrsMessage::encode_packet()
return packet->encode(size, (char*&)payload);
}
SrsSharedMessage::SrsSharedMessage()
{
}
SrsSharedMessage::~SrsSharedMessage()
{
}
SrsPacket::SrsPacket()
{
}
... ...
... ... @@ -285,6 +285,17 @@ public:
};
/**
* shared ptr message.
* for audio/video/data message that need less memory copy.
*/
class SrsSharedMessage : public SrsMessage
{
public:
SrsSharedMessage();
virtual ~SrsSharedMessage();
};
/**
* the decoded message payload.
*/
class SrsPacket
... ...
... ... @@ -35,11 +35,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define RTMP_SIG_FMS_VER "3,5,3,888"
#define RTMP_SIG_AMF0_VER 0
#define RTMP_SIG_SRS_NAME "srs(simple rtmp server)"
#define RTMP_SIG_SRS_URL "https://github.com/winlinvip/simple-rtmp-server"
#define RTMP_SIG_SRS_VERSION "0.1"
#define RTMP_SIG_CLIENT_ID "ASAICiss"
/**
* onStatus consts.
*/
#define StatusLevel "level"
#define StatusCode "code"
#define StatusDescription "description"
... ...
... ... @@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_log.hpp>
#include <srs_core_protocol.hpp>
#include <srs_core_amf0.hpp>
std::map<std::string, SrsSource*> SrsSource::pool;
... ... @@ -64,9 +65,13 @@ SrsSource::~SrsSource()
{
}
int SrsSource::on_meta_data(SrsOnMetaDataPacket* metadata)
int SrsSource::on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata)
{
int ret = ERROR_SUCCESS;
metadata->metadata->set("server",
new SrsAmf0String(RTMP_SIG_SRS_NAME""RTMP_SIG_SRS_VERSION));
return ret;
}
... ...
... ... @@ -75,7 +75,7 @@ public:
SrsSource(std::string _stream_url);
virtual ~SrsSource();
public:
virtual int on_meta_data(SrsOnMetaDataPacket* metadata);
virtual int on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata);
virtual int on_audio(SrsMessage* audio);
virtual int on_video(SrsMessage* video);
public:
... ...