From 1058316acd6aa9164cd7184bedfd6fae1506c9cc Mon Sep 17 00:00:00 2001 From: burak-58 Date: Mon, 21 Oct 2024 15:35:08 +0300 Subject: [PATCH] add encoding queue size setting --- src/main/java/io/antmedia/AppSettings.java | 14 ++++++++++++++ .../java/io/antmedia/test/AppSettingsUnitTest.java | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/antmedia/AppSettings.java b/src/main/java/io/antmedia/AppSettings.java index c9a5d0bd8..12684a3c0 100644 --- a/src/main/java/io/antmedia/AppSettings.java +++ b/src/main/java/io/antmedia/AppSettings.java @@ -2274,6 +2274,13 @@ public boolean isWriteStatsToDatastore() { @Value("${srtReceiveLatencyInMs:150}") private int srtReceiveLatencyInMs = 150; + /* + * The size of encoding queue to keep the frames waiting for encoding in Stream Adaptor + * default: 150 (5 seconds frame for 30 fps stream) + */ + @Value("${encodingQueueSize:150}") + private int encodingQueueSize = 150; + //Make sure you have a default constructor because it's populated by MongoDB public AppSettings() { try { @@ -3970,4 +3977,11 @@ public void setWebhookStreamStatusUpdatePeriodMs(long webhookStreamStatusUpdateP } + public int getEncodingQueueSize() { + return encodingQueueSize; + } + + public void setEncodingQueueSize(int encodingQueueSize) { + this.encodingQueueSize = encodingQueueSize; + } } diff --git a/src/test/java/io/antmedia/test/AppSettingsUnitTest.java b/src/test/java/io/antmedia/test/AppSettingsUnitTest.java index ebbf6ccf4..20dae44cc 100644 --- a/src/test/java/io/antmedia/test/AppSettingsUnitTest.java +++ b/src/test/java/io/antmedia/test/AppSettingsUnitTest.java @@ -642,6 +642,9 @@ public void testUnsetAppSettings(AppSettings appSettings) { assertEquals(-1, appSettings.getWebhookStreamStatusUpdatePeriodMs()); + assertEquals(150, appSettings.getEncodingQueueSize()); + appSettings.setEncodingQueueSize(200); + assertEquals(200, appSettings.getEncodingQueueSize()); //if we add a new field, we just need to check its default value in this test @@ -649,7 +652,7 @@ public void testUnsetAppSettings(AppSettings appSettings) { //by also checking its default value. assertEquals("New field is added to settings. PAY ATTENTION: Please CHECK ITS DEFAULT VALUE and fix the number of fields.", - 189, numberOfFields); + 190, numberOfFields); }