Skip to content

Commit

Permalink
* Update FFmpegStreamingTimeout sample to use timeout instead of…
Browse files Browse the repository at this point in the history
… `stimeout` for RTSP (pull bytedeco#1758)
  • Loading branch information
d00malun authored Feb 22, 2022
1 parent fef1d8e commit 34aa118
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Update `FFmpegStreamingTimeout` sample to use `timeout` instead of `stimeout` for RTSP ([pull #1758](https://github.com/bytedeco/javacv/pull/1758))
* Restore static calls to `FFmpegFrameGrabber.tryLoad()` and `FFmpegFrameRecorder.tryLoad()` ([issue #1756](https://github.com/bytedeco/javacv/issues/1756))
* Enable by default on `RealSense2FrameGrabber.start()` all color, depth, and IR streams as `videoStream` ([pull #1750](https://github.com/bytedeco/javacv/pull/1750))

Expand Down
26 changes: 9 additions & 17 deletions samples/FFmpegStreamingTimeout.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ public class FFmpegStreamingTimeout {
*/
private static enum TimeoutOption {
/**
* Depends on protocol (FTP, HTTP, RTMP, SMB, SSH, TCP, UDP, or UNIX).
*
* Depends on protocol (FTP, HTTP, RTMP, RTSP, SMB, SSH, TCP, UDP, or UNIX).
* http://ffmpeg.org/ffmpeg-all.html
*
* Specific for RTSP:
* Set socket TCP I/O timeout in microseconds.
* http://ffmpeg.org/ffmpeg-all.html#rtsp
*/
TIMEOUT,
/**
Expand All @@ -33,15 +36,7 @@ private static enum TimeoutOption {
*
* http://ffmpeg.org/ffmpeg-all.html#Protocols
*/
RW_TIMEOUT,
/**
* Protocols -> RTSP
*
* Set socket TCP I/O timeout in microseconds.
*
* http://ffmpeg.org/ffmpeg-all.html#rtsp
*/
STIMEOUT;
RW_TIMEOUT;

public String getKey() {
return toString().toLowerCase();
Expand All @@ -61,24 +56,21 @@ private static void rtspStreamingTest() {
try {
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(SOURCE_RTSP);
/**
* "timeout" - IS IGNORED when a network cable have been unplugged
* before a connection and sometimes when connection is lost.
*
* "rw_timeout" - IS IGNORED when a network cable have been
* unplugged before a connection but the option takes effect after a
* connection was established.
*
* "stimeout" - works fine.
* "timeout" - works fine.
*/
grabber.setOption(
TimeoutOption.STIMEOUT.getKey(),
TimeoutOption.TIMEOUT.getKey(),
String.valueOf(TIMEOUT * 1000000)
); // In microseconds.
grabber.start();

Frame frame = null;
/**
* When network is disabled (before brabber was started) grabber
* When network is disabled (before grabber was started) grabber
* throws exception: "org.bytedeco.javacv.FrameGrabber$Exception:
* avformat_open_input() error -138: Could not open input...".
*
Expand Down

0 comments on commit 34aa118

Please sign in to comment.