roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.06k stars 213 forks source link

Introduce SampleSpec class #378

Closed gavv closed 3 years ago

gavv commented 4 years ago

We have numerous components in roc_audio and roc_sndio modules, which get two parameters in their constructor: sample_rate and either num_channels or channel_mask (often ch_mask).

They are good candidates to be united in a class with two fields and helper methods. It will simplify and unify the code and later will allow us to easily replace channel mask with more sophisticated channel set information (#86).

The new class should be called SampleSpec and placed into roc_audio module. It should contain two private fields, a constructor, getters, and setters.

We should also use SampleSpec instead of input_sample_rate + input_channels in pipeline::SenderConfig, and instead of output_sample_rate + output_channels in pipeline::ReceiverCommonConfig. And the same for pipeline::ConverterConfig.

After adding the class, we should check if we can also convert free functions packet::num_channels(), packet::ns_to_size(), and packet::size_to_ns() to methods of this class. If in all places where they're used we're actually using them with SampleSpec fields, we can do it.

soapdogg commented 4 years ago

Hi, I would like to work on this issue.

gavv commented 4 years ago

@soapdogg Hi, you're welcome!

gavv commented 3 years ago

@soapdogg Hi, do you plan finishing the PR?

soapdogg commented 3 years ago

Hi,

Probably not. I have got caught up in other work. Feel free to unassign me from this task.

gavv commented 3 years ago

Thanks for letting know. Unassigning, so that someone could pick it up. Feel free to ping me if you decide to get back to it.

ghost commented 3 years ago

Hi gavv, I stumbled on Roc while looking for my first open source project to work on. I read your about page and really like what you guys are doing. May I work on this issue?

gavv commented 3 years ago

@nythoang Sure, you're welcome! Please take a look at #430 (last commits by Eric and discussions), it may be helpful.

ghost commented 3 years ago

Edit: I couldn't run the build locally without disabling openfec, but it runs fine with docker, so that's resolved for me!

gavv commented 3 years ago

Edit: I couldn't run the build locally without disabling openfec, but it runs fine with docker, so that's resolved for me!

Feel free to post build logs when you run build locally, ideally it should be possible to build without docker too.

gavv commented 3 years ago

Landed!