Skip to content
Snippets Groups Projects
Commit 1178a1be authored by Leo Ma's avatar Leo Ma
Browse files

Adjust video frame cache size


Just cache GOP / FPS seconds data according to latency.

Signed-off-by: default avatarLeo Ma <begeekmyfriend@gmail.com>
parent d42d01a7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -12,10 +12,10 @@ the code does not depend on any native library.
 
You may watch the live broadcast at [srs.net](http://www.ossrs.net/players/srs_player.html). Remember to modify the URL by yourself. Have fun!
 
**NOTE** if you feel high lantancy, it might be the frame cache of the player.
So you need to open the player first and then publish to see the effect.
**NOTE** if you feel high latency, it might be the frame cache of the server and
player. So you need to open the player first and then publish to see the effect.
 
**NOTE2** since this project has been a bit popular, you would better not use
**NOTE2** since this project has been a bit popular, you had better NOT use the
default provided public URL such as `rtmp://ossrs.net:1935/live/sea`, try something
different like `rtmp://ossrs.net:1935/begeekmyfriend/puppydog` to avoid conflict.
Otherwise the server may well cut off the connection.
Loading
Loading
@@ -208,8 +208,9 @@ public class SrsEncoder {
}
public void onGetYuvFrame(byte[] data) {
// Check if the networking is good enough.
if (publisher.getVideoFrameCacheNumber() < VGOP * 2) {
// Check video frame cache number to judge the networking situation.
// Just cache GOP / FPS seconds data according to latency.
if (publisher.getVideoFrameCacheNumber() < VGOP) {
preProcessYuvFrame(data);
ByteBuffer[] inBuffers = vencoder.getInputBuffers();
ByteBuffer[] outBuffers = vencoder.getOutputBuffers();
Loading
Loading
@@ -551,4 +552,4 @@ public class SrsEncoder {
}
return sb.toString();
}
}
}
\ No newline at end of file
Loading
Loading
@@ -11,7 +11,7 @@ import net.ossrs.sea.rtmp.io.RtmpConnection;
*/
public class SrsRtmpPublisher implements RtmpPublisher {
 
private RtmpPublisher rtmpConnection;
private RtmpConnection rtmpConnection;
 
/**
* Constructor for URLs in the format: rtmp://host[:port]/application[?streamName]
Loading
Loading
@@ -68,10 +68,10 @@ public class SrsRtmpPublisher implements RtmpPublisher {
}
 
public final int getVideoFrameCacheNumber() {
return ((RtmpConnection) rtmpConnection).getVideoFrameCacheNumber();
return rtmpConnection.getVideoFrameCacheNumber();
}
 
public final String getRtmpUrl() {
return ((RtmpConnection) rtmpConnection).getRtmpUrl();
return rtmpConnection.getRtmpUrl();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment