SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
udpsinkfec.h
Go to the documentation of this file.
1 // Copyright (C) 2017 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef PLUGINS_SAMPLESINK_REMOTEOUTPUT_UDPSINKFEC_H_
19 #define PLUGINS_SAMPLESINK_REMOTEOUTPUT_UDPSINKFEC_H_
20 
22 #include <string.h>
23 #include <cstddef>
24 
25 #include <QObject>
26 #include <QHostAddress>
27 #include <QString>
28 
29 #include "dsp/dsptypes.h"
30 #include "util/CRC64.h"
31 
32 class UDPSinkFECWorker;
33 
34 class UDPSinkFEC : public QObject
35 {
36  Q_OBJECT
37 public:
38  static const uint32_t m_udpSize = 512;
39  static const uint32_t m_nbOriginalBlocks = 128;
40 
44  UDPSinkFEC();
45 
47  ~UDPSinkFEC();
48 
49  void start();
50  void stop();
51 
55  void write(const SampleVector::iterator& begin, uint32_t sampleChunkSize);
56 
58  std::string error()
59  {
60  std::string ret(m_error);
61  m_error.clear();
62  return ret;
63  }
64 
66  void setSampleRate(uint32_t sampleRate);
67 
68  void setNbBlocksFEC(uint32_t nbBlocksFEC);
69  void setTxDelay(float txDelayRatio);
70  void setRemoteAddress(const QString& address, uint16_t port);
71 
73  operator bool() const
74  {
75  return m_error.empty();
76  }
77 
78 private:
79  std::string m_error;
80 
83 
84  QHostAddress m_ownAddress;
85 
89 
100 
104 };
105 
106 #endif /* PLUGINS_SAMPLESINK_REMOTEOUTPUT_UDPSINKFEC_H_ */
uint32_t m_sampleRate
sample rate in Hz
Definition: udpsinkfec.h:81
void setTxDelay(float txDelayRatio)
Definition: udpsinkfec.cpp:74
QHostAddress m_ownAddress
Definition: udpsinkfec.h:84
int m_txBlocksIndex
Current index of Tx blocks row.
Definition: udpsinkfec.h:97
uint16_t m_remotePort
Definition: udpsinkfec.h:103
void setRemoteAddress(const QString &address, uint16_t port)
Definition: udpsinkfec.cpp:101
int m_sampleIndex
Current sample index in protected block data.
Definition: udpsinkfec.h:99
uint32_t m_txDelay
Delay in microseconds (usleep) between each sending of an UDP datagram.
Definition: udpsinkfec.h:93
void stop()
Definition: udpsinkfec.cpp:64
void write(const SampleVector::iterator &begin, uint32_t sampleChunkSize)
Definition: udpsinkfec.cpp:112
float m_txDelayRatio
Delay in ratio of nominal frame period.
Definition: udpsinkfec.h:92
std::string error()
Definition: udpsinkfec.h:58
QString m_remoteAddress
Definition: udpsinkfec.h:102
unsigned int uint32_t
Definition: rtptypes_win.h:46
std::string m_error
Definition: udpsinkfec.h:79
uint8_t * m_bufMeta
Definition: udpsinkfec.h:87
Definition: CRC64.h:25
CRC64 m_crc64
Definition: udpsinkfec.h:86
unsigned char uint8_t
Definition: rtptypes_win.h:42
RemoteMetaDataFEC m_currentMetaFEC
Meta data for current frame.
Definition: udpsinkfec.h:90
unsigned short uint16_t
Definition: rtptypes_win.h:44
uint32_t m_nbSamples
total number of samples sent int the last frame
Definition: udpsinkfec.h:82
RemoteSuperBlock m_txBlocks[4][256]
UDP blocks to send with original data + FEC.
Definition: udpsinkfec.h:94
void start()
Definition: udpsinkfec.cpp:57
static const uint32_t m_nbOriginalBlocks
Number of original blocks in a protected block sequence.
Definition: udpsinkfec.h:39
RemoteSuperBlock m_superBlock
current super block being built
Definition: udpsinkfec.h:95
static const uint32_t m_udpSize
Size of UDP block in number of bytes.
Definition: udpsinkfec.h:38
UDPSinkFECWorker * m_udpWorker
Definition: udpsinkfec.h:101
int m_txBlockIndex
Current index in blocks to transmit in the Tx row.
Definition: udpsinkfec.h:96
void setNbBlocksFEC(uint32_t nbBlocksFEC)
Definition: udpsinkfec.cpp:87
uint16_t m_frameCount
transmission frame count
Definition: udpsinkfec.h:98
uint8_t * m_buf
Definition: udpsinkfec.h:88
void setSampleRate(uint32_t sampleRate)
Definition: udpsinkfec.cpp:94
uint32_t m_nbBlocksFEC
Variable number of FEC blocks.
Definition: udpsinkfec.h:91