diff --git a/src/merge/timestamp_calculator.cpp b/src/merge/timestamp_calculator.cpp index 37776d02e..6b0d1fefd 100644 --- a/src/merge/timestamp_calculator.cpp +++ b/src/merge/timestamp_calculator.cpp @@ -45,10 +45,17 @@ timestamp_calculator_c::add_timestamp(timestamp_c const ×tamp, void timestamp_calculator_c::add_timestamp(int64_t timestamp, boost::optional stream_position) { - if (-1 != timestamp) + if (0 <= timestamp) add_timestamp(timestamp_c::ns(timestamp), stream_position); } +void +timestamp_calculator_c::add_timestamp(boost::optional const ×tamp, + boost::optional stream_position) { + if (timestamp && (0 <= *timestamp)) + add_timestamp(timestamp_c::ns(*timestamp), stream_position); +} + void timestamp_calculator_c::add_timestamp(packet_cptr const &packet, boost::optional stream_position) { diff --git a/src/merge/timestamp_calculator.h b/src/merge/timestamp_calculator.h index 6e06705fe..06e47410c 100644 --- a/src/merge/timestamp_calculator.h +++ b/src/merge/timestamp_calculator.h @@ -34,6 +34,7 @@ private: public: timestamp_calculator_c(int64_t samples_per_second); + void add_timestamp(boost::optional const ×tamp, boost::optional stream_position = boost::none); void add_timestamp(timestamp_c const ×tamp, boost::optional stream_position = boost::none); void add_timestamp(int64_t timestamp, boost::optional stream_position = boost::none); void add_timestamp(packet_cptr const &packet, boost::optional stream_position = boost::none);