Skip to content

Commit

Permalink
Migration to uint32 for Audio Sample Rate
Browse files Browse the repository at this point in the history
  • Loading branch information
Laky-64 committed Sep 22, 2023
1 parent 2f0d776 commit 2f97392
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/go/ntgcalls/audio_description.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import "C"
type AudioDescription struct {
InputMode InputMode
Input string
SampleRate uint16
SampleRate uint32
BitsPerSample, ChannelCount uint8
}

func (ctx *AudioDescription) ParseToC() C.ntg_audio_description_struct {
var x C.ntg_audio_description_struct
x.inputMode = ctx.InputMode.ParseToC()
x.input = C.CString(ctx.Input)
x.sampleRate = C.uint16_t(ctx.SampleRate)
x.sampleRate = C.uint32_t(ctx.SampleRate)
x.bitsPerSample = C.uint8_t(ctx.BitsPerSample)
x.channelCount = C.uint8_t(ctx.ChannelCount)
return x
Expand Down
2 changes: 1 addition & 1 deletion include/ntgcalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ typedef enum {
typedef struct {
ntg_input_mode_enum inputMode;
char* input;
uint16_t sampleRate;
uint32_t sampleRate;
uint8_t bitsPerSample, channelCount;
} ntg_audio_description_struct;

Expand Down
2 changes: 1 addition & 1 deletion ntgcalls/media/audio_streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace ntgcalls {
return ((rate * bps) / 8 / 100) * channels;
}

void AudioStreamer::setConfig(uint16_t sampleRate, uint8_t bitsPerSample, uint8_t channelCount) {
void AudioStreamer::setConfig(uint32_t sampleRate, uint8_t bitsPerSample, uint8_t channelCount) {
clear();
bps = bitsPerSample;
rate = sampleRate;
Expand Down
4 changes: 2 additions & 2 deletions ntgcalls/media/audio_streamer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ntgcalls {
private:
std::shared_ptr<wrtc::RTCAudioSource> audio;
uint8_t bps = 0, channels = 0;
uint16_t rate = 0;
uint32_t rate = 0;

std::chrono::nanoseconds frameTime() override;

Expand All @@ -33,6 +33,6 @@ namespace ntgcalls {

uint64_t frameSize() override;

void setConfig(uint16_t sampleRate, uint8_t bitsPerSample, uint8_t channelCount);
void setConfig(uint32_t sampleRate, uint8_t bitsPerSample, uint8_t channelCount);
};
}
4 changes: 2 additions & 2 deletions ntgcalls/models/media_description.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ namespace ntgcalls {

class AudioDescription: public BaseMediaDescription {
public:
uint16_t sampleRate;
uint32_t sampleRate;
uint8_t bitsPerSample, channelCount;

AudioDescription(InputMode inputMode, uint16_t sampleRate, uint8_t bitsPerSample, uint8_t channelCount, std::string input):
AudioDescription(InputMode inputMode, uint32_t sampleRate, uint8_t bitsPerSample, uint8_t channelCount, std::string input):
sampleRate(sampleRate), bitsPerSample(bitsPerSample), channelCount(channelCount), BaseMediaDescription(input, inputMode) {};
};

Expand Down

0 comments on commit 2f97392

Please sign in to comment.