Skip to content

Commit

Permalink
av: AudioFrame split range check
Browse files Browse the repository at this point in the history
  • Loading branch information
nareix committed Aug 16, 2016
1 parent 0d5a2fa commit 37be18a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions av/av.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ func (self AudioFrame) HasSameFormat(other AudioFrame) bool {

// Split sample audio sample from this frame.
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.Data = append([][]byte(nil), out.Data...)
out.SampleCount = end - start
Expand Down

0 comments on commit 37be18a

Please sign in to comment.