Skip to content

Commit

Permalink
forgot scons fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrick87 committed Feb 29, 2024
1 parent 783d9c7 commit f765cfd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/internal_modules/roc_audio/sample_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ bool SampleSpec::is_valid() const {
}

bool SampleSpec::is_empty() const {
return sample_fmt_ == SampleFormat_Invalid
&& pcm_fmt_ == PcmFormat_Invalid
return sample_fmt_ == SampleFormat_Invalid && pcm_fmt_ == PcmFormat_Invalid
&& sample_rate_ == 0 && channel_set_.num_channels() == 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ SoxSource::SoxSource(core::IArena& arena, const Config& config)
}

frame_length_ = config.frame_length;

sample_spec_ = config.sample_spec;

sample_spec_ = config.sample_spec;

if (frame_length_ == 0) {
roc_log(LogError, "sox source: frame length is zero");
Expand Down Expand Up @@ -116,7 +115,7 @@ void SoxSource::pause() {
roc_log(LogDebug, "sox source: pausing: driver=%s input=%s", driver_name_.c_str(),
input_name_.c_str());

if(!is_file_){
if (!is_file_) {
close_();
}

Expand Down Expand Up @@ -160,7 +159,7 @@ bool SoxSource::restart() {
return false;
}
} else {
if(is_file_){
if (is_file_) {
sample_spec_.clear();
}

Expand Down Expand Up @@ -363,13 +362,12 @@ bool SoxSource::open_() {
is_file_ = !(input_->handler.flags & SOX_FILE_DEVICE);

if (is_file_) {
if(!sample_spec_.is_empty()){
if (!sample_spec_.is_empty()) {
roc_log(LogError, "sox source: setting io encoding for files not supported");
return false;
}
sample_spec_ = sample_spec();
}
else{
} else {
if (input_->signal.channels != sample_spec_.num_channels()) {
roc_log(LogError,
"sox source: can't open: unsupported # of channels: "
Expand Down
2 changes: 1 addition & 1 deletion src/internal_modules/roc_sndio/wav_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace roc {
namespace sndio {

WavSource::WavSource(core::IArena& arena, const Config& config)
: file_opened_(false)
: file_opened_(false)
, eof_(false)
, valid_(false) {
if (config.latency != 0) {
Expand Down
6 changes: 2 additions & 4 deletions src/tests/roc_sndio/test_backend_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ TEST(backend_source, sample_rate_mismatch) {

IDevice* backend_device = backend.open_device(
DeviceType_Source, DriverType_File, "wav", file.path(), source_config, arena);

CHECK(backend_device == NULL);
}
}
Expand Down Expand Up @@ -329,7 +329,7 @@ TEST(backend_source, pause_restart) {
audio::Frame frame1(frame_data1, FrameSize * NumChans);

// TODO(gh-706): check state

CHECK(backend_source->read(frame1));

backend_source->pause();
Expand Down Expand Up @@ -357,8 +357,6 @@ TEST(backend_source, pause_restart) {
CHECK(backend_source->read(frame2));
}



if (memcmp(frame_data1, frame_data2, sizeof(frame_data1)) != 0) {
FAIL("frames should be equal");
}
Expand Down

0 comments on commit f765cfd

Please sign in to comment.