BelledonneCommunications / linphone-xamarin

Linphone.org mirror for linphone-xamarin (git://git.linphone.org/linphone-xamarin.git)
https://www.linphone.org/
GNU General Public License v3.0
26 stars 21 forks source link

android: incoming call audio comes into wrong stream #7

Open WhitePhoera opened 6 years ago

WhitePhoera commented 6 years ago

when i recieve call(i have autoanswer) sound comes into Stream.Ring(or notification). (into speaker and volume controled by ring stream) in Listener.OnCallStateChanged i have: `
private void OnCall(Core lc, Call lcall, Linphone.CallState state, string message)

    {

        if (state == Linphone.CallState.IncomingReceived)

        {

                    lcall.Accept();

        }

    }

` if i do outgoing call sound comes into correct stream with correct volume handling.

if i set AudioManager.Mode = Mode.InCommunication then sound comes into ear speaker. but stream volume still controled by Ring stream volume.

tested on latest Xamarin sdk(loaded today, not nightly). any idea how to fix it?

WhitePhoera commented 6 years ago

seems native libraries from same android sdk don't have that issue.

Viish commented 6 years ago

Which audio stream is used is decided by the library. If the ring card is being used, then the Android RING stream is chosen. When a call is connected, the playcard is set to use the VOICE stream. This is true for both OpenSLES and Android media soundcard. Are you using on of those two ?

Maybe your issue is related to the fact you have enabled the auto answer. Have you tried to disable it ?

WhitePhoera commented 6 years ago

i may return to Xamarin packed aar file and try again.

but issue just was solved by replacing aar from android-java package. so, looks like it's just present in that version of aar.

WhitePhoera commented 6 years ago

by fact i need autoanswer, since when i start SIP user already notified and accepted connection(via push) i set

                LinphoneCore.Ring = null;
                LinphoneCore.Ringback = null;
                LinphoneCore.RemoteRingbackTone = null;
                LinphoneCore.RingDuringIncomingEarlyMedia = false;
                LinphoneCore.RingerDevice = null;

since i don't need ringer from linphone.

still issue persist, it sometimes uses media stream, sometimes uses ringer one, sometimes all ok. i use default sound device, do i need specify specific to work correctly? (i tryed set delay, but no changes)

WhitePhoera commented 6 years ago

also just found that somehow i have no sound output on android 8.

2018-03-23 14:20:35:240 mediastreamer-warning-Not enough ref samples, using zeroes
2018-03-23 14:20:35:258 mediastreamer-message-Samples are back.
2018-03-23 14:20:35:309 mediastreamer-warning-Too many samples to drop, dropping entire frame.

looped in logs

WhitePhoera commented 6 years ago

i just also got report that notification also switches sound to loud-speaker and there is no way to disable it unless restart call.

WhitePhoera commented 6 years ago

also on such phones if i try to enable speaker sound will disappear.

may be for me will be better use Java-android version and just wrap it?

WhitePhoera commented 6 years ago

I wanna summarize: Can i disable auto stream selection? I just need voice one. All routing/mode i will do myself.(loudspeaker, phone speaker, bt/sco) I need it just do input/output. No additional reaction for focus and etc.(no reaction for notification and etc)

WhitePhoera commented 6 years ago

any info? it sometimes loses audio when i do

Audio.SpeakerphoneOn = true

on some phones at least.(one for sure with Android 8.1)

or if any notification with sound will arrive

chnng commented 5 years ago

by fact i need autoanswer, since when i start SIP user already notified and accepted connection(via push) i set

                LinphoneCore.Ring = null;
                LinphoneCore.Ringback = null;
                LinphoneCore.RemoteRingbackTone = null;
                LinphoneCore.RingDuringIncomingEarlyMedia = false;
                LinphoneCore.RingerDevice = null;

since i don't need ringer from linphone.

still issue persist, it sometimes uses media stream, sometimes uses ringer one, sometimes all ok. i use default sound device, do i need specify specific to work correctly? (i tryed set delay, but no changes)

Hi, I don't need ringer too, and I set LinphoneCore just like you, can you disable ring after you set these? Here is my question. https://github.com/BelledonneCommunications/linphone-android/issues/498