Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setCaptureDevice causes the Qt audio interface to freeze. #879

Open
TimelifeCzy opened this issue Jan 14, 2025 · 2 comments
Open

setCaptureDevice causes the Qt audio interface to freeze. #879

TimelifeCzy opened this issue Jan 14, 2025 · 2 comments

Comments

@TimelifeCzy
Copy link

TimelifeCzy commented Jan 14, 2025

linphone-desktop version master_5 or 5.1.2

Qt Audio window select ComBox to set audio successfully, But Use Code interface Setting Error.
Success Log:
[Info]Core:linphone: MSTicker thread exiting
[Info]Core:linphone: speex_lib_ctl init with neon ? 0
[Info]Core:linphone: ms_filter_link: MSAlsaRead:0x69832d0,0-->MSVolume:0x6d48660,0
[Info]Core:linphone: ms_filter_link: MSVolume:0x6d48660,0-->MSResample:0x6d659f0,0
[Info]Core:linphone: ms_filter_link: MSResample:0x6d659f0,0-->MSVolume:0x6d4cc30,0
[Info]Core:linphone: ms_filter_link: MSVolume:0x6d4cc30,0-->MSAlsaWrite:0x6d42cb0,0
[Info]Core:linphone: MSVolume[0x6d4cc30]: set gain to [0.000000] linear
[Warning]Core:linphone: QT: [setting modle] "ALSA Unknown: default" "ALSA Unknown: default" --Add Log
[Info]Core:linphone: MSTicker priority left to normal.
[Info]Core:linphone: Initializing speex resampler in mode [voip] from 1 channels
[Info]Core:linphone: alsa_open_r: opening default at 8000Hz, bits=16, stereo=0
[Warning]Core:linphone: alsa_set_params: periodsize:256 Using 256
[Warning]Core:linphone: alsa_set_params: period:8 Using 8
[Info]Core:linphone: alsa_open_r: Audio params set
[Info]Core:linphone: ms_ticker_set_time_func: ticker's time method updated.
[Info]Core:linphone: alsa_open_w: opening default at 8000Hz, bits=16, stereo=0
[Warning]Core:linphone: alsa_set_params: periodsize:256 Using 256
[Warning]Core:linphone: alsa_set_params: period:8 Using 8
[Info]Core:linphone: alsa_open_w: Audio params set
[Info]Core:linphone: ms_ticker_set_time_func: ticker's time method updated.
[Info]Core:linphone: ms_filter_unlink: MSVolume:0x6d4cc30,0-->MSAlsaWrite:0x6d42cb0,0
[Info]Core:linphone: ms_filter_unlink: MSVolume:0x6d48660,0-->MSResample:0x6d659f0,0
[Info]Core:linphone: ms_filter_unlink: MSResample:0x6d659f0,0-->MSVolume:0x6d4cc30,0
[Info]Core:linphone: ms_filter_unlink: MSAlsaRead:0x69832d0,0-->MSVolume:0x6d48660,0
[Info]Core:linphone: ms_ticker_synchronizer_destroy(): sound/wall clock skew was in average=2.028547 ms
[Info]Core:linphone: MSTicker thread exiting
[Info]Core:linphone: QT: "Update nat policy."
[Info]Core:linphone: Sal nat helper [enabled]
[Info]Core:linphone: Sal use rports [enabled]
[Info]Core:linphone: Connection to the pulseaudio server failed
[Info]Core:linphone: Card 'ALSA Unknown: default' added with capabilities [capture, playback]
[Info]Core:linphone: ALSA: found card with name [sof-hda-dsp], long name [LENOVO-21FHA0CACD-ThinkPadL13Gen4].
[Info]Core:linphone: Card 'ALSA Unknown: sof-hda-dsp' added with capabilities [capture, playback]
[Warning]Core:linphone: Device [default] type is unknown
[Warning]Core:linphone: Device [sof-hda-dsp] type is unknown
[Info]Core:linphone: [ setOutputAudioDeviceBySndCard ] on device: default
[Info]Core:linphone: [ setInputAudioDeviceBySndCard ] on device: default
[Info]Core:linphone: Linphone core [0x318e7c0] notified [audio_devices_list_updated]
[Info]Core:linphone: speex_lib_ctl init with neon ? 0
[Info]Core:linphone: ms_filter_link: MSAlsaRead:0x6986990,0-->MSVolume:0x7f994478fc30,0
[Info]Core:linphone: ms_filter_link: MSVolume:0x7f994478fc30,0-->MSResample:0x6d211f0,0
[Info]Core:linphone: ms_filter_link: MSResample:0x6d211f0,0-->MSVolume:0x5bc9270,0
[Info]Core:linphone: ms_filter_link: MSVolume:0x5bc9270,0-->MSAlsaWrite:0x7f994457da10,0
[Info]Core:linphone: MSVolume[0x5bc9270]: set gain to [0.000000] linear
[Warning]Core:linphone: QT: [setting modle] "ALSA Unknown: default" "ALSA Unknown: default"
[Info]Core:linphone: MSTicker priority left to normal.
[Info]Core:linphone: Initializing speex resampler in mode [voip] from 1 channels
[Info]Core:linphone: alsa_open_r: opening default at 8000Hz, bits=16, stereo=0
[Warning]Core:linphone: alsa_set_params: periodsize:256 Using 256
[Warning]Core:linphone: alsa_set_params: period:8 Using 8
[Info]Core:linphone: alsa_open_r: Audio params set
[Info]Core:linphone: ms_ticker_set_time_func: ticker's time method updated.
[Info]Core:linphone: alsa_open_w: opening default at 8000Hz, bits=16, stereo=0
[Warning]Core:linphone: alsa_set_params: periodsize:256 Using 256
[Warning]Core:linphone: alsa_set_params: period:8 Using 8
[Info]Core:linphone: alsa_open_w: Audio params set
[Info]Core:linphone: channel [0x681d880]: keep alive sent to [UDP://192.168.191.63:5060]
[Info]Core:linphone: ms_ticker_set_time_func: ticker's time method updated.
[Info]Core:linphone: ms_filter_unlink: MSVolume:0x5bc9270,0-->MSAlsaWrite:0x7f994457da10,0
[Info]Core:linphone: ms_filter_unlink: MSVolume:0x7f994478fc30,0-->MSResample:0x6d211f0,0
[Info]Core:linphone: ms_filter_unlink: MSResample:0x6d211f0,0-->MSVolume:0x5bc9270,0
[Info]Core:linphone: ms_filter_unlink: MSAlsaRead:0x6986990,0-->MSVolume:0x7f994478fc30,0
[Info]Core:linphone: ms_ticker_synchronizer_destroy(): sound/wall clock skew was in average=2.158378 ms
[Info]Core:linphone: MSTicker thread exiting
[Info]Core:linphone: QT: "Update nat policy."
[Info]Core:linphone: Sal nat helper [enabled]
[Info]Core:linphone: Sal use rports [enabled]
[Info]Core:linphone: QT: "Delete notification:" NotificationNewVersionAvailable_QMLTYPE_578(0x2d82870, name = "__internalWrapper")

Use Source code Settings

    const auto pSettingModel = CoreManager::getInstance()->getSettingsModel();
    if(pSettingModel ) {
        const std::string setDevName = "ALSA Unknown: sof-hda-dsp";
        pSettingModel->setCaptureDevice(Utils::coreStringToAppString(setDevName));
    }

Error Log:
[19:53:16:904][Warning]Core:linphone: QT: [set capture device] "ALSA Unknown: sof-hda-dsp"
[19:53:16:904][Warning]Core:linphone: QT: [set capture device] devId "ALSA Unknown: default"
[19:53:16:904][Warning]Core:linphone: QT: [set capture device] devId "ALSA Unknown: sof-hda-dsp"
[19:53:16:904][Warning]Core:linphone: QT: [set capture device] setCaptureDevice "ALSA Unknown: sof-hda-dsp"
[19:53:16:904][Warning]Core:linphone: QT: [set capture device] setInputAudioDevice
[19:53:16:904][Info]Core:linphone: speex_lib_ctl init with neon ? 0
[19:53:16:904][Info]Core:linphone: ms_filter_link: MSAlsaRead:0x7f997400c490,0-->MSVolume:0x7f997400b7d0,0
[19:53:16:904][Info]Core:linphone: ms_filter_link: MSVolume:0x7f997400b7d0,0-->MSResample:0x7f9974004d10,0
[19:53:16:904][Info]Core:linphone: ms_filter_link: MSResample:0x7f9974004d10,0-->MSVolume:0x7f997400ad20,0
[19:53:16:904][Info]Core:linphone: ms_filter_link: MSVolume:0x7f997400ad20,0-->MSAlsaWrite:0x7f9974007010,0
[19:53:16:904][Info]Core:linphone: MSVolume[0x7f997400ad20]: set gain to [0.000000] linear
[19:53:16:904][Info]Core:linphone: MSTicker priority left to normal.
[19:53:16:904][Warning]Core:linphone: QT: [setting modle] "ALSA Unknown: sof-hda-dsp" "ALSA Unknown: default"
[19:53:16:904][Info]Core:linphone: Initializing speex resampler in mode [voip] from 1 channels
[19:53:16:914][Info]Core:linphone: alsa_open_r: opening sysdefault:0 at 8000Hz, bits=16, stereo=0
[19:53:16:962][Warning]Core:linphone: alsa_set_params: periodsize:256 Using 256
[19:53:16:962][Warning]Core:linphone: alsa_set_params: period:8 Using 8
[19:53:16:980][Info]Core:linphone: alsa_open_r: Audio params set
[19:53:16:982][Info]Core:linphone: ms_ticker_set_time_func: ticker's time method updated.
[19:53:17:022][Info]Core:linphone: alsa_open_w: opening default at 8000Hz, bits=16, stereo=0
[19:53:17:023][Warning]Core:linphone: alsa_set_params: periodsize:256 Using 256
[19:53:17:023][Warning]Core:linphone: alsa_set_params: period:8 Using 8
[19:53:17:052][Info]Core:linphone: alsa_open_w: Audio params set
[19:53:22:042][Info]Core:linphone: sound/wall clock skew is average=5.107377 ms
[19:53:27:072][Info]Core:linphone: sound/wall clock skew is average=5.209913 ms

After setting up, open the audio window through Qt and the interface will be blocked.
Erro Log:
[19:53:31:442][Info]Core:linphone: Connection to the pulseaudio server failed
[19:53:31:442][Info]Core:linphone: alsa error in pcm_hw.c:1785 - open '/dev/snd/pcmC0D0c' failed (-16)
[19:53:31:442][Info]Core:linphone: alsa error in pcm_hw.c:1785 - open '/dev/snd/pcmC0D0p' failed (-16)
[19:53:31:442][Info]Core:linphone: Card 'ALSA Unknown: default' added with capabilities [none]
[19:53:31:442][Info]Core:linphone: ALSA: found card with name [sof-hda-dsp], long name [LENOVO-21FHA0CACD-ThinkPadL13Gen4].
[19:53:31:442][Info]Core:linphone: alsa error in pcm_hw.c:1785 - open '/dev/snd/pcmC0D0c' failed (-16)
[19:53:31:443][Info]Core:linphone: alsa error in pcm_hw.c:1785 - open '/dev/snd/pcmC0D0p' failed (-16)
[19:53:31:443][Warning]Core:linphone: Device [default] type is unknown
[19:53:31:443][Warning]Core:linphone: no card with id ALSA Unknown: default
[19:53:31:443][Error]Core:linphone: Could not find a suitable soundcard with capabilities : 2
[19:53:31:443][Warning]Core:linphone: no card with id ALSA Unknown: default
[19:53:31:443][Error]Core:linphone: Could not find a suitable soundcard with capabilities : 2
[19:53:31:443][Warning]Core:linphone: no card with id ALSA Unknown: sof-hda-dsp
[19:53:31:443][Error]Core:linphone: Could not find a suitable soundcard with capabilities : 1
[19:53:31:443][Error]Core:linphone: Could not find a suitable soundcard with capabilities : 2
[19:53:31:443][Info]Core:linphone: [ setOutputAudioDeviceBySndCard ] remove output device
[19:53:31:443][Error]Core:linphone: Could not find a suitable soundcard with capabilities : 1
[19:53:31:443][Info]Core:linphone: [ setInputAudioDeviceBySndCard ] remove input device
[19:53:31:443][Info]Core:linphone: Linphone core [0x318e7c0] notified [audio_devices_list_updated]
[19:53:31:443][Warning]Core:linphone: No capture card with id ALSA Unknown: default
[19:53:31:443][Warning]Core:linphone: No capture card with id ALSA Unknown: default
[19:53:31:443][Warning]Core:linphone: No playback card with id ALSA Unknown: default
[19:53:31:443][Warning]Core:linphone: No playback card with id ALSA Unknown: default
[19:53:31:443][Warning]Core:linphone: No playback card with id ALSA Unknown: default
[19:53:32:091][Info]Core:linphone: sound/wall clock skew is average=5.322314 ms

This code works fine, find the device name success.

auto list = CoreManager::getInstance()->getCore()->getExtendedAudioDevices();
auto audioDevice = find_if(list.cbegin(), list.cend(), [&] ( const std::shared_ptr<linphone::AudioDevice> & audioItem) {
   qWarning() << "[set capture device] devId " << QString::fromStdString(audioItem->getId());
   return audioItem->getId() == devId;
});

Don't know what the problem is

    CoreManager::getInstance()->getCore()->setCaptureDevice(devId);
    CoreManager::getInstance()->getCore()->setInputAudioDevice(*audioDevice);
    emit captureDeviceChanged(device);
    resetCaptureGraph();

According to log analysis, Diff MSAlsaRead MSVolume MSResample Addresses vary widely.

Need help, Thank you!

@TimelifeCzy
Copy link
Author

TimelifeCzy commented Jan 15, 2025

[Info]Core:linphone: alsa error in pcm_hw.c:1785 - open '/dev/snd/pcmC0D0c' failed (-16)
[Info]Core:linphone: alsa error in pcm_hw.c:1785 - open '/dev/snd/pcmC0D0p' failed (-16)

void SettingsModel::resetCaptureGraph() {
deleteCaptureGraph();
createCaptureGraph();
}

The final code verification is createCaptureGraph() issue.
more analyze:
createCaptureGraph();
--->mSimpleCaptureGraph->start();

Solution:
Setting audio annotating resetCaptureGraph, There is no functional impact.

@TimelifeCzy
Copy link
Author

TimelifeCzy commented Jan 15, 2025

The other version acquisition has been unsuccessful. linphone desktop git checkout 5.1.2 error:
[Info]Core:linphone: channel [0x2b88d00] [691] bytes parsed
[Info]Core:linphone: Found transaction matching response.
[Info]Core:linphone: Changing [client] [PUBLISH] transaction [0x54203f0], from state [TRYING] to [COMPLETED]
[Info]Core:linphone: Refresher [0x493f610]: has no contact for request [0x4eca9e0].
[Info]Core:linphone: Refresher[0x493f610]: scheduling next timer in 108000 ms for purpose [normal refresh]
[Info]Core:linphone: Publish refresher [200] reason [OK] for proxy [sip:192.168.191.63:5060;transport=udp]
[Info]Core:linphone: LinphoneEvent [0x438a010] moving from [LinphonePublishProgress] to publish state LinphonePublishOk
[Info]Core:linphone: Connection to the pulseaudio server failed
[Error]Core:linphone: Could not find a suitable soundcard with capabilities : 2
[Error]Core:linphone: Could not find a suitable soundcard with capabilities : 2
[Error]Core:linphone: Could not find a suitable soundcard with capabilities : 1
[Error]Core:linphone: Could not find a suitable soundcard with capabilities : 2
[Info]Core:linphone: [ setOutputAudioDeviceBySndCard ] remove output device
[Error]Core:linphone: Could not find a suitable soundcard with capabilities : 1
[Info]Core:linphone: [ setInputAudioDeviceBySndCard ] remove input device
[Info]Core:linphone: Linphone core [0x1aecd80] notified [audio_devices_list_updated]
[Error]Core:linphone: linphone_core_create_local_player(): no sound card.
[Warning]Core:linphone: no card with id
[Warning]Core:linphone: QT: Cannot get playback card from MSFactory with :
[Warning]Core:linphone: no card with id
[Warning]Core:linphone: QT: Cannot get capture card from MSFactory with :
[Warning]Core:linphone: QT: [setting modle] "" ""
[Info]Core:linphone: Changing [client] [PUBLISH] transaction [0x54203f0], from state [COMPLETED] to [TERMINATED]
[Info]Core:linphone: Client internal PUBLISH transaction [0x54203f0] terminate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant