Agora
1.2.0
Agora project
|
Go to the documentation of this file.
5 #ifndef RX_STATUS_TRACKER_H_
6 #define RX_STATUS_TRACKER_H_
27 tracker.sample_offset_ = 0;
28 tracker.rx_packet_memory_ =
nullptr;
32 void Reset(std::vector<RxPacket*> new_packets) {
37 tracker.sample_offset_ = 0;
38 tracker.rx_packet_memory_ = new_packets.at(
i);
44 std::vector<RxPacket*> new_packets;
46 new_packets.emplace_back(tracker.rx_packet_memory_);
53 void DiscardOld(
size_t new_samples,
long long sample_rx_start) {
54 const size_t num_bytes_in_sample =
sizeof(std::complex<int16_t>);
60 "DiscardOld - Shifting %zu samples to start. Ignoring %zu, Current "
61 "location %ld, Start Location %ld\n",
63 reinterpret_cast<intptr_t
>(buf_start));
64 ::memmove(buf_start, rx_loc, new_samples * num_bytes_in_sample);
67 Update(new_samples, sample_rx_start);
71 const size_t num_packets =
tracking_.size();
72 std::vector<RxPacket*> rx_packets;
73 rx_packets.reserve(num_packets);
74 for (
const auto& rx_channel :
tracking_) {
75 rx_packets.emplace_back(rx_channel.rx_packet_memory_);
81 void Update(
size_t new_samples,
long long sample_rx_start) {
85 "RxStatusTracker::Update - Expected samples start time to be 0\n");
90 if (is_continuous ==
false) {
92 "RxStatusTracker::Update - Available %zu Rx Start %lld, New Start "
95 throw std::runtime_error(
"Unexpected sample rx time");
101 tracker.sample_offset_ += new_samples;
102 RtAssert(tracker.rx_packet_memory_ !=
nullptr,
103 "RxStatusTracker::Update - Rx packet memory to be assigned\n");
109 bool has_continuity =
true;
111 const long long expected_start =
114 if (expected_start != sample_rx_start) {
115 has_continuity =
false;
118 return has_continuity;
126 const size_t num_locations =
tracking_.size();
127 std::vector<void*> rx_locations;
128 rx_locations.reserve(num_locations);
129 for (
const auto& rx_channel :
tracking_) {
130 rx_locations.emplace_back(
131 static_cast<void*
>(&
reinterpret_cast<std::complex<int16_t>*
>(
132 rx_channel.rx_packet_memory_->RawPacket()
133 ->data_)[rx_channel.sample_offset_]));
146 #endif // RX_STATUS_TRACKER_H_
size_t sample_offset_
Definition: rx_status_tracker.h:21
void DiscardOld(size_t new_samples, long long sample_rx_start)
Definition: rx_status_tracker.h:53
Definition: rx_status_tracker.h:19
std::vector< RxPacket * > GetRxPackets() const
Definition: rx_status_tracker.h:70
Self defined functions for message storage and passing.
for i
Definition: generate_data.m:107
Definition: rx_status_tracker.h:17
RxStatusTracker(size_t number_channels)
Definition: rx_status_tracker.h:24
std::vector< void * > GetRxPtrs() const
Definition: rx_status_tracker.h:125
std::vector< RxStatusPerChannelTracker > tracking_
Definition: rx_status_tracker.h:142
RxPacket * rx_packet_memory_
Definition: rx_status_tracker.h:20
void Update(size_t new_samples, long long sample_rx_start)
Definition: rx_status_tracker.h:81
size_t NumChannels() const
Definition: rx_status_tracker.h:122
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
Definition: rx_status_tracker.h:15
static void RtAssert(bool condition, const char *throw_str)
Definition: utils.h:104
#define AGORA_LOG_WARN(...)
Definition: logger.h:53
size_t samples_available_
Definition: rx_status_tracker.h:139
Definition: message.h:186
size_t SamplesAvailable() const
Definition: rx_status_tracker.h:121
void Reset()
Definition: rx_status_tracker.h:43
long long StartTime() const
Definition: rx_status_tracker.h:123
bool CheckContinuity(long long sample_rx_start) const
Definition: rx_status_tracker.h:108
long long sample_start_rx_time_
Definition: rx_status_tracker.h:140
void Reset(std::vector< RxPacket * > new_packets)
Definition: rx_status_tracker.h:32