From 4f205c893dde4298e61b5f6b22dda48a62665cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joni=20R=C3=A4s=C3=A4nen?= Date: Mon, 19 Sep 2022 14:43:08 +0300 Subject: [PATCH] common: Use correct name for numerator --- docs/README.md | 4 ++-- include/uvgrtp/media_stream.hh | 2 +- include/uvgrtp/util.hh | 18 ++++++------------ src/formats/media.cc | 4 ++-- src/frame_queue.hh | 6 +++--- src/media_stream.cc | 14 +++++++------- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/docs/README.md b/docs/README.md index 34d7ae1..8c00df7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -105,8 +105,8 @@ stream->configure_ctx(RCC_PKT_MAX_DELAY, 150); | RCC_DYN_PAYLOAD_TYPE | Override uvgRTP's default payload number used in RTP headers | Format-specific, see [util.hh](/include/uvgrtp/util.hh) | Both | | RCC_CLOCK_RATE | Override uvgRTP's default clock rate used to calculate RTP timestamps | Format-specific, see [RFC 3551](https://www.rfc-editor.org/rfc/rfc3551#section-6) | Sender | | RCC_MTU_SIZE | Set the Maximum Transmission Unit (MTU) value. uvgRTP assumes the presence of UDP header (8 bytes) and IP header (20 bytes for IPv4). Those are substracted those from the given value. | 1492 bytes | Both | -| RCC_FPS_ENUMERATOR | Set the fps used with RCE_FRAMERATE and RCE_FRAGMENT_PACING. | 30 | Sender | -| RCC_FPS_DENOMINATOR | Use this in combination with RCC_FPS_ENUMERATOR if you need fractional fps values | 1 | Sender | +| RCC_FPS_NUMERATOR | Set the fps used with RCE_FRAMERATE and RCE_FRAGMENT_PACING. | 30 | Sender | +| RCC_FPS_DENOMINATOR | Use this in combination with RCC_FPS_NUMERATOR if you need fractional fps values | 1 | Sender | ### RTP frame flags diff --git a/include/uvgrtp/media_stream.hh b/include/uvgrtp/media_stream.hh index af13b7a..dced01d 100644 --- a/include/uvgrtp/media_stream.hh +++ b/include/uvgrtp/media_stream.hh @@ -343,7 +343,7 @@ namespace uvgrtp { std::string cname_; - ssize_t fps_enumerator_ = 30; + ssize_t fps_numerator_ = 30; ssize_t fps_denominator_ = 1; }; } diff --git a/include/uvgrtp/util.hh b/include/uvgrtp/util.hh index 1cb4d62..9920e37 100644 --- a/include/uvgrtp/util.hh +++ b/include/uvgrtp/util.hh @@ -322,25 +322,19 @@ enum RTP_CTX_CONFIGURATION_FLAGS { * to use jumbo frames, it can set the MTU size to 9000 bytes */ RCC_MTU_SIZE = 7, - /** Set the enumerator of frame rate enforced by uvgRTP. + /** Set the numerator of frame rate enforced by uvgRTP. * * Default is 30. * - * Setting a positive value enables this functionality. Setting it to 0 or less, disables it. - * * The fps API paces the sending of the RTP packets so that receiver is under less - * strain to receive all. Setting this is not neccessary for small frame sizes, - * but even then it makes the stream smoother. The cost is at most one frame extra latency. */ - RCC_FPS_ENUMERATOR = 8, + * strain to receive all. Setting this is not neccessary for small frame sizes. + * The cost is at most one frame extra latency. */ + RCC_FPS_NUMERATOR = 8, + RCC_FPS_ENUMERATOR = 8, // wrong name /** Set the denominator of frame rate enforced by uvgRTP. * - * Default is 1. - * - * Setting a positive value enables this functionality. Setting it to 0 or less, disables it. - * - * Setting the denominator is only necessary for fractional fps values as setting the enumerator - * already enables the fps functionality. */ + * Default is 1 */ RCC_FPS_DENOMINATOR = 9, RCC_LAST diff --git a/src/formats/media.cc b/src/formats/media.cc index d23be93..deec210 100644 --- a/src/formats/media.cc +++ b/src/formats/media.cc @@ -186,7 +186,7 @@ rtp_error_t uvgrtp::formats::media::packet_handler(void *arg, int rce_flags, uvg return RTP_OK; } -void uvgrtp::formats::media::set_fps(ssize_t enumerator, ssize_t denominator) +void uvgrtp::formats::media::set_fps(ssize_t numerator, ssize_t denominator) { - fqueue_->set_fps(enumerator, denominator); + fqueue_->set_fps(numerator, denominator); } \ No newline at end of file diff --git a/src/frame_queue.hh b/src/frame_queue.hh index de65585..73668bf 100644 --- a/src/frame_queue.hh +++ b/src/frame_queue.hh @@ -145,12 +145,12 @@ namespace uvgrtp { * significant memory leaks */ void install_dealloc_hook(void (*dealloc_hook)(void *)); - void set_fps(ssize_t enumerator, ssize_t denominator) + void set_fps(ssize_t numerator, ssize_t denominator) { - fps_ = enumerator > 0 && denominator > 0; + fps_ = numerator > 0 && denominator > 0; if (denominator > 0) { - frame_interval_ = std::chrono::nanoseconds(uint64_t(1.0 / double(enumerator / denominator) * 1000*1000*1000)); + frame_interval_ = std::chrono::nanoseconds(uint64_t(1.0 / double(numerator / denominator) * 1000*1000*1000)); } fps_sync_point_ = std::chrono::high_resolution_clock::now(); } diff --git a/src/media_stream.cc b/src/media_stream.cc index c873735..7face71 100644 --- a/src/media_stream.cc +++ b/src/media_stream.cc @@ -44,7 +44,7 @@ uvgrtp::media_stream::media_stream(std::string cname, std::string remote_addr, media_(nullptr), holepuncher_(std::unique_ptr(new uvgrtp::holepuncher(socket_))), cname_(cname), - fps_enumerator_(30), + fps_numerator_(30), fps_denominator_(1) {} @@ -225,7 +225,7 @@ rtp_error_t uvgrtp::media_stream::create_media(rtp_format_t fmt) } // set default values for fps - media_->set_fps(fps_enumerator_, fps_denominator_); + media_->set_fps(fps_numerator_, fps_denominator_); return RTP_OK; } @@ -640,14 +640,14 @@ rtp_error_t uvgrtp::media_stream::configure_ctx(int rcc_flag, ssize_t value) reception_flow_->set_payload_size(value - (IPV4_HDR_SIZE + UDP_HDR_SIZE)); // largest packet we can get from socket break; } - case RCC_FPS_ENUMERATOR: { - fps_enumerator_ = value; + case RCC_FPS_NUMERATOR: { + fps_numerator_ = value; if (value > 0 && (rce_flags_ & RCE_SYSTEM_CALL_CLUSTERING)) { - UVG_LOG_WARN("Setting FPS enumerator will disable System Call Clustering (SCC)"); + UVG_LOG_WARN("Setting FPS numerator will disable System Call Clustering (SCC)"); } - media_->set_fps(fps_enumerator_, fps_denominator_); + media_->set_fps(fps_numerator_, fps_denominator_); break; } case RCC_FPS_DENOMINATOR: { @@ -657,7 +657,7 @@ rtp_error_t uvgrtp::media_stream::configure_ctx(int rcc_flag, ssize_t value) UVG_LOG_WARN("Setting FPS denominator will disable System Call Clustering (SCC)"); } - media_->set_fps(fps_enumerator_, fps_denominator_); + media_->set_fps(fps_numerator_, fps_denominator_); break; }