데스크탑 PC의 마이크와 Android 스마트 폰간에 rtp 연결을 설정하려고합니다.gstreamer로 rtp 스트림 재생
gstreamer를 사용하여 데이터를 가져옵니다. 동일한 시스템에서이 마이크를 동시에 사용하는 다른 응용 프로그램 때문에 데이터가 게시되는 tcpsink가 있습니다.
이
이 호출로 수행됩니다gst-launch-0.10 -v alsasrc ! 'audio/x-raw-int, depth=16, width=16, \
endianness=1234, channels=1, rate=16000' ! \
tcpserversink host=localhost port=20000
그때 내가 TCP 연결을 잡고 UDP
gst-launch-0.10 tcpclientsrc host=localhost protocol=0 port=20000 ! \
audio/x-raw-int,depth=16, width=16,endianness=1234, channels=1,\
rate=16000 ! lamemp3enc target=1 bitrate=64 cbr=true ! mad ! \
audioconvert ! audioresample ! mulawenc ! rtppcmupay pt=96 ! \
udpsink host=129.70.134.128 port=6000
을 통해 데이터를 게시하는 RTP 스트림으로 변환 두 번째 스트림을 생성 로컬 호스트에서 VLC 플레이어 아 파크 재생하는 동안이
vlc rtp://129.70.134.128:6000
가 지금은에 udpsink의 호스트를 변경 작동 안드로이드의 전화 중 하나. 이것은 또한 mplayer 앱을 가지고 노는 동안 소리 지르는 것을합니다.
마지막으로 내 단계는 내 앱으로 사운드를 재생하는 것입니다.
android.net.rtp 클래스로 스트림을 가져 오려고합니다.
AudioManager audioManager = (AudioManager);
mContext.getSystemService(mContext.AUDIO_SERVICE);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
AudioStream inRtpStream = new AudioStream(createInet("127.0.0.1"));
inRtpStream.associate(createInet(url), 6000);
inRtpStream.setMode(RtpStream.MODE_RECEIVE_ONLY);
inRtpStream.setCodec(AudioCodec.PCMU);
inRtpStream.setDtmfType(96);
// Initialize an AudioGroup and attach an AudioStream
AudioGroup main_grp = new AudioGroup();
main_grp.setMode(AudioGroup.MODE_NORMAL);
inRtpStream.join(main_grp);
하지만 침묵이 있습니다. 로깅 출력을 보면 어떤 종류의 데이터가 있다고 생각하게됩니다. 애플리케이션이 재생하려고합니다.
DEBUG AudioGroup stream[57] is configured as PCMU 8kHz 20ms mode 2
DEBUG AudioGroup stream[64] is configured as RAW 8kHz 32ms mode 0
DEBUG AudioGroup stream[64] joins group[63]
DEBUG AudioGroup group[63] switches from mode 0 to 2
DEBUG AudioGroup stream[57] joins group[63]
DEBUG AudioGroup reported frame count: output 1149, input 384
DEBUG AudioGroup adjusted frame count: output 1149, input 512
DEBUG AudioGroup latency: output 302, input 64
내가 스트림을 시작, 또는에 스피커를 전환 뭔가를 놓친 거지 ?
사용 가능한 모든 볼륨 슬라이더가 최대로 회전합니다. 또한 매니페스트 파일에서 INTERNET 및 RECORD_AUDIO 권한을 요청했습니다.
코덱도 동일해야합니다. 귀하의 답변
감사