From 420a6c16deed7d7abcf8f8d58f3b8b9454259858 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 15 Jul 2024 13:52:50 +0900 Subject: [PATCH] Revert "audio: bug fix: crash with uncomparable source" This reverts commit e980d5919178f0d2cf5b83636f0b425ac40b604a. Reason: Compile error with Go 1.19 --- audio/audio.go | 7 +------ audio/audio_test.go | 29 ----------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/audio/audio.go b/audio/audio.go index 1e29faf12..ba8c5f2ba 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -37,7 +37,6 @@ import ( "errors" "fmt" "io" - "reflect" "runtime" "sync" "time" @@ -189,15 +188,11 @@ func (c *Context) addPlayingPlayer(p *playerImpl) { defer c.m.Unlock() c.playingPlayers[p] = struct{}{} - if !reflect.ValueOf(p.sourceIdent()).Comparable() { - return - } - // Check the source duplication srcs := map[any]struct{}{} for p := range c.playingPlayers { if _, ok := srcs[p.sourceIdent()]; ok { - c.err = errors.New("audio: the same source must not be used by multiple Player objects") + c.err = errors.New("audio: a same source is used by multiple Player") return } srcs[p.sourceIdent()] = struct{}{} diff --git a/audio/audio_test.go b/audio/audio_test.go index 7ce175fb9..6aa0c95a3 100644 --- a/audio/audio_test.go +++ b/audio/audio_test.go @@ -16,7 +16,6 @@ package audio_test import ( "bytes" - "io" "os" "runtime" "testing" @@ -148,32 +147,4 @@ func TestNonSeekableSource(t *testing.T) { p.Play() p.Pause() - - if err := audio.UpdateForTesting(); err != nil { - t.Error(err) - } -} - -type uncomparableSource []int - -func (uncomparableSource) Read(buf []byte) (int, error) { - return 0, io.EOF -} - -// Issue #3039 -func TestUncomparableSource(t *testing.T) { - setup() - defer teardown() - - p, err := context.NewPlayer(uncomparableSource{}) - if err != nil { - t.Fatal(err) - } - - p.Play() - p.Pause() - - if err := audio.UpdateForTesting(); err != nil { - t.Error(err) - } }