Skip to content

Commit

Permalink
#1506 Resolves issue of tuner freezing due to cancelled USB transfer …
Browse files Browse the repository at this point in the history
…buffers not being resubmitted.
  • Loading branch information
Dennis Sheirer committed Apr 10, 2023
1 parent fa0b047 commit f23db3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,6 @@ private void playAudio(ByteBuffer buffer)
mOutputLastTimestamp = System.currentTimeMillis();
}
}
else
{
mLog.error("Audio buffer was null ... couldn't play it");
}
}

/**
Expand Down Expand Up @@ -655,7 +651,7 @@ public void run()
{
try
{
//Debug hooks
//TODO: Debug hooks - remove after testing
if(mMixerChannel.name().equals("LEFT"))
{
int a = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,23 +699,21 @@ public void processTransfer(Transfer transfer)
case LibUsb.TRANSFER_STALL:
case LibUsb.TRANSFER_TIMED_OUT:
case LibUsb.TRANSFER_ERROR:
case LibUsb.TRANSFER_CANCELLED:
int transferLength = transfer.actualLength();

if(transferLength > 0)
{
dispatchTransfer(transfer);
transfer.buffer().rewind();
}

transfer.buffer().rewind();

if(mAutoResubmitTransfers)
{
submitTransfer(transfer);
}
break;
case LibUsb.TRANSFER_CANCELLED:
//Reset the transfer but don't do anything else since we're shutting down
transfer.buffer().rewind();
break;
default:
//Unexpected transfer error - shutdown the tuner
transfer.buffer().rewind();
Expand Down

0 comments on commit f23db3c

Please sign in to comment.