MCPcopy Create free account
hub / github.com/Monibuca/engine / SnapForJson

Method SnapForJson

track/media.go:134–147  ·  view source on GitHub ↗

为json序列化而计算的数据

()

Source from the content-addressed store, hash-verified

132
133// 为json序列化而计算的数据
134func (av *Media) SnapForJson() {
135 v := av.LastValue
136 if av.RawPart != nil {
137 av.RawPart = av.RawPart[:0]
138 } else {
139 av.RawPart = make([]int, 0, 10)
140 }
141 if av.RawSize = v.AUList.ByteLength; av.RawSize > 0 {
142 r := v.AUList.NewReader()
143 for b, err := r.ReadByte(); err == nil && len(av.RawPart) < 10; b, err = r.ReadByte() {
144 av.RawPart = append(av.RawPart, int(b))
145 }
146 }
147}
148
149func (av *Media) SetSpeedLimit(value time.Duration) {
150 av.等待上限 = value

Callers

nothing calls this directly

Calls 2

ReadByteMethod · 0.65
NewReaderMethod · 0.45

Tested by

no test coverage detected