Skip to content

Commit

Permalink
Add assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv committed May 6, 2024
1 parent 24d61bb commit 86c05c7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions driver/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ void Device::OnReadClientInput(const std::shared_ptr<aspl::Client>& client,
void* bytes,
UInt32 bytes_count)
{
assert(bytes);

const auto sample_ts = (uint64_t)timestamp;
const auto sample_ptr = (float*)bytes;
const auto sample_cnt = bytes_count / sizeof(float);
Expand Down Expand Up @@ -364,6 +366,8 @@ void Device::OnWriteMixedOutput(const std::shared_ptr<aspl::Stream>& stream,
const void* bytes,
UInt32 bytes_count)
{
assert(bytes);

const auto sample_ts = (uint64_t)timestamp;
const auto sample_ptr = (const float*)bytes;
const auto sample_cnt = bytes_count / sizeof(float);
Expand Down
5 changes: 5 additions & 0 deletions driver/receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <fmt/core.h>
#include <spdlog/spdlog.h>

#include <cassert>
#include <stdexcept>

namespace rocvad {

Receiver::Receiver(const std::string& uid,
Expand Down Expand Up @@ -135,6 +138,8 @@ void Receiver::resume() noexcept

void Receiver::read(float* samples, size_t n_samples) noexcept
{
assert(samples);

roc_frame frame;
memset(&frame, 0, sizeof(frame));

Expand Down
6 changes: 6 additions & 0 deletions driver/ring_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "ring_buffer.hpp"

#include <cassert>

namespace rocvad {

RingBuffer::RingBuffer(size_t n_samples)
Expand Down Expand Up @@ -37,6 +39,8 @@ void RingBuffer::write(uint64_t timestamp,
const float* samples,
size_t n_samples) noexcept
{
assert(samples);

// TODO
}

Expand All @@ -48,6 +52,8 @@ size_t RingBuffer::n_can_read(uint64_t timestamp) noexcept

void RingBuffer::read(uint64_t timestamp, float* samples, size_t n_samples) noexcept
{
assert(samples);

// TODO
}

Expand Down
5 changes: 5 additions & 0 deletions driver/sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <fmt/core.h>
#include <spdlog/spdlog.h>

#include <cassert>
#include <stdexcept>

namespace rocvad {

Sender::Sender(const std::string& uid,
Expand Down Expand Up @@ -138,6 +141,8 @@ void Sender::resume() noexcept

void Sender::write(const float* samples, size_t n_samples) noexcept
{
assert(samples);

roc_frame frame;
memset(&frame, 0, sizeof(frame));

Expand Down

0 comments on commit 86c05c7

Please sign in to comment.