1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

SrsPacket supports converting to message, so can be sent by one API.

This commit is contained in:
winlin 2019-12-12 15:11:31 +08:00
parent 82c4f41975
commit 2731fe1f3e
7 changed files with 472 additions and 70 deletions

View file

@ -115,6 +115,9 @@ class SrsPacket
public:
SrsPacket();
virtual ~SrsPacket();
public:
// Covert packet to common message.
virtual srs_error_t to_msg(SrsCommonMessage* msg, int stream_id);
public:
// The subpacket can override this encode,
// For example, video and audio will directly set the payload withou memory copy,
@ -356,9 +359,6 @@ private:
virtual srs_error_t do_iovs_send(iovec* iovs, int size);
// The underlayer api for send and free packet.
virtual srs_error_t do_send_and_free_packet(SrsPacket* packet, int stream_id);
// Use simple algorithm to send the header and bytes.
// @remark, for do_send_and_free_packet to send.
virtual srs_error_t do_simple_send(SrsMessageHeader* mh, char* payload, int size);
// The imp for decode_message
virtual srs_error_t do_decode_message(SrsMessageHeader& header, SrsBuffer* stream, SrsPacket** ppacket);
// Recv bytes oriented RTMP message from protocol stack.