Skip to content

Commit 4df19ba

Browse files
committed
for #405, improve the http flv to 3k. 2.0.170
1 parent 8a9dbae commit 4df19ba

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ The play HTTP FLV benchmark by [SB](https://github.com/simple-rtmp-server/srs-be
718718
| 2014-05-24 | 2.0.167 | 1.0k(1000) | players | 82% | 86MB | - |
719719
| 2014-05-24 | 2.0.168 | 2.3k(2300) | players | 92% | 276MB | [code][p17] |
720720
| 2014-05-24 | 2.0.169 | 3.0k(3000) | players | 94% | 188MB | [code][p18] |
721+
| 2014-05-24 | 2.0.170 | 3.0k(3000) | players | 89% | 96MB | [code][p19] |
721722

722723
### Latency benchmark
723724

trunk/src/app/srs_app_http_conn.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,14 @@ SrsHttpResponseWriter::SrsHttpResponseWriter(SrsStSocket* io)
6666
content_length = -1;
6767
written = 0;
6868
header_sent = false;
69+
nb_iovss_cache = 0;
70+
iovss_cache = NULL;
6971
}
7072

7173
SrsHttpResponseWriter::~SrsHttpResponseWriter()
7274
{
7375
srs_freep(hdr);
76+
srs_freep(iovss_cache);
7477
}
7578

7679
int SrsHttpResponseWriter::final_request()
@@ -173,8 +176,12 @@ int SrsHttpResponseWriter::writev(iovec* iov, int iovcnt, ssize_t* pnwrite)
173176

174177
// send in chunked encoding.
175178
int nb_iovss = iovcnt * 4;
176-
iovec* iovss = new iovec[nb_iovss];
177-
SrsAutoFree(iovec, iovss);
179+
iovec* iovss = iovss_cache;
180+
if (nb_iovss_cache < nb_iovss) {
181+
srs_freep(iovss_cache);
182+
nb_iovss_cache = nb_iovss;
183+
iovss = iovss_cache = new iovec[nb_iovss];
184+
}
178185

179186
char* pheader_cache = header_cache;
180187
for (int i = 0; i < iovcnt; i++) {

trunk/src/app/srs_app_http_conn.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ class SrsHttpResponseWriter : public ISrsHttpResponseWriter
8585
private:
8686
SrsStSocket* skt;
8787
SrsHttpHeader* hdr;
88+
private:
8889
char header_cache[SRS_HTTP_HEADER_CACHE_SIZE];
90+
iovec* iovss_cache;
91+
int nb_iovss_cache;
8992
private:
9093
// reply header has been (logically) written
9194
bool header_wrote;

trunk/src/core/srs_core.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3131
// current release version
3232
#define VERSION_MAJOR 2
3333
#define VERSION_MINOR 0
34-
#define VERSION_REVISION 169
34+
#define VERSION_REVISION 170
3535

3636
// server info.
3737
#define RTMP_SIG_SRS_KEY "SRS"

0 commit comments

Comments
 (0)