mirror of https://bitbucket.org/ausocean/av.git
Session.Write() now checks len(data) before the FLV test.
This commit is contained in:
parent
5be5aad6cf
commit
fc815c23e7
|
@ -152,7 +152,7 @@ func (s *Session) Open() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close terminates the rtmp connection.
|
// Close terminates the rtmp connection.
|
||||||
// NB: The session object is cleared completely.
|
// NB: Close is idempotent and the session value is cleared completely.
|
||||||
func (s *Session) Close() error {
|
func (s *Session) Close() error {
|
||||||
s.log(DebugLevel, pkg+"Session.Close")
|
s.log(DebugLevel, pkg+"Session.Close")
|
||||||
if !s.isConnected() {
|
if !s.isConnected() {
|
||||||
|
@ -174,12 +174,12 @@ func (s *Session) Write(data []byte) (int, error) {
|
||||||
if !s.isConnected() {
|
if !s.isConnected() {
|
||||||
return 0, errNotConnected
|
return 0, errNotConnected
|
||||||
}
|
}
|
||||||
if data[0] == packetTypeInfo || (data[0] == 'F' && data[1] == 'L' && data[2] == 'V') {
|
|
||||||
return 0, errUnimplemented
|
|
||||||
}
|
|
||||||
if len(data) < minDataSize {
|
if len(data) < minDataSize {
|
||||||
return 0, errTinyPacket
|
return 0, errTinyPacket
|
||||||
}
|
}
|
||||||
|
if data[0] == packetTypeInfo || (data[0] == 'F' && data[1] == 'L' && data[2] == 'V') {
|
||||||
|
return 0, errUnimplemented
|
||||||
|
}
|
||||||
|
|
||||||
pkt := packet{
|
pkt := packet{
|
||||||
packetType: data[0],
|
packetType: data[0],
|
||||||
|
|
Loading…
Reference in New Issue