alexeyvasilyev / rtsp-client-android

Lightweight low-latency RTSP client library for Android
Apache License 2.0
231 stars 61 forks source link

The sound I heard was not correct #7

Open chimsedb opened 3 years ago

chimsedb commented 3 years ago

I can only hear a rustling sound when I speak into my microphone from the source

Please help me @@

alexeyvasilyev commented 3 years ago

What exact camera model do you have?

chimsedb commented 3 years ago

i am using google pixel 3 XL . Can u support that ?

alexeyvasilyev commented 3 years ago

I mean to what RTSP source are you trying to connect to?

chimsedb commented 3 years ago

https://github.com/begeekmyfriend/yasea I am using this for broacast then I connect wowza server to get rtsp/rtmp url My rtsp link : rtsp://54.151.236.80:1935/live/205

alexeyvasilyev commented 3 years ago

Used to work. Now I'm getting 404 error.

chimsedb commented 3 years ago

Sorry my server die . Can u try again ? . My link not work 24/24

alexeyvasilyev commented 3 years ago

It works now. What I see at the moment that audio decoder is constantly crashing.

m=audio 0 RTP/AVP 96
a=rtpmap:96 mpeg4-generic/44100/2
a=fmtp:96 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1210fff15081ffdffc
a=control:trackID=1

Audio: AAC LC, sample rate: 44100 Hz, channels: 2

AudioDecodeThread: Decoder format changed: {aac-drc-heavy-compression=1, sample-rate=44100, aac-drc-boost-level=127, aac-drc-output-loudness=-1, mime=audio/raw, channel-count=2, aac-drc-effect-type=3, aac-drc-cut-level=127, aac-encoded-target-level=-1, aac-max-output-channel_count=8, aac-target-ref-level=64, aac-drc-album-mode=0}

    Process: com.alexvas.rtsp.demo, PID: 15669
    java.lang.IllegalStateException
        at android.media.MediaCodec.native_dequeueInputBuffer(Native Method)
        at android.media.MediaCodec.dequeueInputBuffer(MediaCodec.java:2855)
        at com.alexvas.rtsp.demo.decode.AudioDecodeThread.run(AudioDecodeThread.kt:81)

ffmpeg shows

Audio: aac (LC), 44100 Hz, stereo, fltp

I have not tested on stereo audio sources. Can you switch to mono and check if the problem still exists?

chimsedb commented 3 years ago

change AudioFormat.CHANNEL_IN_STEREO to AudioFormat.CHANNEL_IN_MONO from my broadcast right?

alexeyvasilyev commented 3 years ago

No. Enable wowza send mono audio only.

chimsedb commented 3 years ago

ok i will try . Thank for help me :))

alexeyvasilyev commented 3 years ago

Another option to try in AudioDecodeThread.kt

//        val csd0 = getAacDecoderConfigData(sampleRate, channelCount)
//        val bb = ByteBuffer.wrap(csd0)
//        format.setByteBuffer("csd-0", bb)
        format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, channelCount)
        format.setInteger(MediaFormat.KEY_SAMPLE_RATE, sampleRate)
        format.setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectLC)

And change there every AudioFormat.CHANNEL_OUT_MONO to AudioFormat.CHANNEL_OUT_STEREO

chimsedb commented 3 years ago

Ok i will test latter then confirm for u . Thank u so much !!

alexeyvasilyev commented 3 years ago

I made small changes to 1.3.1. It will not fix your problem. But at least it is not crashing at the moment.

chimsedb commented 3 years ago

I think this issue from me When i change CHANNEL_IN_STEREO -> CHANNEL_IN_MONO from broadcast i can hear my voice but speed of my voice x2 or x3 and have loss ( I think my protocol is UDP) and my Buffer Size has config to fit with CHANNEL_IN_STEREO (I think so) image and here is my config image I was use vlc lib and exoplayer to load rtsp url but all delay and cant not support low latency when i use your lib video loading good for me but i cant hear my voice. Do you have any suggestions for me about video call ( I cant use web rtc because this project i maintenance cant change) ? I don't have much experience with this