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

Add audio streaming support for generic PCM devices. #209

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

charlyreen
Copy link

  • Allow generic PCM devices to stream audio from ALSA via piKVM
  • New config parameters in janus.plugin.ustreamer.jcfg:
    • pcm_path: Path in /dev/snd/ to PCM device
    • pcm_sampling_rate: Sampling rate
    • pcm_channels: Number of PCM channels

@@ -95,7 +95,7 @@ us_audio_s *us_audio_init(const char *name, unsigned pcm_hz) {

SET_PARAM("Can't initialize PCM params", snd_pcm_hw_params_any);
SET_PARAM("Can't set PCM access type", snd_pcm_hw_params_set_access, SND_PCM_ACCESS_RW_INTERLEAVED);
SET_PARAM("Can't set PCM channels numbre", snd_pcm_hw_params_set_channels, 2);
SET_PARAM("Can't set PCM channels numbre", snd_pcm_hw_params_set_channels, pcm_channels);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also fix numbre -> number?

US_JLOG_INFO("config", "Missing config value: audio.tc358743 OR audio.pcm_path");
goto error;
}
else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use } else { on the same line

@@ -53,8 +53,21 @@ us_config_s *us_config_init(const char *config_dir_path) {
}
if ((config->audio_dev_name = _get_value(jcfg, "audio", "device")) != NULL) {
if ((config->tc358743_dev_path = _get_value(jcfg, "audio", "tc358743")) == NULL) {
US_JLOG_INFO("config", "Missing config value: audio.tc358743");
goto error;
if((config->pcm_path = _get_value(jcfg, "audio", "pcm_path")) == NULL) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use just "pcm" for the config option name: config->pcm_path = _get_value(jcfg, "audio", "pcm")

Also the space required after if.

@@ -39,6 +39,9 @@ typedef struct {

char *audio_dev_name;
char *tc358743_dev_path;
char *pcm_path;
char *pcm_sampling_rate;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why char *

@@ -39,6 +39,9 @@ typedef struct {

char *audio_dev_name;
char *tc358743_dev_path;
char *pcm_path;
char *pcm_sampling_rate;
char *pcm_channels;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@mdevaev
Copy link
Member

mdevaev commented Mar 19, 2023

Has this code been tested? Apparently, it shouldn't compile because of the wrong types.

And also, if I remember correctly, OPUS in RTP should always be stereo, shouldn't it?

@mdevaev
Copy link
Member

mdevaev commented Jul 11, 2023

Sup? Please take a look to my notes, and change type of pcm_sampling_rate to unsigned.

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

Successfully merging this pull request may close these issues.

2 participants