Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions device/dualsense/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ func (d *DualSense) handleHapticsAudioOut(out []byte) {
}

processed, release := d.speakerAudioFeature.applyPCM(out, USBHapticsAudioChannels)
atomicAudioHapticsFunc := d.atomicAudioHapticsFunc
reports := d.consumeDualSenseV5AudioLocked(processed, receivedAt)
// The callback is deliberately completed under the device lock. This makes
// an alternate-setting or endpoint reset a hard generation barrier: once the
Expand All @@ -490,7 +489,7 @@ func (d *DualSense) handleHapticsAudioOut(out []byte) {

d.mtx.Lock()
outputFunc := d.outputFunc
atomicAudioHapticsFunc = d.atomicAudioHapticsFunc
atomicAudioHapticsFunc := d.atomicAudioHapticsFunc
if outputFunc != nil || atomicAudioHapticsFunc != nil {
feedback := pending.feedback
d.mtx.Unlock()
Expand Down
3 changes: 1 addition & 2 deletions device/dualsense/native_audio_v5.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func appendDualSenseV5Speaker(dst, src []byte) []byte {

// copyDualSenseV5SpeakerChannels copies the front stereo pair from the native
// four-channel USB endpoint. Rear channels remain on the haptics clock.
func copyDualSenseV5SpeakerChannels(dst, src []byte) int {
func copyDualSenseV5SpeakerChannels(dst, src []byte) {
frames := min(len(src)/USBHapticsAudioFrameSize,
len(dst)/dualSenseV5SpeakerFrameSize)
for frame := 0; frame < frames; frame++ {
Expand All @@ -35,5 +35,4 @@ func copyDualSenseV5SpeakerChannels(dst, src []byte) int {
copy(dst[destination:destination+dualSenseV5SpeakerFrameSize],
src[source:source+dualSenseV5SpeakerFrameSize])
}
return frames * dualSenseV5SpeakerFrameSize
}
6 changes: 0 additions & 6 deletions device/dualsense/output_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,6 @@ func (c *deadlineTrackingConn) Close() error {
return err
}

func (c *deadlineTrackingConn) writeDeadlines() []time.Time {
c.deadlineLock.Lock()
defer c.deadlineLock.Unlock()
return append([]time.Time(nil), c.deadlines...)
}

func TestDualSenseV5WriterWriteFailureCannotRaceFinalDrain(t *testing.T) {
server, client := net.Pipe()
conn := &writeStartedConn{Conn: server, started: make(chan struct{})}
Expand Down
Loading