#652 USB Tuner Error Handling Enhancements (#653)

-Separates USB timeout event processing to a dedicated thread
-Updates USB transfer buffer processor to better detect errors and auto-restart on error (max 3 times)
-Updates Tuner to add an error state and SourceManager to not select tuners with an error state
-Updates ChannelProcessingManager to auto-shutdown channels sourced from tuners set with error state
-Improves logging of USB related errors.
This commit is contained in:
Denny Sheirer
2020-02-09 05:40:04 -05:00
committed by GitHub
parent 2e942113c6
commit 2d71f5173a
22 changed files with 799 additions and 357 deletions

View File

@@ -1,7 +1,7 @@
/*
*
* * ******************************************************************************
* * Copyright (C) 2014-2019 Dennis Sheirer
* * Copyright (C) 2014-2020 Dennis Sheirer
* *
* * This program is free software: you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
import java.util.SortedSet;
public abstract class TunerController implements Tunable, ISourceEventProcessor, ISourceEventListener,
IReusableComplexBufferProvider, Listener<ReusableComplexBuffer>
IReusableComplexBufferProvider, Listener<ReusableComplexBuffer>, ITunerErrorListener
{
private final static Logger mLog = LoggerFactory.getLogger(TunerController.class);
protected ReusableBufferBroadcaster mReusableBufferBroadcaster = new ReusableBufferBroadcaster();
@@ -52,6 +52,7 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
private Listener<SourceEvent> mSourceEventListener;
private int mMeasuredFrequencyError;
private ComplexBufferWaveRecorder mRecorder;
private ITunerErrorListener mTunerErrorListener;
/**
* Abstract tuner controller class. The tuner controller manages frequency bandwidth and currently tuned channels
@@ -77,6 +78,24 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
*/
public abstract void dispose();
@Override
public void setErrorMessage(String errorMessage)
{
if(mTunerErrorListener != null)
{
mTunerErrorListener.setErrorMessage(errorMessage);
}
}
/**
* Sets the listener for tuner error messages that originate outside of the tuner. This is normally the enclosing
* tuner so that it can receive error signals from the USB processor(s)..
*/
public void setTunerErrorListener(ITunerErrorListener tunerErrorListener)
{
mTunerErrorListener = tunerErrorListener;
}
/**
* Number of samples contained in each complex buffer provided by this tuner.
*