Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0830c06c
authored
Nov 02, 2021
by
Sebastian Roth
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
PR feedback
parent
1ecbdb8d
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
40 deletions
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspClient.java
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMediaPeriod.java
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMediaSource.java
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspClientTest.java
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspMediaPeriodTest.java
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspPlaybackTest.java
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspClient.java
View file @
0830c06c
...
@@ -123,8 +123,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -123,8 +123,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private
final
SessionInfoListener
sessionInfoListener
;
private
final
SessionInfoListener
sessionInfoListener
;
private
final
PlaybackEventListener
playbackEventListener
;
private
final
PlaybackEventListener
playbackEventListener
;
private
final
String
userAgent
;
private
final
String
userAgent
;
private
final
SocketFactory
socketFactory
;
private
final
boolean
debugLoggingEnabled
;
private
final
boolean
debugLoggingEnabled
;
@Nullable
private
final
SocketFactory
socketFactory
;
private
final
ArrayDeque
<
RtpLoadInfo
>
pendingSetupRtpLoadInfos
;
private
final
ArrayDeque
<
RtpLoadInfo
>
pendingSetupRtpLoadInfos
;
// TODO(b/172331505) Add a timeout monitor for pending requests.
// TODO(b/172331505) Add a timeout monitor for pending requests.
private
final
SparseArray
<
RtspRequest
>
pendingRequests
;
private
final
SparseArray
<
RtspRequest
>
pendingRequests
;
...
@@ -156,14 +156,16 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -156,14 +156,16 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* @param playbackEventListener The {@link PlaybackEventListener}.
* @param playbackEventListener The {@link PlaybackEventListener}.
* @param userAgent The user agent.
* @param userAgent The user agent.
* @param uri The RTSP playback URI.
* @param uri The RTSP playback URI.
* @param socketFactory The {@link SocketFactory} for the client connection.
* @param debugLoggingEnabled Whether to print RTSP messages.
*/
*/
public
RtspClient
(
public
RtspClient
(
SessionInfoListener
sessionInfoListener
,
SessionInfoListener
sessionInfoListener
,
PlaybackEventListener
playbackEventListener
,
PlaybackEventListener
playbackEventListener
,
String
userAgent
,
String
userAgent
,
Uri
uri
,
Uri
uri
,
boolean
debugLoggingEnabled
,
SocketFactory
socketFactory
,
@Nullable
SocketFactory
socketFactory
)
{
boolean
debugLoggingEnabled
)
{
this
.
sessionInfoListener
=
sessionInfoListener
;
this
.
sessionInfoListener
=
sessionInfoListener
;
this
.
playbackEventListener
=
playbackEventListener
;
this
.
playbackEventListener
=
playbackEventListener
;
this
.
userAgent
=
userAgent
;
this
.
userAgent
=
userAgent
;
...
@@ -293,9 +295,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -293,9 +295,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
checkArgument
(
uri
.
getHost
()
!=
null
);
checkArgument
(
uri
.
getHost
()
!=
null
);
int
rtspPort
=
uri
.
getPort
()
>
0
?
uri
.
getPort
()
:
DEFAULT_RTSP_PORT
;
int
rtspPort
=
uri
.
getPort
()
>
0
?
uri
.
getPort
()
:
DEFAULT_RTSP_PORT
;
SocketFactory
socketFactory
=
this
.
socketFactory
!=
null
?
this
.
socketFactory
:
SocketFactory
.
getDefault
();
return
socketFactory
.
createSocket
(
checkNotNull
(
uri
.
getHost
()),
rtspPort
);
return
socketFactory
.
createSocket
(
checkNotNull
(
uri
.
getHost
()),
rtspPort
);
}
}
...
...
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMediaPeriod.java
View file @
0830c06c
...
@@ -103,7 +103,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -103,7 +103,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* @param listener A {@link Listener} to receive session information updates.
* @param listener A {@link Listener} to receive session information updates.
* @param userAgent The user agent.
* @param userAgent The user agent.
* @param debugLoggingEnabled Whether to log RTSP messages.
* @param debugLoggingEnabled Whether to log RTSP messages.
* @param socketFactory A socket factory.
* @param socketFactory A socket factory
for {@link RtspClient}'s connection
.
*/
*/
public
RtspMediaPeriod
(
public
RtspMediaPeriod
(
Allocator
allocator
,
Allocator
allocator
,
...
@@ -111,8 +111,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -111,8 +111,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
Uri
uri
,
Uri
uri
,
Listener
listener
,
Listener
listener
,
String
userAgent
,
String
userAgent
,
boolean
debugLoggingEnabled
,
SocketFactory
socketFactory
,
@Nullable
SocketFactory
socketFactory
)
{
boolean
debugLoggingEnabled
)
{
this
.
allocator
=
allocator
;
this
.
allocator
=
allocator
;
this
.
rtpDataChannelFactory
=
rtpDataChannelFactory
;
this
.
rtpDataChannelFactory
=
rtpDataChannelFactory
;
this
.
listener
=
listener
;
this
.
listener
=
listener
;
...
@@ -125,8 +125,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -125,8 +125,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/* playbackEventListener= */
internalListener
,
/* playbackEventListener= */
internalListener
,
/* userAgent= */
userAgent
,
/* userAgent= */
userAgent
,
/* uri= */
uri
,
/* uri= */
uri
,
debugLoggingEnabled
,
socketFactory
,
socketFactory
);
debugLoggingEnabled
);
rtspLoaderWrappers
=
new
ArrayList
<>();
rtspLoaderWrappers
=
new
ArrayList
<>();
selectedLoadInfos
=
new
ArrayList
<>();
selectedLoadInfos
=
new
ArrayList
<>();
...
...
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMediaSource.java
View file @
0830c06c
...
@@ -69,9 +69,9 @@ public final class RtspMediaSource extends BaseMediaSource {
...
@@ -69,9 +69,9 @@ public final class RtspMediaSource extends BaseMediaSource {
private
long
timeoutMs
;
private
long
timeoutMs
;
private
String
userAgent
;
private
String
userAgent
;
@Nullable
private
SocketFactory
socketFactory
;
private
boolean
forceUseRtpTcp
;
private
boolean
forceUseRtpTcp
;
private
boolean
debugLoggingEnabled
;
private
boolean
debugLoggingEnabled
;
private
SocketFactory
socketFactory
;
public
Factory
()
{
public
Factory
()
{
timeoutMs
=
DEFAULT_TIMEOUT_MS
;
timeoutMs
=
DEFAULT_TIMEOUT_MS
;
...
@@ -120,9 +120,8 @@ public final class RtspMediaSource extends BaseMediaSource {
...
@@ -120,9 +120,8 @@ public final class RtspMediaSource extends BaseMediaSource {
}
}
/**
/**
* Configures a socket factory to be used for client connections.
* Sets a socket factory for {@link RtspClient}'s connection, the default value is {@link
*
* SocketFactory#getDefault()}.
* When unspecified, {@link SocketFactory#getDefault()} is used.
*
*
* @param socketFactory A socket factory.
* @param socketFactory A socket factory.
* @return This Factory, for convenience.
* @return This Factory, for convenience.
...
@@ -217,8 +216,8 @@ public final class RtspMediaSource extends BaseMediaSource {
...
@@ -217,8 +216,8 @@ public final class RtspMediaSource extends BaseMediaSource {
?
new
TransferRtpDataChannelFactory
(
timeoutMs
)
?
new
TransferRtpDataChannelFactory
(
timeoutMs
)
:
new
UdpDataSourceRtpDataChannelFactory
(
timeoutMs
),
:
new
UdpDataSourceRtpDataChannelFactory
(
timeoutMs
),
userAgent
,
userAgent
,
debugLoggingEnabled
,
socketFactory
==
null
?
SocketFactory
.
getDefault
()
:
socketFactory
,
socketFactory
);
debugLoggingEnabled
);
}
}
}
}
...
@@ -241,10 +240,8 @@ public final class RtspMediaSource extends BaseMediaSource {
...
@@ -241,10 +240,8 @@ public final class RtspMediaSource extends BaseMediaSource {
private
final
RtpDataChannel
.
Factory
rtpDataChannelFactory
;
private
final
RtpDataChannel
.
Factory
rtpDataChannelFactory
;
private
final
String
userAgent
;
private
final
String
userAgent
;
private
final
Uri
uri
;
private
final
Uri
uri
;
private
final
boolean
debugLoggingEnabled
;
@Nullable
private
final
SocketFactory
socketFactory
;
private
final
SocketFactory
socketFactory
;
private
final
boolean
debugLoggingEnabled
;
private
long
timelineDurationUs
;
private
long
timelineDurationUs
;
private
boolean
timelineIsSeekable
;
private
boolean
timelineIsSeekable
;
...
@@ -256,8 +253,8 @@ public final class RtspMediaSource extends BaseMediaSource {
...
@@ -256,8 +253,8 @@ public final class RtspMediaSource extends BaseMediaSource {
MediaItem
mediaItem
,
MediaItem
mediaItem
,
RtpDataChannel
.
Factory
rtpDataChannelFactory
,
RtpDataChannel
.
Factory
rtpDataChannelFactory
,
String
userAgent
,
String
userAgent
,
boolean
debugLoggingEnabled
,
SocketFactory
socketFactory
,
@Nullable
SocketFactory
socketFactory
)
{
boolean
debugLoggingEnabled
)
{
this
.
mediaItem
=
mediaItem
;
this
.
mediaItem
=
mediaItem
;
this
.
rtpDataChannelFactory
=
rtpDataChannelFactory
;
this
.
rtpDataChannelFactory
=
rtpDataChannelFactory
;
this
.
userAgent
=
userAgent
;
this
.
userAgent
=
userAgent
;
...
@@ -302,8 +299,8 @@ public final class RtspMediaSource extends BaseMediaSource {
...
@@ -302,8 +299,8 @@ public final class RtspMediaSource extends BaseMediaSource {
notifySourceInfoRefreshed
();
notifySourceInfoRefreshed
();
},
},
userAgent
,
userAgent
,
debugLoggingEnabled
,
socketFactory
,
socketFactory
);
debugLoggingEnabled
);
}
}
@Override
@Override
...
...
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspClientTest.java
View file @
0830c06c
...
@@ -146,8 +146,8 @@ public final class RtspClientTest {
...
@@ -146,8 +146,8 @@ public final class RtspClientTest {
EMPTY_PLAYBACK_LISTENER
,
EMPTY_PLAYBACK_LISTENER
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
/* debugLoggingEnabled= */
false
,
socketFactory
,
socketFactory
);
/* debugLoggingEnabled= */
false
);
rtspClient
.
start
();
rtspClient
.
start
();
RobolectricUtil
.
runMainLooperUntil
(()
->
tracksInSession
.
get
()
!=
null
);
RobolectricUtil
.
runMainLooperUntil
(()
->
tracksInSession
.
get
()
!=
null
);
...
@@ -190,8 +190,8 @@ public final class RtspClientTest {
...
@@ -190,8 +190,8 @@ public final class RtspClientTest {
EMPTY_PLAYBACK_LISTENER
,
EMPTY_PLAYBACK_LISTENER
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
/*
debugLoggingEnabled= */
false
,
/*
socketFactory */
null
,
/*
socketFactory */
null
);
/*
debugLoggingEnabled= */
false
);
rtspClient
.
start
();
rtspClient
.
start
();
RobolectricUtil
.
runMainLooperUntil
(()
->
tracksInSession
.
get
()
!=
null
);
RobolectricUtil
.
runMainLooperUntil
(()
->
tracksInSession
.
get
()
!=
null
);
...
@@ -242,8 +242,8 @@ public final class RtspClientTest {
...
@@ -242,8 +242,8 @@ public final class RtspClientTest {
EMPTY_PLAYBACK_LISTENER
,
EMPTY_PLAYBACK_LISTENER
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
/*
debugLoggingEnabled= */
false
,
/*
socketFactory */
SocketFactory
.
getDefault
()
,
/*
socketFactory */
null
);
/*
debugLoggingEnabled= */
false
);
rtspClient
.
start
();
rtspClient
.
start
();
RobolectricUtil
.
runMainLooperUntil
(()
->
tracksInSession
.
get
()
!=
null
);
RobolectricUtil
.
runMainLooperUntil
(()
->
tracksInSession
.
get
()
!=
null
);
...
@@ -286,8 +286,8 @@ public final class RtspClientTest {
...
@@ -286,8 +286,8 @@ public final class RtspClientTest {
EMPTY_PLAYBACK_LISTENER
,
EMPTY_PLAYBACK_LISTENER
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
/*
debugLoggingEnabled= */
false
,
/*
socketFactory */
SocketFactory
.
getDefault
()
,
/*
socketFactory */
null
);
/*
debugLoggingEnabled= */
false
);
rtspClient
.
start
();
rtspClient
.
start
();
RobolectricUtil
.
runMainLooperUntil
(()
->
tracksInSession
.
get
()
!=
null
);
RobolectricUtil
.
runMainLooperUntil
(()
->
tracksInSession
.
get
()
!=
null
);
...
@@ -333,8 +333,8 @@ public final class RtspClientTest {
...
@@ -333,8 +333,8 @@ public final class RtspClientTest {
EMPTY_PLAYBACK_LISTENER
,
EMPTY_PLAYBACK_LISTENER
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
/*
debugLoggingEnabled= */
false
,
/*
socketFactory */
SocketFactory
.
getDefault
()
,
/*
socketFactory */
null
);
/*
debugLoggingEnabled= */
false
);
rtspClient
.
start
();
rtspClient
.
start
();
RobolectricUtil
.
runMainLooperUntil
(()
->
failureMessage
.
get
()
!=
null
);
RobolectricUtil
.
runMainLooperUntil
(()
->
failureMessage
.
get
()
!=
null
);
...
@@ -380,8 +380,8 @@ public final class RtspClientTest {
...
@@ -380,8 +380,8 @@ public final class RtspClientTest {
EMPTY_PLAYBACK_LISTENER
,
EMPTY_PLAYBACK_LISTENER
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
/* userAgent= */
"ExoPlayer:RtspClientTest"
,
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
/*
debugLoggingEnabled= */
false
,
/*
socketFactory */
SocketFactory
.
getDefault
()
,
/*
socketFactory */
null
);
/*
debugLoggingEnabled= */
false
);
rtspClient
.
start
();
rtspClient
.
start
();
RobolectricUtil
.
runMainLooperUntil
(()
->
failureCause
.
get
()
!=
null
);
RobolectricUtil
.
runMainLooperUntil
(()
->
failureCause
.
get
()
!=
null
);
...
...
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspMediaPeriodTest.java
View file @
0830c06c
...
@@ -27,6 +27,7 @@ import com.google.android.exoplayer2.util.Util;
...
@@ -27,6 +27,7 @@ import com.google.android.exoplayer2.util.Util;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableList
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicLong
;
import
java.util.concurrent.atomic.AtomicLong
;
import
javax.net.SocketFactory
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
@@ -84,8 +85,8 @@ public final class RtspMediaPeriodTest {
...
@@ -84,8 +85,8 @@ public final class RtspMediaPeriodTest {
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
RtspTestUtils
.
getTestUri
(
rtspServer
.
startAndGetPortNumber
()),
/* listener= */
timing
->
refreshedSourceDurationMs
.
set
(
timing
.
getDurationMs
()),
/* listener= */
timing
->
refreshedSourceDurationMs
.
set
(
timing
.
getDurationMs
()),
/* userAgent= */
"ExoPlayer:RtspPeriodTest"
,
/* userAgent= */
"ExoPlayer:RtspPeriodTest"
,
/*
debugLoggingEnabled= */
false
,
/*
socketFactory */
SocketFactory
.
getDefault
()
,
/*
socketFactory */
null
);
/*
debugLoggingEnabled= */
false
);
mediaPeriod
.
prepare
(
mediaPeriod
.
prepare
(
new
MediaPeriod
.
Callback
()
{
new
MediaPeriod
.
Callback
()
{
...
...
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspPlaybackTest.java
View file @
0830c06c
...
@@ -46,6 +46,7 @@ import java.util.ArrayList;
...
@@ -46,6 +46,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.ConcurrentLinkedQueue
;
import
java.util.concurrent.ConcurrentLinkedQueue
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.atomic.AtomicReference
;
import
javax.net.SocketFactory
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -156,8 +157,8 @@ public final class RtspPlaybackTest {
...
@@ -156,8 +157,8 @@ public final class RtspPlaybackTest {
MediaItem
.
fromUri
(
RtspTestUtils
.
getTestUri
(
serverRtspPortNumber
)),
MediaItem
.
fromUri
(
RtspTestUtils
.
getTestUri
(
serverRtspPortNumber
)),
rtpDataChannelFactory
,
rtpDataChannelFactory
,
"ExoPlayer:PlaybackTest"
,
"ExoPlayer:PlaybackTest"
,
/*
debugLoggingEnabled= */
false
,
/*
socketFactory */
SocketFactory
.
getDefault
()
,
/*
socketFactory */
null
),
/*
debugLoggingEnabled= */
false
),
false
);
false
);
return
player
;
return
player
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment