Pause playback while transmitting and declare microphone use.
macOS refuses capture without a usage string, and queued remote audio was still handed to the speaker after push-to-talk began. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -360,6 +360,32 @@ func TestRemoteAudioAndTalker(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPlaybackPausesWhenTransmitting(t *testing.T) {
|
||||
in := login(t, "DL1ABC", "key", 20, 7, []string{"OPUS"})
|
||||
enc, err := opus.NewEncoder()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer enc.Close()
|
||||
pkt, err := enc.Encode(make([]int16, opus.FrameSamples))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
in.refl.writeUDP(t, 101, 7, 1, appendBytes(nil, pkt))
|
||||
in.refl.writeUDP(t, 101, 7, 2, appendBytes(nil, pkt))
|
||||
if _, err := in.st.WaitPlayback(t.Context(), 2*opus.FrameSamples-1); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
in.st.HoldButton()
|
||||
in.refl.writeFrame(t, 105, appendStr(appendU32(nil, 20), "DB0XYZ"))
|
||||
if _, err := in.st.Wait(t.Context(), func(s station.State) bool { return s.Transmitting }); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if pcm := in.st.TakePlayback(); len(pcm) != 0 {
|
||||
t.Fatalf("playback %d samples, want none while transmitting", len(pcm))
|
||||
}
|
||||
}
|
||||
|
||||
func TestMicrophoneIsNotPlayed(t *testing.T) {
|
||||
in := login(t, "DL1ABC", "key", 20, 7, []string{"OPUS"})
|
||||
in.st.HoldButton()
|
||||
|
||||
Reference in New Issue
Block a user