From 6a64a5ec875d8dfd2898e2a6ee9e1e3d9943e19e Mon Sep 17 00:00:00 2001 From: nareix Date: Thu, 23 Jun 2016 16:54:55 +0800 Subject: [PATCH] fix stringmarkder bug --- flvio/amf0.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flvio/amf0.go b/flvio/amf0.go index f2427f3..bb83ded 100644 --- a/flvio/amf0.go +++ b/flvio/amf0.go @@ -86,7 +86,7 @@ func WriteAMF0Val(w *pio.Writer, _val interface{}) (err error) { case string: u := len(val) - if u > 65536 { + if u <= 65536 { if err = w.WriteU8(stringmarker); err != nil { return } @@ -122,7 +122,7 @@ func WriteAMF0Val(w *pio.Writer, _val interface{}) (err error) { } } } - if err = w.WriteU16BE(0); err != nil { + if err = w.WriteU24BE(0x000009); err != nil { return } @@ -230,6 +230,9 @@ func ReadAMF0Val(r *pio.Reader) (val interface{}, err error) { } obj[okey] = oval } + if _, err = r.ReadU8(); err != nil { + return + } val = obj case nullmarker: @@ -257,6 +260,9 @@ func ReadAMF0Val(r *pio.Reader) (val interface{}, err error) { } obj[okey] = oval } + if _, err = r.ReadU8(); err != nil { + return + } val = obj case objectendmarker: