From da08b06d0bd46707275ac88ffffcf8fbef241278 Mon Sep 17 00:00:00 2001 From: pedro Date: Thu, 12 Oct 2023 20:54:11 +0200 Subject: [PATCH] add clear cache --- .../library/multiple/MultiRtpCamera1.java | 8 +++ .../library/multiple/MultiRtpCamera2.java | 8 +++ .../library/multiple/MultiRtpDisplay.java | 8 +++ .../library/multiple/MultiRtpOnlyAudio.java | 8 +++ .../com/pedro/library/rtmp/RtmpCamera1.java | 4 ++ .../com/pedro/library/rtmp/RtmpCamera2.java | 4 ++ .../com/pedro/library/rtmp/RtmpDisplay.java | 4 ++ .../com/pedro/library/rtmp/RtmpFromFile.java | 4 ++ .../com/pedro/library/rtmp/RtmpOnlyAudio.java | 4 ++ .../java/com/pedro/library/rtmp/RtmpStream.kt | 4 ++ .../com/pedro/library/rtsp/RtspCamera1.java | 4 ++ .../com/pedro/library/rtsp/RtspCamera2.java | 4 ++ .../com/pedro/library/rtsp/RtspDisplay.java | 4 ++ .../com/pedro/library/rtsp/RtspFromFile.java | 4 ++ .../com/pedro/library/rtsp/RtspOnlyAudio.java | 4 ++ .../java/com/pedro/library/rtsp/RtspStream.kt | 4 ++ .../com/pedro/library/srt/SrtCamera1.java | 4 ++ .../com/pedro/library/srt/SrtCamera2.java | 4 ++ .../com/pedro/library/srt/SrtDisplay.java | 58 ++++++++++--------- .../com/pedro/library/srt/SrtFromFile.java | 4 ++ .../com/pedro/library/srt/SrtOnlyAudio.java | 4 ++ .../java/com/pedro/library/srt/SrtStream.kt | 4 ++ .../java/com/pedro/rtmp/rtmp/RtmpClient.kt | 4 ++ .../java/com/pedro/rtmp/rtmp/RtmpSender.kt | 4 ++ .../java/com/pedro/rtsp/rtsp/RtspClient.kt | 4 ++ .../java/com/pedro/rtsp/rtsp/RtspSender.kt | 4 ++ .../main/java/com/pedro/srt/srt/SrtClient.kt | 4 ++ .../main/java/com/pedro/srt/srt/SrtSender.kt | 4 ++ 28 files changed, 155 insertions(+), 27 deletions(-) diff --git a/library/src/main/java/com/pedro/library/multiple/MultiRtpCamera1.java b/library/src/main/java/com/pedro/library/multiple/MultiRtpCamera1.java index c2c786b06..3fc2207dc 100644 --- a/library/src/main/java/com/pedro/library/multiple/MultiRtpCamera1.java +++ b/library/src/main/java/com/pedro/library/multiple/MultiRtpCamera1.java @@ -447,6 +447,14 @@ public boolean hasCongestion(RtpType rtpType, int index, int percentUsed) { } } + public void clearCache(RtpType rtpType, int index) { + if (rtpType == RtpType.RTMP) { + rtmpClients[index].clearCache(); + } else { + rtspClients[index].clearCache(); + } + } + @Override public boolean hasCongestion() { return false; diff --git a/library/src/main/java/com/pedro/library/multiple/MultiRtpCamera2.java b/library/src/main/java/com/pedro/library/multiple/MultiRtpCamera2.java index ee6f5d670..ba31e4484 100644 --- a/library/src/main/java/com/pedro/library/multiple/MultiRtpCamera2.java +++ b/library/src/main/java/com/pedro/library/multiple/MultiRtpCamera2.java @@ -447,6 +447,14 @@ public boolean hasCongestion(RtpType rtpType, int index, int percentUsed) { } } + public void clearCache(RtpType rtpType, int index) { + if (rtpType == RtpType.RTMP) { + rtmpClients[index].clearCache(); + } else { + rtspClients[index].clearCache(); + } + } + @Override public boolean hasCongestion() { return false; diff --git a/library/src/main/java/com/pedro/library/multiple/MultiRtpDisplay.java b/library/src/main/java/com/pedro/library/multiple/MultiRtpDisplay.java index 450e0525b..0d6f0af79 100644 --- a/library/src/main/java/com/pedro/library/multiple/MultiRtpDisplay.java +++ b/library/src/main/java/com/pedro/library/multiple/MultiRtpDisplay.java @@ -262,6 +262,14 @@ public boolean hasCongestion(RtpType rtpType, int index, int percentUsed) { } } + public void clearCache(RtpType rtpType, int index) { + if (rtpType == RtpType.RTMP) { + rtmpClients[index].clearCache(); + } else { + rtspClients[index].clearCache(); + } + } + @Override public boolean hasCongestion() { return false; diff --git a/library/src/main/java/com/pedro/library/multiple/MultiRtpOnlyAudio.java b/library/src/main/java/com/pedro/library/multiple/MultiRtpOnlyAudio.java index 3c2cd4d08..5d89c1794 100644 --- a/library/src/main/java/com/pedro/library/multiple/MultiRtpOnlyAudio.java +++ b/library/src/main/java/com/pedro/library/multiple/MultiRtpOnlyAudio.java @@ -369,6 +369,14 @@ public boolean hasCongestion(RtpType rtpType, int index, int percentUsed) { } } + public void clearCache(RtpType rtpType, int index) { + if (rtpType == RtpType.RTMP) { + rtmpClients[index].clearCache(); + } else { + rtspClients[index].clearCache(); + } + } + @Override public boolean hasCongestion() { return false; diff --git a/library/src/main/java/com/pedro/library/rtmp/RtmpCamera1.java b/library/src/main/java/com/pedro/library/rtmp/RtmpCamera1.java index c10fad354..5c5b58a3f 100644 --- a/library/src/main/java/com/pedro/library/rtmp/RtmpCamera1.java +++ b/library/src/main/java/com/pedro/library/rtmp/RtmpCamera1.java @@ -220,6 +220,10 @@ public boolean hasCongestion(float percentUsed) { return rtmpClient.hasCongestion(percentUsed); } + public void clearCache() { + rtmpClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { rtmpClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/rtmp/RtmpCamera2.java b/library/src/main/java/com/pedro/library/rtmp/RtmpCamera2.java index 0a64a0802..3f2ea7a2b 100644 --- a/library/src/main/java/com/pedro/library/rtmp/RtmpCamera2.java +++ b/library/src/main/java/com/pedro/library/rtmp/RtmpCamera2.java @@ -229,6 +229,10 @@ public boolean hasCongestion(float percentUsed) { return rtmpClient.hasCongestion(percentUsed); } + public void clearCache() { + rtmpClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { rtmpClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/rtmp/RtmpDisplay.java b/library/src/main/java/com/pedro/library/rtmp/RtmpDisplay.java index 2c3aaddbb..10cda66b9 100644 --- a/library/src/main/java/com/pedro/library/rtmp/RtmpDisplay.java +++ b/library/src/main/java/com/pedro/library/rtmp/RtmpDisplay.java @@ -187,6 +187,10 @@ public boolean hasCongestion() { return rtmpClient.hasCongestion(); } + public void clearCache() { + rtmpClient.clearCache(); + } + @Override public boolean hasCongestion(float percentUsed) { return rtmpClient.hasCongestion(percentUsed); diff --git a/library/src/main/java/com/pedro/library/rtmp/RtmpFromFile.java b/library/src/main/java/com/pedro/library/rtmp/RtmpFromFile.java index 0d92b26b9..56ecbbfcc 100644 --- a/library/src/main/java/com/pedro/library/rtmp/RtmpFromFile.java +++ b/library/src/main/java/com/pedro/library/rtmp/RtmpFromFile.java @@ -215,6 +215,10 @@ public boolean hasCongestion(float percentUsed) { return rtmpClient.hasCongestion(percentUsed); } + public void clearCache() { + rtmpClient.clearCache(); + } + @Override protected void onSpsPpsVpsRtp(ByteBuffer sps, ByteBuffer pps, ByteBuffer vps) { rtmpClient.setVideoInfo(sps, pps, vps); diff --git a/library/src/main/java/com/pedro/library/rtmp/RtmpOnlyAudio.java b/library/src/main/java/com/pedro/library/rtmp/RtmpOnlyAudio.java index d4417ec5e..b3283fca5 100644 --- a/library/src/main/java/com/pedro/library/rtmp/RtmpOnlyAudio.java +++ b/library/src/main/java/com/pedro/library/rtmp/RtmpOnlyAudio.java @@ -164,6 +164,10 @@ public boolean hasCongestion(float percentUsed) { return rtmpClient.hasCongestion(percentUsed); } + public void clearCache() { + rtmpClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { rtmpClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/rtmp/RtmpStream.kt b/library/src/main/java/com/pedro/library/rtmp/RtmpStream.kt index 0235e9df6..a0304bcc2 100644 --- a/library/src/main/java/com/pedro/library/rtmp/RtmpStream.kt +++ b/library/src/main/java/com/pedro/library/rtmp/RtmpStream.kt @@ -117,6 +117,10 @@ class RtmpStream(context: Context, connectCheckerRtmp: ConnectCheckerRtmp, video override fun hasCongestion(percentUsed: Float): Boolean = rtmpClient.hasCongestion(percentUsed) + fun clearCache() { + rtmpClient.clearCache() + } + override fun setLogs(enabled: Boolean) { rtmpClient.setLogs(enabled) } diff --git a/library/src/main/java/com/pedro/library/rtsp/RtspCamera1.java b/library/src/main/java/com/pedro/library/rtsp/RtspCamera1.java index 479abd475..583d5c393 100644 --- a/library/src/main/java/com/pedro/library/rtsp/RtspCamera1.java +++ b/library/src/main/java/com/pedro/library/rtsp/RtspCamera1.java @@ -186,6 +186,10 @@ public boolean hasCongestion(float percentUsed) { return rtspClient.hasCongestion(percentUsed); } + public void clearCache() { + rtspClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { rtspClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/rtsp/RtspCamera2.java b/library/src/main/java/com/pedro/library/rtsp/RtspCamera2.java index 0e6eeee3c..95255b6d5 100644 --- a/library/src/main/java/com/pedro/library/rtsp/RtspCamera2.java +++ b/library/src/main/java/com/pedro/library/rtsp/RtspCamera2.java @@ -195,6 +195,10 @@ public boolean hasCongestion(float percentUsed) { return rtspClient.hasCongestion(percentUsed); } + public void clearCache() { + rtspClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { rtspClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/rtsp/RtspDisplay.java b/library/src/main/java/com/pedro/library/rtsp/RtspDisplay.java index 128066124..db3c7dd66 100644 --- a/library/src/main/java/com/pedro/library/rtsp/RtspDisplay.java +++ b/library/src/main/java/com/pedro/library/rtsp/RtspDisplay.java @@ -158,6 +158,10 @@ public boolean hasCongestion(float percentUsed) { return rtspClient.hasCongestion(percentUsed); } + public void clearCache() { + rtspClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { rtspClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/rtsp/RtspFromFile.java b/library/src/main/java/com/pedro/library/rtsp/RtspFromFile.java index 07839e24b..6df70680b 100644 --- a/library/src/main/java/com/pedro/library/rtsp/RtspFromFile.java +++ b/library/src/main/java/com/pedro/library/rtsp/RtspFromFile.java @@ -182,6 +182,10 @@ public boolean hasCongestion(float percentUsed) { return rtspClient.hasCongestion(percentUsed); } + public void clearCache() { + rtspClient.clearCache(); + } + @Override protected void onSpsPpsVpsRtp(ByteBuffer sps, ByteBuffer pps, ByteBuffer vps) { rtspClient.setVideoInfo(sps, pps, vps); diff --git a/library/src/main/java/com/pedro/library/rtsp/RtspOnlyAudio.java b/library/src/main/java/com/pedro/library/rtsp/RtspOnlyAudio.java index 26483b889..173ade747 100644 --- a/library/src/main/java/com/pedro/library/rtsp/RtspOnlyAudio.java +++ b/library/src/main/java/com/pedro/library/rtsp/RtspOnlyAudio.java @@ -147,6 +147,10 @@ public boolean hasCongestion(float percentUsed) { return rtspClient.hasCongestion(percentUsed); } + public void clearCache() { + rtspClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { rtspClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/rtsp/RtspStream.kt b/library/src/main/java/com/pedro/library/rtsp/RtspStream.kt index 234b064bd..68d8fa3f0 100644 --- a/library/src/main/java/com/pedro/library/rtsp/RtspStream.kt +++ b/library/src/main/java/com/pedro/library/rtsp/RtspStream.kt @@ -86,6 +86,10 @@ class RtspStream(context: Context, connectCheckerRtsp: ConnectCheckerRtsp, video override fun hasCongestion(percentUsed: Float): Boolean = rtspClient.hasCongestion(percentUsed) + fun clearCache() { + rtspClient.clearCache() + } + override fun setLogs(enabled: Boolean) { rtspClient.setLogs(enabled) } diff --git a/library/src/main/java/com/pedro/library/srt/SrtCamera1.java b/library/src/main/java/com/pedro/library/srt/SrtCamera1.java index d8fd24f77..d49b41ec4 100644 --- a/library/src/main/java/com/pedro/library/srt/SrtCamera1.java +++ b/library/src/main/java/com/pedro/library/srt/SrtCamera1.java @@ -177,6 +177,10 @@ public boolean hasCongestion(float percentUsed) { return srtClient.hasCongestion(percentUsed); } + public void clearCache() { + srtClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { srtClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/srt/SrtCamera2.java b/library/src/main/java/com/pedro/library/srt/SrtCamera2.java index cd5034cbe..fd8d50399 100644 --- a/library/src/main/java/com/pedro/library/srt/SrtCamera2.java +++ b/library/src/main/java/com/pedro/library/srt/SrtCamera2.java @@ -186,6 +186,10 @@ public boolean hasCongestion(float percentUsed) { return srtClient.hasCongestion(percentUsed); } + public void clearCache() { + srtClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { srtClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/srt/SrtDisplay.java b/library/src/main/java/com/pedro/library/srt/SrtDisplay.java index 8e08ed1f4..8aa54d3ec 100644 --- a/library/src/main/java/com/pedro/library/srt/SrtDisplay.java +++ b/library/src/main/java/com/pedro/library/srt/SrtDisplay.java @@ -40,137 +40,141 @@ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public class SrtDisplay extends DisplayBase { - private final SrtClient rtmpClient; + private final SrtClient srtClient; public SrtDisplay(Context context, boolean useOpengl, ConnectCheckerSrt connectChecker) { super(context, useOpengl); - rtmpClient = new SrtClient(connectChecker); + srtClient = new SrtClient(connectChecker); } public void setVideoCodec(VideoCodec videoCodec) { recordController.setVideoMime( videoCodec == VideoCodec.H265 ? CodecUtil.H265_MIME : CodecUtil.H264_MIME); videoEncoder.setType(videoCodec == VideoCodec.H265 ? CodecUtil.H265_MIME : CodecUtil.H264_MIME); - rtmpClient.setVideoCodec(videoCodec); + srtClient.setVideoCodec(videoCodec); } @Override public void resizeCache(int newSize) throws RuntimeException { - rtmpClient.resizeCache(newSize); + srtClient.resizeCache(newSize); } @Override public int getCacheSize() { - return rtmpClient.getCacheSize(); + return srtClient.getCacheSize(); } @Override public long getSentAudioFrames() { - return rtmpClient.getSentAudioFrames(); + return srtClient.getSentAudioFrames(); } @Override public long getSentVideoFrames() { - return rtmpClient.getSentVideoFrames(); + return srtClient.getSentVideoFrames(); } @Override public long getDroppedAudioFrames() { - return rtmpClient.getDroppedAudioFrames(); + return srtClient.getDroppedAudioFrames(); } @Override public long getDroppedVideoFrames() { - return rtmpClient.getDroppedVideoFrames(); + return srtClient.getDroppedVideoFrames(); } @Override public void resetSentAudioFrames() { - rtmpClient.resetSentAudioFrames(); + srtClient.resetSentAudioFrames(); } @Override public void resetSentVideoFrames() { - rtmpClient.resetSentVideoFrames(); + srtClient.resetSentVideoFrames(); } @Override public void resetDroppedAudioFrames() { - rtmpClient.resetDroppedAudioFrames(); + srtClient.resetDroppedAudioFrames(); } @Override public void resetDroppedVideoFrames() { - rtmpClient.resetDroppedVideoFrames(); + srtClient.resetDroppedVideoFrames(); } @Override public void setAuthorization(String user, String password) { - rtmpClient.setAuthorization(user, password); + srtClient.setAuthorization(user, password); } @Override protected void prepareAudioRtp(boolean isStereo, int sampleRate) { - rtmpClient.setAudioInfo(sampleRate, isStereo); + srtClient.setAudioInfo(sampleRate, isStereo); } @Override protected void startStreamRtp(String url) { - rtmpClient.connect(url); + srtClient.connect(url); } @Override protected void stopStreamRtp() { - rtmpClient.disconnect(); + srtClient.disconnect(); } @Override public void setReTries(int reTries) { - rtmpClient.setReTries(reTries); + srtClient.setReTries(reTries); } @Override protected boolean shouldRetry(String reason) { - return rtmpClient.shouldRetry(reason); + return srtClient.shouldRetry(reason); } @Override public void reConnect(long delay, @Nullable String backupUrl) { - rtmpClient.reConnect(delay, backupUrl); + srtClient.reConnect(delay, backupUrl); } @Override public boolean hasCongestion() { - return rtmpClient.hasCongestion(); + return srtClient.hasCongestion(); } @Override public boolean hasCongestion(float percentUsed) { - return rtmpClient.hasCongestion(percentUsed); + return srtClient.hasCongestion(percentUsed); + } + + public void clearCache() { + srtClient.clearCache(); } @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { - rtmpClient.sendAudio(aacBuffer, info); + srtClient.sendAudio(aacBuffer, info); } @Override protected void onSpsPpsVpsRtp(ByteBuffer sps, ByteBuffer pps, ByteBuffer vps) { - rtmpClient.setVideoInfo(sps, pps, vps); + srtClient.setVideoInfo(sps, pps, vps); } @Override protected void getH264DataRtp(ByteBuffer h264Buffer, MediaCodec.BufferInfo info) { - rtmpClient.sendVideo(h264Buffer, info); + srtClient.sendVideo(h264Buffer, info); } @Override public void setLogs(boolean enable) { - rtmpClient.setLogs(enable); + srtClient.setLogs(enable); } @Override public void setCheckServerAlive(boolean enable) { - rtmpClient.setCheckServerAlive(enable); + srtClient.setCheckServerAlive(enable); } } diff --git a/library/src/main/java/com/pedro/library/srt/SrtFromFile.java b/library/src/main/java/com/pedro/library/srt/SrtFromFile.java index f80b967da..30e4fcb8d 100644 --- a/library/src/main/java/com/pedro/library/srt/SrtFromFile.java +++ b/library/src/main/java/com/pedro/library/srt/SrtFromFile.java @@ -172,6 +172,10 @@ public boolean hasCongestion(float percentUsed) { return srtClient.hasCongestion(percentUsed); } + public void clearCache() { + srtClient.clearCache(); + } + @Override protected void onSpsPpsVpsRtp(ByteBuffer sps, ByteBuffer pps, ByteBuffer vps) { srtClient.setVideoInfo(sps, pps, vps); diff --git a/library/src/main/java/com/pedro/library/srt/SrtOnlyAudio.java b/library/src/main/java/com/pedro/library/srt/SrtOnlyAudio.java index 79d477374..43e814fdb 100644 --- a/library/src/main/java/com/pedro/library/srt/SrtOnlyAudio.java +++ b/library/src/main/java/com/pedro/library/srt/SrtOnlyAudio.java @@ -137,6 +137,10 @@ public boolean hasCongestion(float percentUsed) { return srtClient.hasCongestion(percentUsed); } + public void clearCache() { + srtClient.clearCache(); + } + @Override protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) { srtClient.sendAudio(aacBuffer, info); diff --git a/library/src/main/java/com/pedro/library/srt/SrtStream.kt b/library/src/main/java/com/pedro/library/srt/SrtStream.kt index e137f7d0e..01bcedac0 100644 --- a/library/src/main/java/com/pedro/library/srt/SrtStream.kt +++ b/library/src/main/java/com/pedro/library/srt/SrtStream.kt @@ -93,6 +93,10 @@ class SrtStream(context: Context, connectCheckerRtmp: ConnectCheckerSrt, videoSo override fun hasCongestion(percentUsed: Float): Boolean = srtClient.hasCongestion(percentUsed) + fun clearCache() { + srtClient.clearCache() + } + override fun setLogs(enabled: Boolean) { srtClient.setLogs(enabled) } diff --git a/rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpClient.kt b/rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpClient.kt index e45af75a9..0eaa678d5 100644 --- a/rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpClient.kt +++ b/rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpClient.kt @@ -570,4 +570,8 @@ class RtmpClient(private val connectCheckerRtmp: ConnectCheckerRtmp) { fun setLogs(enable: Boolean) { rtmpSender.setLogs(enable) } + + fun clearCache() { + rtmpSender.clearCache() + } } diff --git a/rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpSender.kt b/rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpSender.kt index f668c4f64..4655b9000 100644 --- a/rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpSender.kt +++ b/rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpSender.kt @@ -207,6 +207,10 @@ class RtmpSender( return cacheSize } + fun clearCache() { + queue.clear() + } + fun getSentAudioFrames(): Long { return audioFramesSent } diff --git a/rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspClient.kt b/rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspClient.kt index 094eaac4c..bca46f8ba 100644 --- a/rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspClient.kt +++ b/rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspClient.kt @@ -464,4 +464,8 @@ class RtspClient(private val connectCheckerRtsp: ConnectCheckerRtsp) { fun setLogs(enable: Boolean) { rtspSender.setLogs(enable) } + + fun clearCache() { + rtspSender.clearCache() + } } \ No newline at end of file diff --git a/rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspSender.kt b/rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspSender.kt index eb66795da..59b67ed14 100644 --- a/rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspSender.kt +++ b/rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspSender.kt @@ -209,6 +209,10 @@ class RtspSender(private val connectCheckerRtsp: ConnectCheckerRtsp) { return cacheSize } + fun clearCache() { + queue.clear() + } + fun getSentAudioFrames(): Long { return audioFramesSent } diff --git a/srt/src/main/java/com/pedro/srt/srt/SrtClient.kt b/srt/src/main/java/com/pedro/srt/srt/SrtClient.kt index 8bcf88892..a6a498213 100644 --- a/srt/src/main/java/com/pedro/srt/srt/SrtClient.kt +++ b/srt/src/main/java/com/pedro/srt/srt/SrtClient.kt @@ -388,4 +388,8 @@ class SrtClient(private val connectCheckerSrt: ConnectCheckerSrt) { fun setLogs(enable: Boolean) { srtSender.setLogs(enable) } + + fun clearCache() { + srtSender.clearCache() + } } \ No newline at end of file diff --git a/srt/src/main/java/com/pedro/srt/srt/SrtSender.kt b/srt/src/main/java/com/pedro/srt/srt/SrtSender.kt index 33a38e6f4..dbbe9f336 100644 --- a/srt/src/main/java/com/pedro/srt/srt/SrtSender.kt +++ b/srt/src/main/java/com/pedro/srt/srt/SrtSender.kt @@ -241,6 +241,10 @@ class SrtSender( return cacheSize } + fun clearCache() { + queue.clear() + } + fun getSentAudioFrames(): Long { return audioFramesSent }