ladendirekt / pjsip4net

A wrapper library exposing the pjsip library to the .NET world in a OO-friendly way.
71 stars 42 forks source link

Possibility to disable only capture device #75

Closed AverkinSergei closed 6 years ago

AverkinSergei commented 7 years ago

Hi! In my app I want to disable only capture device. But it's imposible :( I suggest: in DefaultMediaManager.cs to correct: `public void SetDevices() { _curCapture = _registry.MediaConfig.CaptureDeviceId != -1 ? SoundDevices.Where(s => s.Id == _registry.MediaConfig.CaptureDeviceId).Take(1).SingleOrDefault() : null; _curPlayback = _registry.MediaConfig.PlaybackDeviceId != -1 ? SoundDevices.Where(s => s.Id == _registry.MediaConfig.PlaybackDeviceId).Take(1).SingleOrDefault() : null;

        //if (_curCapture != null && _curPlayback != null)
        //    _mediaApi.SetCurrentSoundDevices(new Tuple<int, int>(_curCapture.Id, _curPlayback.Id));
        //else
        //    _mediaApi.SetCurrentSoundDevicesToNull();
        if (_curCapture != null && _curPlayback != null)
            _mediaApi.SetCurrentSoundDevices(new Tuple<int, int>(_curCapture.Id, _curPlayback.Id));
        else if (_curCapture == null && _curPlayback != null)
            _mediaApi.SetCurrentSoundDevices(new Tuple<int, int>(-1, _curPlayback.Id));
        else
            _mediaApi.SetCurrentSoundDevicesToNull();
    }`

And in MediaApiProvider_1_4.cs to correct: public void SetCurrentSoundDevices(pjsip4net.Core.Utils.Tuple<int, int> deviceIds) { //Helper.GuardPositiveInt(deviceIds.Part1); //Helper.GuardPositiveInt(deviceIds.Part2); Helper.GuardError(PJSUA_DLL.Media.pjsua_set_snd_dev(deviceIds.Part1, deviceIds.Part2)); }

This as a proposal... It's work for me and useful in a conference

siniypin commented 7 years ago

Hi, I'd be happy to apply that change. Could you send me a pull request for that?

AverkinSergei commented 7 years ago

Ok

AverkinSergei commented 7 years ago

I have sent a pull request.

siniypin commented 7 years ago

Hi, appreciate it. I'll get to it soon.