Unified · Split
| @@ -324,7 +324,7 @@ err: · 323 unmodified lines | ||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | static int |
| 327 | −rtmpsend(RTMP *r) | |
| 327 | +rtmpsend(RTMP *r, int flush) | |
| 328 | 328 | { |
| 329 | 329 | u8int *p, *h, *e, hdata[24]; |
| 330 | 330 | int len, n, hsz; |
| @@ -368,7 +368,7 @@ rtmpsend(RTMP *r) · 37 unmodified lines | ||
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | − if(Bflush(r) < 0) | |
| 371 | + if(flush && Bflush(r) < 0) | |
| 372 | 372 | goto err; |
| 373 | 373 | |
| 374 | 374 | if(debug){ |
| @@ -412,7 +412,7 @@ pong(RTMP *r, s32int n) · 37 unmodified lines | ||
| 412 | 412 | puti16(CtlPingResponse); |
| 413 | 413 | puti32(n); |
| 414 | 414 | |
| 415 | − return rtmpsend(r); | |
| 415 | + return rtmpsend(r, 1); | |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | static int |
| @@ -422,7 +422,7 @@ setchunksz(RTMP *r, int sz) · 3 unmodified lines | ||
| 422 | 422 | |
| 423 | 423 | newmsg(r, SetChunkSize, Type0, CSUserCtl); |
| 424 | 424 | puti32(sz); |
| 425 | − n = rtmpsend(r); | |
| 425 | + n = rtmpsend(r, 1); | |
| 426 | 426 | r->chunkout = sz; |
| 427 | 427 | |
| 428 | 428 | return n; |
| @@ -676,7 +676,7 @@ rtmpstream(RTMP *r, ulong *sid) · 247 unmodified lines | ||
| 676 | 676 | |
| 677 | 677 | r->o.msg.cmd.cb = streamcreated; |
| 678 | 678 | r->o.msg.cmd.aux = c; |
| 679 | − n = rtmpsend(r); | |
| 679 | + n = rtmpsend(r, 1); | |
| 680 | 680 | |
| 681 | 681 | qunlock(r); |
| 682 | 682 | |
| @@ -732,7 +732,7 @@ rtmppublish(RTMP *r, ulong sid, int type, char *name) · 49 unmodified lines | ||
| 732 | 732 | r->o.msg.cmd.aux = c; |
| 733 | 733 | r->o.msg.cmd.code = "NetStream.Publish.Start"; |
| 734 | 734 | r->o.msg.sid = sid; |
| 735 | − n = rtmpsend(r); | |
| 735 | + n = rtmpsend(r, 1); | |
| 736 | 736 | |
| 737 | 737 | qunlock(r); |
| 738 | 738 | |
| @@ -777,7 +777,7 @@ rtmpmeta(RTMP *r, ulong sid, int vcodec, int w, int h, int acodec) · 38 unmodified lines | ||
| 777 | 777 | putend(); |
| 778 | 778 | r->o.msg.sid = sid; |
| 779 | 779 | |
| 780 | − res = rtmpsend(r); | |
| 780 | + res = rtmpsend(r, 1); | |
| 781 | 781 | |
| 782 | 782 | qunlock(r); |
| 783 | 783 | |
| @@ -872,7 +872,7 @@ h264data(RTMP *r, ulong sid, u32int ts, u8int *p, int sz) · 88 unmodified lines | ||
| 872 | 872 | |
| 873 | 873 | putdata(ps, p-ps); |
| 874 | 874 | |
| 875 | − if(rtmpsend(r) < 0) | |
| 875 | + if(rtmpsend(r, 0) < 0) | |
| 876 | 876 | return -1; |
| 877 | 877 | |
| 878 | 878 | r->sps = 1; |
| @@ -898,7 +898,7 @@ h264data(RTMP *r, ulong sid, u32int ts, u8int *p, int sz) · 19 unmodified lines | ||
| 898 | 898 | putdata(p, nsz); |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | − return rtmpsend(r); | |
| 901 | + return rtmpsend(r, 0); | |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | static int |
| @@ -944,7 +944,7 @@ aacdata(RTMP *r, ulong sid, u32int ts, u8int *p, int sz) · 39 unmodified lines | ||
| 944 | 944 | putbyte(0xe5); |
| 945 | 945 | putbyte(0x00); |
| 946 | 946 | |
| 947 | − if(rtmpsend(r) < 0) | |
| 947 | + if(rtmpsend(r, 0) < 0) | |
| 948 | 948 | return -1; |
| 949 | 949 | |
| 950 | 950 | r->aacpd = 1; |
| @@ -961,7 +961,7 @@ aacdata(RTMP *r, ulong sid, u32int ts, u8int *p, int sz) · 10 unmodified lines | ||
| 961 | 961 | |
| 962 | 962 | putdata(p+7, sz-7); |
| 963 | 963 | |
| 964 | − return rtmpsend(r); | |
| 964 | + return rtmpsend(r, 0); | |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | int |
| @@ -1011,7 +1011,7 @@ connect(RTMP *r) · 43 unmodified lines | ||
| 1011 | 1011 | putkvnum("objectEncoding", 0); /* AMF0 */ |
| 1012 | 1012 | putend(); |
| 1013 | 1013 | |
| 1014 | − return rtmpsend(r); | |
| 1014 | + return rtmpsend(r, 1); | |
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | static int |