I am using LibVLC version 3.0.0 to play incoming mpeg2ts stream over rtp on Android. The code is the following:
SurfaceView playerView; //Initialized somewhere before
LibVLC libVlc = new LibVLC(context, arrayListOf("--file-caching=150", "--network-caching=150",
"--clock-jitter=0", "--live-caching=150", "--clock-synchro=0",
"-vvv", "--drop-late-frames", "--skip-frames"));
MediaPlayer player = new MediaPlayer(libVlc);
IVLCVout vout = player.getVLCVout();
vout.setVideoView(playerView);
vout.attachViews();
Media media = new Media(libVlc, Uri.parse("rtp://@:" + UDP_PORT + "/"));
player.setMedia(media);
player.play();
This does play the stream, but there is a delay of approximately 2 seconds. I know for certain that the delay can be reduced to ~300 ms as some other player can play it at this delay. Which options should I use to reduce this latency? I understand that I will have to trade quality for it, but how do I do it in the first place?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…