Browse Source

support amf0 types undefined, unsupported, xmldocument and date

pull/3189/head
pedro 2 years ago
parent
commit
27ac4985ce
  1. 14
      internal/protocols/rtmp/amf0/unmarshal.go

14
internal/protocols/rtmp/amf0/unmarshal.go

@ -180,7 +180,7 @@ func unmarshal(buf []byte) (interface{}, []byte, error) { @@ -180,7 +180,7 @@ func unmarshal(buf []byte) (interface{}, []byte, error) {
return out, buf[1:], nil
case markerNull:
case markerNull, markerUnsupported, markerUndefined:
return nil, buf, nil
case markerStrictArray:
@ -200,7 +200,7 @@ func unmarshal(buf []byte) (interface{}, []byte, error) { @@ -200,7 +200,7 @@ func unmarshal(buf []byte) (interface{}, []byte, error) {
}
return nil, buf, nil
case markerLongString:
case markerLongString, markerXMLDocument:
if len(buf) < 4 {
return nil, nil, errBufferTooShort
}
@ -212,6 +212,16 @@ func unmarshal(buf []byte) (interface{}, []byte, error) { @@ -212,6 +212,16 @@ func unmarshal(buf []byte) (interface{}, []byte, error) {
return string(buf[:keyLen]), buf[keyLen:], nil
case markerDate:
if len(buf) < 10 {
return nil, nil, errBufferTooShort
}
date := math.Float64frombits(uint64(buf[0])<<56 | uint64(buf[1])<<48 | uint64(buf[2])<<40 | uint64(buf[3])<<32 |
uint64(buf[4])<<24 | uint64(buf[5])<<16 | uint64(buf[6])<<8 | uint64(buf[7]))
buf = buf[8:]
//timeZone := uint16(buf[0])<<8 | uint16(buf[1])
buf = buf[2:] // skip timeZone
return date, buf, nil
default:
return nil, nil, fmt.Errorf("unsupported marker 0x%.2x", marker)
}

Loading…
Cancel
Save