From 57758f3f204beabf3d22931a148b6527ab1fad86 Mon Sep 17 00:00:00 2001 From: yhding Date: Wed, 26 Sep 2018 10:51:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=8C=85=E5=AE=8C=E5=8F=8A=E6=97=B6?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E9=81=BF=E5=85=8D=E5=8C=85=E5=B0=BE=E9=83=A8?= =?UTF-8?q?=E4=B8=80=E5=B0=8F=E6=AE=B5=E6=95=B0=E6=8D=AE=E6=9C=AA=E5=8F=91?= =?UTF-8?q?=E9=80=81=E8=80=8C=E5=BC=95=E8=B5=B7=E6=8E=A5=E6=94=B6=E7=AB=AF?= =?UTF-8?q?=E5=BB=B6=E8=BF=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocol/rtmp/core/conn_client.go | 4 ++++ protocol/rtmp/core/conn_server.go | 4 ++++ protocol/rtmp/rtmp.go | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/protocol/rtmp/core/conn_client.go b/protocol/rtmp/core/conn_client.go index 4016de0f..987a72ff 100755 --- a/protocol/rtmp/core/conn_client.go +++ b/protocol/rtmp/core/conn_client.go @@ -307,6 +307,10 @@ func (connClient *ConnClient) Write(c ChunkStream) error { return connClient.conn.Write(&c) } +func (connClient *ConnClient) Flush() error { + return connClient.conn.Flush() +} + func (connClient *ConnClient) Read(c *ChunkStream) (err error) { return connClient.conn.Read(c) } diff --git a/protocol/rtmp/core/conn_server.go b/protocol/rtmp/core/conn_server.go index 5858f5fa..e85b7d87 100755 --- a/protocol/rtmp/core/conn_server.go +++ b/protocol/rtmp/core/conn_server.go @@ -337,6 +337,10 @@ func (connServer *ConnServer) Write(c ChunkStream) error { return connServer.conn.Write(&c) } +func (connServer *ConnServer) Flush() error { + return connServer.conn.Flush() +} + func (connServer *ConnServer) Read(c *ChunkStream) (err error) { return connServer.conn.Read(c) } diff --git a/protocol/rtmp/rtmp.go b/protocol/rtmp/rtmp.go index ea3722ee..1a760174 100755 --- a/protocol/rtmp/rtmp.go +++ b/protocol/rtmp/rtmp.go @@ -284,6 +284,7 @@ func (v *VirWriter) Write(p *av.Packet) (err error) { } func (v *VirWriter) SendPacket() error { + Flush := reflect.ValueOf(v.conn).MethodByName("Flush"); var cs core.ChunkStream for { p, ok := <-v.packetQueue @@ -312,7 +313,7 @@ func (v *VirWriter) SendPacket() error { v.closed = true return err } - + Flush.Call(nil); } else { return errors.New("closed") }