diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DabMultiplexer.cpp | 21 | ||||
-rw-r--r-- | src/DabMultiplexer.h | 14 |
2 files changed, 27 insertions, 8 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index b1f2c75..c402d84 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -142,6 +142,9 @@ void DabMultiplexer::prepare(bool require_tai_clock) offset_ms -= 24; } + mnsc_increment_time = false; + mnsc_time = m_edi_time; + etiLog.log(info, "Startup CIF Count %i with timestamp: %d + %f", m_currentFrame, m_edi_time, (m_timestamp & 0xFFFFFF) / 16384000.0); @@ -393,6 +396,9 @@ void DabMultiplexer::increment_timestamp() if (m_timestamp > 0xf9FFff) { m_timestamp -= 0xfa0000; // Substract 16384000, corresponding to one second m_edi_time += 1; + + // Also update MNSC time for next time FP==0 + mnsc_increment_time = true; } } @@ -554,14 +560,9 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs eoh->MNSC = 0; - if (fc->FP == 0) { - // update the latched time only when FP==0 to ensure MNSC encodes - // a consistent time - m_edi_time_latched_for_mnsc = edi_time; - } - struct tm time_tm; - gmtime_r(&m_edi_time_latched_for_mnsc, &time_tm); + gmtime_r(&mnsc_time, &time_tm); + switch (fc->FP & 0x3) { case 0: { @@ -571,6 +572,12 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs mnsc->identifier = 0; mnsc->rfa = 0; } + + if (mnsc_increment_time) + { + mnsc_increment_time = false; + mnsc_time += 1; + } break; case 1: { diff --git a/src/DabMultiplexer.h b/src/DabMultiplexer.h index 44155dc..89d547e 100644 --- a/src/DabMultiplexer.h +++ b/src/DabMultiplexer.h @@ -88,7 +88,19 @@ class DabMultiplexer : public RemoteControllable { uint32_t m_timestamp = 0; std::time_t m_edi_time = 0; - std::time_t m_edi_time_latched_for_mnsc = 0; + + /* Pre v3 odr-dabmux did the MNSC calculation differently, + * which works with the easydabv2. The rework in odr-dabmux, + * deriving MNSC time from EDI time broke this. + * + * That's why we're now tracking MNSC time in separate variables, + * to get the same behaviour back. + * + * I'm not aware of any devices using MNSC time besides the + * easydab. ODR-DabMod now considers EDI seconds or ZMQ metadata. + */ + bool mnsc_increment_time = false; + std::time_t mnsc_time = 0; edi::configuration_t edi_conf; std::shared_ptr<edi::Sender> edi_sender; |