Skip to content

Commit

Permalink
expose hascongestion precent used
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroSG94 committed Oct 12, 2023
1 parent 1a19e74 commit cba3e76
Show file tree
Hide file tree
Showing 34 changed files with 192 additions and 36 deletions.
2 changes: 2 additions & 0 deletions library/src/main/java/com/pedro/library/base/Camera1Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,8 @@ public boolean reTry(long delay, String reason) {
//cache control
public abstract boolean hasCongestion();

public abstract boolean hasCongestion(float percentUsed);

public abstract void resizeCache(int newSize) throws RuntimeException;

public abstract int getCacheSize();
Expand Down
2 changes: 2 additions & 0 deletions library/src/main/java/com/pedro/library/base/Camera2Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,8 @@ public boolean reTry(long delay, String reason) {
//cache control
public abstract boolean hasCongestion();

public abstract boolean hasCongestion(float percentUsed);

public abstract void resizeCache(int newSize) throws RuntimeException;

public abstract int getCacheSize();
Expand Down
2 changes: 2 additions & 0 deletions library/src/main/java/com/pedro/library/base/DisplayBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ public boolean reTry(long delay, String reason) {
//cache control
public abstract boolean hasCongestion();

public abstract boolean hasCongestion(float percentUsed);

public abstract void resizeCache(int newSize) throws RuntimeException;

public abstract int getCacheSize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,8 @@ public boolean reTry(long delay, String reason) {
//cache control
public abstract boolean hasCongestion();

public abstract boolean hasCongestion(float percentUsed);

public abstract void resizeCache(int newSize) throws RuntimeException;

public abstract int getCacheSize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ public boolean reTry(long delay, String reason) {
//cache control
public abstract boolean hasCongestion();

public abstract boolean hasCongestion(float percentUsed);

public abstract void resizeCache(int newSize) throws RuntimeException;

public abstract int getCacheSize();
Expand Down
1 change: 1 addition & 0 deletions library/src/main/java/com/pedro/library/base/StreamBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ abstract class StreamBase(
protected abstract fun reConnect(delay: Long, backupUrl: String?)
abstract fun setReTries(reTries: Int)
abstract fun hasCongestion(): Boolean
abstract fun hasCongestion(percentUsed: Float = 20f): Boolean
abstract fun setLogs(enabled: Boolean)
abstract fun setCheckServerAlive(enabled: Boolean)
@Throws(RuntimeException::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,24 @@ public boolean hasCongestion(RtpType rtpType, int index) {
}
}

public boolean hasCongestion(RtpType rtpType, int index, int percentUsed) {
if (rtpType == RtpType.RTMP) {
return rtmpClients[index].hasCongestion(percentUsed);
} else {
return rtspClients[index].hasCongestion(percentUsed);
}
}

@Override
public boolean hasCongestion() {
return false;
}

@Override
public boolean hasCongestion(float percentUsed) {
return false;
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
for (RtmpClient rtmpClient: rtmpClients) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,24 @@ public boolean hasCongestion(RtpType rtpType, int index) {
}
}

public boolean hasCongestion(RtpType rtpType, int index, int percentUsed) {
if (rtpType == RtpType.RTMP) {
return rtmpClients[index].hasCongestion(percentUsed);
} else {
return rtspClients[index].hasCongestion(percentUsed);
}
}

@Override
public boolean hasCongestion() {
return false;
}

@Override
public boolean hasCongestion(float percentUsed) {
return false;
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
for (RtmpClient rtmpClient: rtmpClients) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,24 @@ public boolean hasCongestion(RtpType rtpType, int index) {
}
}

public boolean hasCongestion(RtpType rtpType, int index, int percentUsed) {
if (rtpType == RtpType.RTMP) {
return rtmpClients[index].hasCongestion(percentUsed);
} else {
return rtspClients[index].hasCongestion(percentUsed);
}
}

@Override
public boolean hasCongestion() {
return false;
}

@Override
public boolean hasCongestion(float percentUsed) {
return false;
}

public void resizeCache(RtpType rtpType, int index, int newSize) {
if (rtpType == RtpType.RTMP) {
rtmpClients[index].resizeCache(newSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,24 @@ public boolean hasCongestion(RtpType rtpType, int index) {
}
}

public boolean hasCongestion(RtpType rtpType, int index, int percentUsed) {
if (rtpType == RtpType.RTMP) {
return rtmpClients[index].hasCongestion(percentUsed);
} else {
return rtspClients[index].hasCongestion(percentUsed);
}
}

@Override
public boolean hasCongestion() {
return false;
}

@Override
public boolean hasCongestion(float percentUsed) {
return false;
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
for (RtmpClient rtmpClient: rtmpClients) {
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/rtmp/RtmpCamera1.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ public boolean hasCongestion() {
return rtmpClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtmpClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
rtmpClient.sendAudio(aacBuffer, info);
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/rtmp/RtmpCamera2.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ public boolean hasCongestion() {
return rtmpClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtmpClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
rtmpClient.sendAudio(aacBuffer, info);
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/rtmp/RtmpDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ public boolean hasCongestion() {
return rtmpClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtmpClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
rtmpClient.sendAudio(aacBuffer, info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ public boolean hasCongestion() {
return rtmpClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtmpClient.hasCongestion(percentUsed);
}

@Override
protected void onSpsPpsVpsRtp(ByteBuffer sps, ByteBuffer pps, ByteBuffer vps) {
rtmpClient.setVideoInfo(sps, pps, vps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public boolean hasCongestion() {
return rtmpClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtmpClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
rtmpClient.sendAudio(aacBuffer, info);
Expand Down
2 changes: 2 additions & 0 deletions library/src/main/java/com/pedro/library/rtmp/RtmpStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class RtmpStream(context: Context, connectCheckerRtmp: ConnectCheckerRtmp, video

override fun hasCongestion(): Boolean = rtmpClient.hasCongestion()

override fun hasCongestion(percentUsed: Float): Boolean = rtmpClient.hasCongestion(percentUsed)

override fun setLogs(enabled: Boolean) {
rtmpClient.setLogs(enabled)
}
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/rtsp/RtspCamera1.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ public boolean hasCongestion() {
return rtspClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtspClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
rtspClient.sendAudio(aacBuffer, info);
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/rtsp/RtspCamera2.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ public boolean hasCongestion() {
return rtspClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtspClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
rtspClient.sendAudio(aacBuffer, info);
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/rtsp/RtspDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ public boolean hasCongestion() {
return rtspClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtspClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
rtspClient.sendAudio(aacBuffer, info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ public boolean hasCongestion() {
return rtspClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtspClient.hasCongestion(percentUsed);
}

@Override
protected void onSpsPpsVpsRtp(ByteBuffer sps, ByteBuffer pps, ByteBuffer vps) {
rtspClient.setVideoInfo(sps, pps, vps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ public boolean hasCongestion() {
return rtspClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtspClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
rtspClient.sendAudio(aacBuffer, info);
Expand Down
2 changes: 2 additions & 0 deletions library/src/main/java/com/pedro/library/rtsp/RtspStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class RtspStream(context: Context, connectCheckerRtsp: ConnectCheckerRtsp, video
}

override fun hasCongestion(): Boolean = rtspClient.hasCongestion()

override fun hasCongestion(percentUsed: Float): Boolean = rtspClient.hasCongestion(percentUsed)

override fun setLogs(enabled: Boolean) {
rtspClient.setLogs(enabled)
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/srt/SrtCamera1.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public boolean hasCongestion() {
return srtClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return srtClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
srtClient.sendAudio(aacBuffer, info);
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/srt/SrtCamera2.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ public boolean hasCongestion() {
return srtClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return srtClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
srtClient.sendAudio(aacBuffer, info);
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/srt/SrtDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ public boolean hasCongestion() {
return rtmpClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return rtmpClient.hasCongestion(percentUsed);
}

@Override
protected void getAacDataRtp(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
rtmpClient.sendAudio(aacBuffer, info);
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/java/com/pedro/library/srt/SrtFromFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ public boolean hasCongestion() {
return srtClient.hasCongestion();
}

@Override
public boolean hasCongestion(float percentUsed) {
return srtClient.hasCongestion(percentUsed);
}

@Override
protected void onSpsPpsVpsRtp(ByteBuffer sps, ByteBuffer pps, ByteBuffer vps) {
srtClient.setVideoInfo(sps, pps, vps);
Expand Down
Loading

0 comments on commit cba3e76

Please sign in to comment.