MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / writeSamples

Method writeSamples

Transceiver52M/UHDDevice.cpp:798–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

796}
797
798int uhd_device::writeSamples(short *buf, int len, bool *underrun,
799 unsigned long long timestamp,bool isControl)
800{
801 uhd::tx_metadata_t metadata;
802 metadata.has_time_spec = true;
803 metadata.start_of_burst = false;
804 metadata.end_of_burst = false;
805 metadata.time_spec = convert_time(timestamp, tx_rate);
806
807 *underrun = false;
808
809 // No control packets
810 if (isControl) {
811 LOG(ERR) << "Control packets not supported";
812 return 0;
813 }
814
815 // Drop a fixed number of packets (magic value)
816 if (!aligned) {
817 drop_cnt++;
818
819 if (drop_cnt == 1) {
820 LOG(DEBUG) << "Aligning transmitter: stop burst";
821 *underrun = true;
822 metadata.end_of_burst = true;
823 } else if (drop_cnt < 30) {
824 LOG(DEBUG) << "Aligning transmitter: packet advance";
825 return len;
826 } else {
827 LOG(DEBUG) << "Aligning transmitter: start burst";
828 metadata.start_of_burst = true;
829 aligned = true;
830 drop_cnt = 0;
831 }
832 }
833
834 size_t num_smpls = tx_stream->send(buf, len, metadata);
835
836 if (num_smpls != (unsigned) len) {
837 LOG(ALERT) << "UHD: Device send timed out";
838 LOG(ALERT) << "UHD: Version " << uhd::get_version_string();
839 LOG(ALERT) << "UHD: Unrecoverable error, exiting...";
840 exit(-1);
841 }
842
843 return num_smpls;
844}
845
846bool uhd_device::updateAlignment(TIMESTAMP timestamp)
847{

Callers 3

pushBufferMethod · 0.45
mainFunction · 0.45
pushBufferMethod · 0.45

Calls 1

convert_timeFunction · 0.85

Tested by

no test coverage detected