Resolves #694. Address null pointer when no system audio devices are available. (#695)

Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
Denny Sheirer
2020-03-23 08:45:06 +00:00
committed by GitHub
parent 692ffabe82
commit 41df207bb9
3 changed files with 42 additions and 14 deletions

View File

@@ -81,6 +81,9 @@ public class AudioPlaybackManager implements Listener<AudioSegment>, IAudioContr
MyEventBus.getEventBus().register(this);
MixerChannelConfiguration configuration = mUserPreferences.getPlaybackPreference().getMixerChannelConfiguration();
if(configuration != null)
{
try
{
setMixerChannelConfiguration(configuration);
@@ -92,6 +95,11 @@ public class AudioPlaybackManager implements Listener<AudioSegment>, IAudioContr
(configuration != null ? configuration.getMixerChannel().name() : "null") + "]", ae);
}
}
else
{
mLog.warn("No audio output devices available");
}
}
/**
* Receives audio segments from channel audio modules.

View File

@@ -350,6 +350,8 @@ public class PlaybackPreference extends Preference
{
MixerChannelConfiguration defaultConfig = MixerManager.getDefaultOutputMixer();
if(defaultConfig != null)
{
String configName = mPreferences.get(PREFERENCE_KEY_MIXER_CHANNEL_CONFIG, defaultConfig.toString());
for(MixerChannelConfiguration config: MixerManager.getOutputMixers())
@@ -365,6 +367,11 @@ public class PlaybackPreference extends Preference
mMixerChannelConfiguration = defaultConfig;
}
}
else
{
mLog.error("Error - no system audio devices available");
}
}
return mMixerChannelConfiguration;
}

View File

@@ -105,6 +105,19 @@ public class AudioRecordingManager implements Listener<AudioSegment>
*/
public void processCompletedAudioSegment(AudioSegment audioSegment)
{
//Debug
if(audioSegment.getAudioBufferCount() == 0)
{
mLog.debug("Audio Segment detected with 0 audio buffers");
}
List<Identifier> toIdentifiers = audioSegment.getIdentifierCollection().getIdentifiers(Role.TO);
if(toIdentifiers.isEmpty())
{
mLog.debug("Audio Segment detected with NO TO identifiers");
}
if(audioSegment.recordAudioProperty().get())
{
mCompletedAudioSegmentQueue.add(audioSegment);