common: Use correct name for numerator

This commit is contained in:
Joni Räsänen 2022-09-19 14:43:08 +03:00
parent 3b31367da4
commit 4f205c893d
6 changed files with 21 additions and 27 deletions

View File

@ -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

View File

@ -343,7 +343,7 @@ namespace uvgrtp {
std::string cname_;
ssize_t fps_enumerator_ = 30;
ssize_t fps_numerator_ = 30;
ssize_t fps_denominator_ = 1;
};
}

View File

@ -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

View File

@ -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);
}

View File

@ -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();
}

View File

@ -44,7 +44,7 @@ uvgrtp::media_stream::media_stream(std::string cname, std::string remote_addr,
media_(nullptr),
holepuncher_(std::unique_ptr<uvgrtp::holepuncher>(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;
}