Skip to content

Commit

Permalink
Bump roc to 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv committed Apr 30, 2024
1 parent 0fc745d commit c4ca25c
Show file tree
Hide file tree
Showing 12 changed files with 226 additions and 182 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/roc
Submodule roc updated 607 files
20 changes: 16 additions & 4 deletions common/enum_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ enum_map<PrInterface, roc_interface> interface_map {
{PR_INTERFACE_AUDIO_CONTROL, ROC_INTERFACE_AUDIO_CONTROL, "audioctl"},
};

enum_map<PrChannelSet, roc_channel_set> channel_set_map {
{PR_CHANNEL_SET_STEREO, ROC_CHANNEL_SET_STEREO, "stereo"},
enum_map<PrChannelLayout, roc_channel_layout> channel_layout_map {
{PR_CHANNEL_LAYOUT_MONO, ROC_CHANNEL_LAYOUT_MONO, "mono"},
{PR_CHANNEL_LAYOUT_STEREO, ROC_CHANNEL_LAYOUT_STEREO, "stereo"},
};

enum_map<PrPacketEncoding, roc_packet_encoding> packet_encoding_map {
{PR_PACKET_ENCODING_AVP_L16, ROC_PACKET_ENCODING_AVP_L16, "avp/l16"},
{
PR_PACKET_ENCODING_AVP_L16_MONO,
ROC_PACKET_ENCODING_AVP_L16_MONO,
"avp/l16/mono",
},
{
PR_PACKET_ENCODING_AVP_L16_STEREO,
ROC_PACKET_ENCODING_AVP_L16_STEREO,
"avp/l16/stereo",
},
};

enum_map<PrFecEncoding, roc_fec_encoding> fec_encoding_map {
Expand All @@ -32,12 +42,14 @@ enum_map<PrFecEncoding, roc_fec_encoding> fec_encoding_map {
};

enum_map<PrResamplerBackend, roc_resampler_backend> resampler_backend_map {
{PR_RESAMPLER_BACKEND_DEFAULT, ROC_RESAMPLER_BACKEND_DEFAULT, "default"},
{PR_RESAMPLER_BACKEND_BUILTIN, ROC_RESAMPLER_BACKEND_BUILTIN, "builtin"},
{PR_RESAMPLER_BACKEND_SPEEX, ROC_RESAMPLER_BACKEND_SPEEX, "speex"},
{PR_RESAMPLER_BACKEND_SPEEXDEC, ROC_RESAMPLER_BACKEND_SPEEXDEC, "speexdec"},
};

enum_map<PrResamplerProfile, roc_resampler_profile> resampler_profile_map {
{PR_RESAMPLER_PROFILE_DISABLE, ROC_RESAMPLER_PROFILE_DISABLE, "disable"},
{PR_RESAMPLER_PROFILE_DEFAULT, ROC_RESAMPLER_PROFILE_DEFAULT, "default"},
{PR_RESAMPLER_PROFILE_HIGH, ROC_RESAMPLER_PROFILE_HIGH, "high"},
{PR_RESAMPLER_PROFILE_MEDIUM, ROC_RESAMPLER_PROFILE_MEDIUM, "medium"},
{PR_RESAMPLER_PROFILE_LOW, ROC_RESAMPLER_PROFILE_LOW, "low"},
Expand Down
2 changes: 1 addition & 1 deletion common/enum_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ template <class E1, class E2>
using enum_map = std::vector<std::tuple<E1, E2, std::string>>;

extern enum_map<PrInterface, roc_interface> interface_map;
extern enum_map<PrChannelSet, roc_channel_set> channel_set_map;
extern enum_map<PrChannelLayout, roc_channel_layout> channel_layout_map;
extern enum_map<PrPacketEncoding, roc_packet_encoding> packet_encoding_map;
extern enum_map<PrFecEncoding, roc_fec_encoding> fec_encoding_map;
extern enum_map<PrResamplerBackend, roc_resampler_backend> resampler_backend_map;
Expand Down
10 changes: 7 additions & 3 deletions driver/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ aspl::DeviceParameters make_device_params(const DeviceInfo& info)

device_params.SampleRate = info.local_config.sample_rate;

switch (info.local_config.channel_set) {
case ROC_CHANNEL_SET_STEREO:
switch (info.local_config.channel_layout) {
case ROC_CHANNEL_LAYOUT_MONO:
device_params.ChannelCount = 1;
break;

case ROC_CHANNEL_LAYOUT_STEREO:
device_params.ChannelCount = 2;
break;

default:
throw std::runtime_error("selected channel_set not supported by device");
throw std::runtime_error("selected channel_layout not supported by device");
}

device_params.EnableMixing = true;
Expand Down
14 changes: 7 additions & 7 deletions driver/device_defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@ enum class DeviceType
struct DeviceLocalConfig
{
uint32_t sample_rate = 44100;
roc_channel_set channel_set = ROC_CHANNEL_SET_STEREO;
roc_channel_layout channel_layout = ROC_CHANNEL_LAYOUT_STEREO;
};

// Network parameters of sender device.
struct DeviceSenderConfig
{
roc_packet_encoding packet_encoding = ROC_PACKET_ENCODING_AVP_L16;
uint64_t packet_length_ns = 7'000'000; // 7ms
roc_packet_encoding packet_encoding = ROC_PACKET_ENCODING_AVP_L16_STEREO;
uint64_t packet_length_ns = 5'000'000; // 5ms

roc_fec_encoding fec_encoding = ROC_FEC_ENCODING_RS8M;
uint32_t fec_block_source_packets = 20;
uint32_t fec_block_source_packets = 18;
uint32_t fec_block_repair_packets = 10;
};

// Network parameters of sender device.
struct DeviceReceiverConfig
{
uint64_t target_latency_ns = 100'000'000; // 100ms
uint64_t target_latency_ns = 200'000'000; // 200ms

roc_resampler_backend resampler_backend = ROC_RESAMPLER_BACKEND_SPEEX;
roc_resampler_profile resampler_profile = ROC_RESAMPLER_PROFILE_MEDIUM;
roc_resampler_backend resampler_backend = ROC_RESAMPLER_BACKEND_DEFAULT;
roc_resampler_profile resampler_profile = ROC_RESAMPLER_PROFILE_DEFAULT;
};

// Device endpoint info.
Expand Down
10 changes: 5 additions & 5 deletions driver/rpc_serdes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ void device_info_from_rpc(DeviceInfo& out, const PrDeviceInfo& in)
}
}

if (in.local_config().has_channel_set()) {
out.local_config.channel_set = enum_from_rpc(
"channel_set", channel_set_map, in.local_config().channel_set());
if (in.local_config().has_channel_layout()) {
out.local_config.channel_layout = enum_from_rpc(
"channel_layout", channel_layout_map, in.local_config().channel_layout());
}

// sender config
Expand Down Expand Up @@ -250,8 +250,8 @@ void device_info_to_rpc(PrDeviceInfo& out, const DeviceInfo& in)

// local config
out.mutable_local_config()->set_sample_rate(in.local_config.sample_rate);
out.mutable_local_config()->set_channel_set(
enum_to_rpc("channel_set", channel_set_map, in.local_config.channel_set));
out.mutable_local_config()->set_channel_layout(enum_to_rpc(
"channel_layout", channel_layout_map, in.local_config.channel_layout));

// sender config
if (in.sender_config) {
Expand Down
Loading

0 comments on commit c4ca25c

Please sign in to comment.