Skip to content

Commit

Permalink
roc-streaminggh-688: Pass peak jitter instead of mean to RTCP and API
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv committed Aug 13, 2024
1 parent 7c7bcbd commit f326692
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/internal_modules/roc_pipeline/receiver_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ void ReceiverSession::generate_reports(const char* report_cname,
report.ext_last_seqnum = link_metrics.ext_last_seqnum;
report.packet_count = link_metrics.expected_packets;
report.cum_loss = link_metrics.lost_packets;
report.jitter = link_metrics.mean_jitter;
report.jitter = link_metrics.peak_jitter;
report.niq_latency = latency_metrics.niq_latency;
report.niq_stalling = latency_metrics.niq_stalling;
report.e2e_latency = latency_metrics.e2e_latency;
Expand All @@ -411,7 +411,7 @@ void ReceiverSession::generate_reports(const char* report_cname,
report.ext_last_seqnum = link_metrics.ext_last_seqnum;
report.packet_count = link_metrics.expected_packets;
report.cum_loss = link_metrics.lost_packets;
report.jitter = link_metrics.mean_jitter;
report.jitter = link_metrics.peak_jitter;

reports++;
n_reports--;
Expand Down
2 changes: 1 addition & 1 deletion src/internal_modules/roc_pipeline/sender_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ SenderSession::notify_send_stream(packet::stream_source_t recv_source_id,
link_metrics.ext_last_seqnum = recv_report.ext_last_seqnum;
link_metrics.expected_packets = recv_report.packet_count;
link_metrics.lost_packets = recv_report.cum_loss;
link_metrics.mean_jitter = recv_report.jitter;
link_metrics.peak_jitter = recv_report.jitter;
link_metrics.rtt = recv_report.rtt;

feedback_monitor_->process_feedback(recv_source_id, latency_metrics,
Expand Down
4 changes: 2 additions & 2 deletions src/public_api/src/adapters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ void link_metrics_to_user(roc_connection_metrics& out, const packet::LinkMetrics
out.rtt = (unsigned long long)in.rtt;
}

if (in.mean_jitter > 0) {
out.jitter = (unsigned long long)in.mean_jitter;
if (in.peak_jitter > 0) {
out.jitter = (unsigned long long)in.peak_jitter;
}

if (in.expected_packets > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_pipeline/test_helpers/control_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ControlWriter : public core::NonCopyable<> {
rr_blk.set_ssrc(remote_source_);
rr_blk.set_cum_loss(link_metrics_.lost_packets);
rr_blk.set_last_seqnum(link_metrics_.ext_last_seqnum);
rr_blk.set_jitter(sample_spec.ns_2_stream_timestamp(link_metrics_.mean_jitter));
rr_blk.set_jitter(sample_spec.ns_2_stream_timestamp(link_metrics_.peak_jitter));
rr_blk.set_last_sr(ntp_ts);
rr_blk.set_delay_last_sr(0);

Expand Down
6 changes: 3 additions & 3 deletions src/tests/roc_pipeline/test_loopback_sink_2_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void check_metrics(ReceiverSlot& receiver,
} else {
CHECK(recv_party_metrics.link.lost_packets == 0);
}
CHECK(recv_party_metrics.link.mean_jitter > 0);
CHECK(recv_party_metrics.link.peak_jitter > 0);

CHECK(recv_party_metrics.latency.niq_latency > 0);
CHECK(recv_party_metrics.latency.niq_stalling >= 0);
Expand Down Expand Up @@ -450,8 +450,8 @@ void check_metrics(ReceiverSlot& receiver,

UNSIGNED_LONGS_EQUAL(recv_party_metrics.link.lost_packets,
send_party_metrics.link.lost_packets);
CHECK(std::abs(recv_party_metrics.link.mean_jitter
- send_party_metrics.link.mean_jitter)
CHECK(std::abs(recv_party_metrics.link.peak_jitter
- send_party_metrics.link.peak_jitter)
< 1 * core::Millisecond);

DOUBLES_EQUAL(recv_party_metrics.latency.niq_latency,
Expand Down
4 changes: 2 additions & 2 deletions src/tests/roc_pipeline/test_receiver_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4027,7 +4027,7 @@ TEST(receiver_source, metrics_jitter) {
UNSIGNED_LONGS_EQUAL(1, party_metrics_size);

if (np > Latency / SamplesPerPacket) {
DOUBLES_EQUAL(jitter1, party_metrics.link.mean_jitter, precision);
DOUBLES_EQUAL(jitter1, party_metrics.link.peak_jitter, precision);
}
}
}
Expand All @@ -4053,7 +4053,7 @@ TEST(receiver_source, metrics_jitter) {
UNSIGNED_LONGS_EQUAL(1, party_metrics_size);

if (np > JitterMeterWindow) {
DOUBLES_EQUAL(jitter2, party_metrics.link.mean_jitter, precision);
DOUBLES_EQUAL(jitter2, party_metrics.link.peak_jitter, precision);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/tests/roc_pipeline/test_sender_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ TEST(sender_sink, metrics_feedback) {
link_metrics.ext_last_seqnum = seed * 200;
link_metrics.expected_packets = (seed * 200) - (seed * 100) + 1;
link_metrics.lost_packets = (int)seed * 40;
link_metrics.mean_jitter = (int)seed * core::Millisecond * 50;
link_metrics.peak_jitter = (int)seed * core::Millisecond * 50;

audio::LatencyMetrics latency_metrics;
latency_metrics.niq_latency = (int)seed * core::Millisecond * 50;
Expand Down Expand Up @@ -688,8 +688,8 @@ TEST(sender_sink, metrics_feedback) {
party_metrics[0].link.expected_packets);
UNSIGNED_LONGS_EQUAL(link_metrics.lost_packets,
party_metrics[0].link.lost_packets);
DOUBLES_EQUAL((double)link_metrics.mean_jitter,
(double)party_metrics[0].link.mean_jitter, core::Nanosecond);
DOUBLES_EQUAL((double)link_metrics.peak_jitter,
(double)party_metrics[0].link.peak_jitter, core::Nanosecond);

DOUBLES_EQUAL((double)latency_metrics.niq_latency,
(double)party_metrics[0].latency.niq_latency,
Expand Down

0 comments on commit f326692

Please sign in to comment.