Package io.antmedia.streamsource
Class StreamFetcher
java.lang.Object
io.antmedia.streamsource.StreamFetcher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceclass -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AntMediaApplicationAdapterprivate AppSettingsprivate intprivate intBuffer time in millisecondsprivate Resultprivate static final intprivate DataStoreprivate booleanprivate final Semaphoreprivate longLast packet received timeprivate long[]private long[]protected static org.slf4j.Loggerprivate MuxAdaptorprivate static final intprivate longprivate longprivate booleanIf it is true, it restarts fetching everytime it disconnects if it is false, it does not restartprivate static final Stringprivate IScopeprivate AtomicLongprivate AtomicBooleanprivate booleanWhen true, bypass the isStreaming status check once at startup.private booleanThis flag closes the stream in the worker thread.(package private) StreamFetcher.IStreamFetcherListenerprivate Stringprivate Stringprivate Stringprivate StreamFetcher.WorkerThreadprivate AtomicBooleanprivate intConnection setup timeout valueprivate static final intFFMPEG will abort connection, in order not to forever block the thread or lock port (EX: in case of udp multicast connection).private io.vertx.core.Vertx -
Constructor Summary
ConstructorsConstructorDescriptionStreamFetcher(String streamUrl, String streamId, String streamType, IScope scope, io.vertx.core.Vertx vertx, long seekTimeInMs) -
Method Summary
Modifier and TypeMethodDescriptionvoiddebugSetStopRequestReceived(boolean stopRequest) This is for test purposesprotected AppSettingsorg.bytedeco.ffmpeg.avcodec.AVPacketintlong[]getScope()voidinitDTSArrays(int nbStreams) booleanbooleanbooleanbooleanbooleanIf thread is alive and receiving packet with in thePACKET_RECEIVED_INTERVAL_TIMEOUTtime mean it is runningbooleanbooleanvoidparseRtspUrlParams(org.bytedeco.ffmpeg.avutil.AVDictionary optionsDictionary) voidrestart()voidseekTime(long seekTimeInMilliseconds) voidsetBufferTime(int bufferTime) voidsetCameraError(Result cameraError) voidsetConnectionTimeout(int timeoutMs) Set timeout when establishing connectionvoidsetDataStore(DataStore dataStore) voidsetMuxAdaptor(MuxAdaptor muxAdaptor) voidsetRestartStream(boolean restartStream) voidvoidsetSeekTimeRequestReceived(AtomicBoolean seekTimeRequestReceived) voidsetStartStreamForce(boolean startStreamForce) voidsetStreamFetcherListener(StreamFetcher.IStreamFetcherListener streamFetcherListener) voidsetStreamId(String streamId) voidsetStreamUrl(String streamUrl) voidsetThread(StreamFetcher.WorkerThread thread) voidsetThreadActive(boolean threadActive) voidvoidboolean
-
Field Details
-
logger
protected static org.slf4j.Logger logger -
thread
-
timeoutMicroSeconds
private int timeoutMicroSecondsConnection setup timeout value -
exceptionInThread
private boolean exceptionInThread -
lastPacketReceivedTime
private long lastPacketReceivedTimeLast packet received time -
threadActive
-
cameraError
-
PACKET_RECEIVED_INTERVAL_TIMEOUT
private static final int PACKET_RECEIVED_INTERVAL_TIMEOUT- See Also:
-
isThreadStopedSemaphore
-
scope
-
appInstance
-
lastSentDTS
private long[] lastSentDTS -
lastReceivedDTS
private long[] lastReceivedDTS -
muxAdaptor
-
UDP_TCP_HTTP_TIMEOUT
private static final int UDP_TCP_HTTP_TIMEOUTFFMPEG will abort connection, in order not to forever block the thread or lock port (EX: in case of udp multicast connection). Instead, it will fail properly with timeout error.- See Also:
-
startStreamForce
private boolean startStreamForceWhen true, bypass the isStreaming status check once at startup. It is reset to false after the worker thread reads it. -
restartStream
private boolean restartStreamIf it is true, it restarts fetching everytime it disconnects if it is false, it does not restart -
stopRequestReceived
private volatile boolean stopRequestReceivedThis flag closes the stream in the worker thread. It should be a field of StreamFetcher. Because WorkerThread instance can be re-created and we can lost the flag value. This case causes stream NOT TO BE STOPPED -
bufferTime
private int bufferTimeBuffer time in milliseconds -
COUNT_TO_LOG_BUFFER
private static final int COUNT_TO_LOG_BUFFER- See Also:
-
bufferLogCounter
private int bufferLogCounter -
appSettings
-
vertx
private io.vertx.core.Vertx vertx -
dataStore
-
readNextPacketStartTime
private long readNextPacketStartTime -
readNextPacketCompleteTime
private long readNextPacketCompleteTime -
streamFetcherListener
StreamFetcher.IStreamFetcherListener streamFetcherListener -
streamUrl
-
streamId
-
streamType
-
seekTimeRequestReceived
-
seekTimeInMs
-
RTSP_ALLOWED_MEDIA_TYPES
- See Also:
-
-
Constructor Details
-
StreamFetcher
-
-
Method Details
-
getStreamFetcherListener
-
setStreamFetcherListener
-
initDTSArrays
public void initDTSArrays(int nbStreams) -
parseRtspUrlParams
public void parseRtspUrlParams(org.bytedeco.ffmpeg.avutil.AVDictionary optionsDictionary) -
startStream
public void startStream() -
getDataStore
-
setDataStore
-
getAVPacket
public org.bytedeco.ffmpeg.avcodec.AVPacket getAVPacket() -
isStreamAlive
public boolean isStreamAlive()If thread is alive and receiving packet with in thePACKET_RECEIVED_INTERVAL_TIMEOUTtime mean it is running- Returns:
- true if it is running and false it is not
-
isStreamBlocked
public boolean isStreamBlocked() -
isStopped
public boolean isStopped() -
stopStream
public void stopStream() -
stopStreamBlocking
public boolean stopStreamBlocking() -
seekTime
public void seekTime(long seekTimeInMilliseconds) -
isStopRequestReceived
public boolean isStopRequestReceived() -
getThread
-
setStartStreamForce
public void setStartStreamForce(boolean startStreamForce) -
getBroadcast
-
setThread
-
restart
public void restart() -
setConnectionTimeout
public void setConnectionTimeout(int timeoutMs) Set timeout when establishing connection- Parameters:
timeoutMs- in ms
-
isExceptionInThread
public boolean isExceptionInThread() -
setThreadActive
public void setThreadActive(boolean threadActive) -
isThreadActive
public boolean isThreadActive() -
getCameraError
-
getIsThreadStopedSemaphore
-
setCameraError
-
getScope
-
setScope
-
getInstance
-
getMuxAdaptor
-
setMuxAdaptor
-
isRestartStream
public boolean isRestartStream() -
setRestartStream
public void setRestartStream(boolean restartStream) -
getBufferTime
public int getBufferTime() -
setBufferTime
public void setBufferTime(int bufferTime) -
getAppSettings
-
debugSetStopRequestReceived
public void debugSetStopRequestReceived(boolean stopRequest) This is for test purposes- Parameters:
stopRequest-
-
getStreamId
-
getStreamUrl
-
setStreamId
-
setStreamUrl
-
getSeekTimeRequestReceived
-
setSeekTimeRequestReceived
-
getLastSentDTS
public long[] getLastSentDTS()
-