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

fix #405, improve the HTTP FLV performance to 6k. 2.0.171

This commit is contained in:
winlin 2015-05-25 01:02:06 +08:00
parent 4df19ba99a
commit d12fc7fcc5
13 changed files with 1193 additions and 922 deletions

View file

@ -71,11 +71,9 @@ class SrsHttpMessage;
#ifdef SRS_AUTO_HTTP_PARSER
// for HTTP FLV, each video/audio packet is send by 3 iovs,
// while each iov is send by 4 sub iovs, that is needs 3 chunk header,
// suppose each header is 16 length, 3*16=48 is ok.
// that is, 512 can used for 16 iovs to send.
#define SRS_HTTP_HEADER_CACHE_SIZE 512
// the http chunked header size,
// for writev, there always one chunk to send it.
#define SRS_HTTP_HEADER_CACHE_SIZE 64
/**
* response writer use st socket
@ -214,8 +212,8 @@ public:
* set the original messages, then update the message.
*/
virtual int update(std::string url, http_parser* header,
SrsFastBuffer* body, std::vector<SrsHttpHeaderField>& headers
);
SrsFastBuffer* body, std::vector<SrsHttpHeaderField>& headers
);
private:
virtual SrsConnection* connection();
public:
@ -454,7 +452,7 @@ public:
*/
class SrsFlvStreamEncoder : public ISrsStreamEncoder
{
private:
protected:
SrsFlvEncoder* enc;
public:
SrsFlvStreamEncoder();
@ -469,6 +467,24 @@ public:
virtual int dump_cache(SrsConsumer* consumer);
};
#ifdef SRS_PERF_FAST_FLV_ENCODER
/**
* the fast flv stream encoder.
* @see https://github.com/simple-rtmp-server/srs/issues/405
*/
class SrsFastFlvStreamEncoder : public SrsFlvStreamEncoder
{
public:
SrsFastFlvStreamEncoder();
virtual ~SrsFastFlvStreamEncoder();
public:
/**
* write the tags in a time.
*/
virtual int write_tags(SrsSharedPtrMessage** msgs, int count);
};
#endif
/**
* the ts stream encoder, remux rtmp stream to ts stream.
*/