fix: mp4 unkown box

This commit is contained in:
langhuihui
2025-03-14 17:16:53 +08:00
parent 551eac055d
commit d5187b56d6
+2 -2
View File
@@ -2,7 +2,6 @@ package box
import (
"encoding/binary"
"fmt"
"io"
"net"
"reflect"
@@ -191,7 +190,8 @@ func ReadFrom(r io.Reader) (box IBox, err error) {
baseBox.typ = BoxType(tmp[4:])
t, exists := registry[baseBox.typ.Uint32I()]
if !exists {
return nil, fmt.Errorf("unknown box type: %s", baseBox.typ)
io.CopyN(io.Discard, r, int64(baseBox.size-BasicBoxLen))
return &baseBox, nil
}
b := reflect.New(t.Elem()).Interface().(IBox)
var payload []byte