Search code examples
androidsocketsaudioaudio-streamingrtp

Audio Stream Input blocks get dropped?


I'm trying to send audio through AudioStream from android device to Vlc media player, Vlc catches audio stream but drops all the blocks. Follwing is a block of code. Is there a problem with codec?Vlc Screenshot

AudioManager audiomanager =(AudioManager) getSystemService(Context.AUDIO_SERVICE);
audiomanager.setMode(AudioManager.MODE_IN_COMMUNICATION);
audioGroup = new AudioGroup();
audioGroup.setMode(AudioGroup.MODE_NORMAL);
localip= getLocalAddress().toString();
audioStream = new AudioStream(getLocalAddress());
locolport.append(String.valueOf(audioStream.getLocalPort()));
audioStream.setCodec(AudioCodec.PCMU);
audioStream.setMode(RtpStream.MODE_NORMAL);
audioStream.associate(remoteIP, 22222);
audioStream.join(audioGroup);

Solution

  • Actually the problem was with permissions of android device, I was requiring permissions in manifest file but in android version Marshmallow or higher I had to request permissions on run time at least once(if granted).