diff --git a/audio/vorbis/vorbis.go b/audio/vorbis/vorbis.go index a115999c7..a8d4caa6f 100644 --- a/audio/vorbis/vorbis.go +++ b/audio/vorbis/vorbis.go @@ -44,6 +44,8 @@ func (s *Stream) Seek(offset int64, whence int) (int64, error) { } // Length returns the size of decoded stream in bytes. +// +// If the source is not io.Seeker, Length returns 0. func (s *Stream) Length() int64 { return s.size } diff --git a/audio/vorbis/vorbis_test.go b/audio/vorbis/vorbis_test.go index ca3881962..fe0632486 100644 --- a/audio/vorbis/vorbis_test.go +++ b/audio/vorbis/vorbis_test.go @@ -83,5 +83,10 @@ func TestNonSeeker(t *testing.T) { if err != nil { t.Fatal(err) } - _ = s + + got := s.Length() + want := int64(0) + if got != want { + t.Errorf("s.Length(): got: %d, want: %d", got, want) + } }