Buggy code:
public class AudioHandler extends JumbleNetworkListener implements AudioInput . AudioInputListener { public static final int SAMPLE_RATE = 48000 ; public static final int FRAME_SIZE = ( AudioHandler . SAMPLE_RATE ) // 100 ; private Context mContext ; private JumbleLogger mLogger ; private AudioManager mAudioManager ; private AudioInput mInput ; private AudioOutput mOutput ; private AudioOutputListener mOutputListener ; private AudioHandler . AudioEncodeListener mEncodeListener ; private JumbleUDPMessageType mCodec ; private IEncoder mEncoder ; private int mFrameCounter ; private int mAudioStream ; private int mAudioSource ; private int mSampleRate ; private int mBitrate ; private int mFramesPerPacket ; private int mTransmitMode ; private float mVADThreshold ; private float mAmplitudeBoost = 1.0F ; private boolean mInitialized ; private boolean mBluetoothOn ; private boolean mHalfDuplex ; private boolean mPreprocessorEnabled ; private final Object mEncoderLock ; private BroadcastReceiver mBluetoothReceiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { } } ; public AudioHandler ( Context context , JumbleLogger logger , AudioHandler . AudioEncodeListener encodeListener , AudioOutput . AudioOutputListener outputListener ) { } private void createAudioInput ( ) throws AudioException { } private void createAudioOutput ( ) { } public synchronized void initialize ( ) throws AudioException { } public synchronized void startRecording ( ) throws AudioException { } public synchronized void stopRecording ( ) throws AudioException { } public boolean isInitialized ( ) { } public boolean isRecording ( ) { } public JumbleUDPMessageType getCodec ( ) { } public void recreateEncoder ( ) throws NativeAudioException { } public void setCodec ( JumbleUDPMessageType codec ) throws NativeAudioException { mCodec = codec ; if ( ( mEncoder ) != null ) { mEncoder . destroy ( ) ; mEncoder = null ; } IEncoder encoder ; switch ( codec ) { case UDPVoiceCELTAlpha : encoder = new CELT7Encoder ( AudioHandler . SAMPLE_RATE , AudioHandler . FRAME_SIZE , 1 , mFramesPerPacket , mBitrate ) ; break ; case UDPVoiceCELTBeta : encoder = new CELT11Encoder ( AudioHandler . SAMPLE_RATE , 1 , mFramesPerPacket ) ; break ; case UDPVoiceOpus : encoder = new OpusEncoder ( AudioHandler . SAMPLE_RATE , 1 , AudioHandler . FRAME_SIZE , mFramesPerPacket , mBitrate ) ; break ; default : Log . w ( TAG , "Unsupported<seq2seq4repair_space>codec,<seq2seq4repair_space>input<seq2seq4repair_space>disabled." ) ; return ; } if ( mPreprocessorEnabled ) { encoder = new com . morlunk . jumble . audio . encoder . PreprocessingEncoder ( encoder , AudioHandler . FRAME_SIZE , AudioHandler . SAMPLE_RATE ) ; } if ( ( mInput . getSampleRate ( ) ) != ( AudioHandler . SAMPLE_RATE ) ) { <START_BUG> encoder = new com . morlunk . jumble . audio . encoder . ResamplingEncoder ( encoder , 1 , mInput . getSampleRate ( ) , AudioHandler . SAMPLE_RATE ) ; <END_BUG> } mEncoder = encoder ; } public int getAudioStream ( ) { } public void setAudioStream ( int audioStream ) { } public int getAudioSource ( ) { } public void setAudioSource ( int audioSource ) throws AudioException { } public int getSampleRate ( ) { } public void setSampleRate ( int sampleRate ) throws AudioException { } public int getBitrate ( ) { } public void setBitrate ( int bitrate ) throws NativeAudioException { } public void setMaxBandwidth ( int maxBandwidth ) throws AudioException { } public int getFramesPerPacket ( ) { } public void setFramesPerPacket ( int framesPerPacket ) throws AudioException { } public int getTransmitMode ( ) { } public void setTransmitMode ( int transmitMode ) throws AudioException { } public float getVADThreshold ( ) { } public void setVADThreshold ( float threshold ) { } public float getAmplitudeBoost ( ) { } public void setAmplitudeBoost ( float boost ) { } public boolean isHalfDuplex ( ) { } public void setHalfDuplex ( boolean halfDuplex ) { } public void setPreprocessorEnabled ( boolean preprocessorEnabled ) { } public int getCurrentBandwidth ( ) { } public synchronized void shutdown ( ) { } @ Override public void messageCodecVersion ( Mumble . CodecVersion msg ) { } @ Override public void messageServerSync ( Mumble . ServerSync msg ) { } @ Override public void messageVoiceData ( byte [ ] data , JumbleUDPMessageType messageType ) { } @ Override public void onTalkStateChange ( User . TalkState state ) { } @ Override public void onAudioInputReceived ( short [ ] frame , int frameSize ) { } private void sendEncodedAudio ( ) { } public interface AudioEncodeListener { public void onAudioEncoded ( byte [ ] data , int length ) { } public void onTalkStateChange ( User . TalkState state ) { } } }

Fix:
encoder = new com . morlunk . jumble . audio . encoder . ResamplingEncoder ( encoder , 1 , mInput . getSampleRate ( ) , AudioHandler . FRAME_SIZE , AudioHandler . SAMPLE_RATE ) ;