av: AudioFrame split range check

This commit is contained in:
nareix 2016-08-16 15:33:22 +08:00
parent 0d5a2fa0f0
commit 37be18afca

View File

@ -264,6 +264,9 @@ func (self AudioFrame) HasSameFormat(other AudioFrame) bool {
// Split sample audio sample from this frame. // Split sample audio sample from this frame.
func (self AudioFrame) Slice(start int, end int) (out AudioFrame) { func (self AudioFrame) Slice(start int, end int) (out AudioFrame) {
if start > end {
panic(fmt.Sprintf("av: AudioFrame split failed start=%d end=%d invalid", start, end))
}
out = self out = self
out.Data = append([][]byte(nil), out.Data...) out.Data = append([][]byte(nil), out.Data...)
out.SampleCount = end - start out.SampleCount = end - start