summaryrefslogtreecommitdiffstats
path: root/src/input/Edi.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-09-23 14:44:45 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-09-23 14:44:45 +0200
commit907534bccee046c0499e9f936873c229b247ef95 (patch)
tree07f6995d0c8614f80a920f86660809b2fbd79b2b /src/input/Edi.h
parent015427d9e74f34dc7d0f7fbad4ad1eaad6537cce (diff)
downloaddabmux-907534bccee046c0499e9f936873c229b247ef95.tar.gz
dabmux-907534bccee046c0499e9f936873c229b247ef95.tar.bz2
dabmux-907534bccee046c0499e9f936873c229b247ef95.zip
Add buffermanagement setting to RC
Diffstat (limited to 'src/input/Edi.h')
-rw-r--r--src/input/Edi.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/input/Edi.h b/src/input/Edi.h
index 56bbf65..0a44139 100644
--- a/src/input/Edi.h
+++ b/src/input/Edi.h
@@ -46,7 +46,7 @@ namespace Inputs {
*
* This way, the EDI decoding happens in a separate thread.
*/
-class Edi : public InputBase {
+class Edi : public InputBase, public RemoteControllable {
public:
Edi(const std::string& name);
Edi(const Edi&) = delete;
@@ -59,6 +59,10 @@ class Edi : public InputBase {
virtual int setBitrate(int bitrate);
virtual void close();
+ /* Remote control */
+ virtual void set_parameter(const std::string& parameter, const std::string& value);
+ virtual const std::string get_parameter(const std::string& parameter) const;
+
protected:
void m_run();
@@ -75,12 +79,29 @@ class Edi : public InputBase {
std::atomic<bool> m_running = ATOMIC_VAR_INIT(false);
ThreadsafeQueue<EdiDecoder::sti_frame_t> m_frames;
+ std::mutex m_rc_params_mutex;
+ // InputBase defines bufferManagement, which must also be guarded by that mutex
+
// Used in timestamp-based buffer management
EdiDecoder::sti_frame_t m_pending_sti_frame;
- // Used in prebuffering-based buffer management
+ // State variable used in prebuffering-based buffer management
bool m_is_prebuffering = true;
+ /* When using prebuffering, consider the buffer to be full on the
+ * receive side if it's above the overrun threshold.
+ *
+ * When using timestamping, start discarding the front of the queue once the queue
+ * is this full. Must be smaller than m_max_frames_queued.
+ *
+ * Parameter 'buffer' inside RC. */
+ std::atomic<size_t> m_max_frames_overrun = ATOMIC_VAR_INIT(1000);
+
+ /* When not using timestamping, how many frames to prebuffer.
+ * Parameter 'prebuffering' inside RC. */
+ std::atomic<size_t> m_num_frames_prebuffering = ATOMIC_VAR_INIT(10);
+
+
std::string m_name;
InputStat m_stats;
};