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
91da6a34
authored
Oct 13, 2021
by
olly
Committed by
Oliver Woodman
Oct 13, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix nullness checks for UdpDataSource
PiperOrigin-RevId: 402765571
parent
b75d6878
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
library/core/src/main/java/com/google/android/exoplayer2/upstream/UdpDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/UdpDataSource.java
View file @
91da6a34
...
...
@@ -15,6 +15,7 @@
*/
package
com
.
google
.
android
.
exoplayer2
.
upstream
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkNotNull
;
import
static
java
.
lang
.
Math
.
min
;
import
android.net.Uri
;
...
...
@@ -63,7 +64,6 @@ public final class UdpDataSource extends BaseDataSource {
@Nullable
private
DatagramSocket
socket
;
@Nullable
private
MulticastSocket
multicastSocket
;
@Nullable
private
InetAddress
address
;
@Nullable
private
InetSocketAddress
socketAddress
;
private
boolean
opened
;
private
int
packetRemaining
;
...
...
@@ -98,12 +98,12 @@ public final class UdpDataSource extends BaseDataSource {
@Override
public
long
open
(
DataSpec
dataSpec
)
throws
UdpDataSourceException
{
uri
=
dataSpec
.
uri
;
String
host
=
uri
.
getHost
(
);
String
host
=
checkNotNull
(
uri
.
getHost
()
);
int
port
=
uri
.
getPort
();
transferInitializing
(
dataSpec
);
try
{
address
=
InetAddress
.
getByName
(
host
);
socketAddress
=
new
InetSocketAddress
(
address
,
port
);
InetSocketAddress
socketAddress
=
new
InetSocketAddress
(
address
,
port
);
if
(
address
.
isMulticastAddress
())
{
multicastSocket
=
new
MulticastSocket
(
socketAddress
);
multicastSocket
.
joinGroup
(
address
);
...
...
@@ -133,7 +133,7 @@ public final class UdpDataSource extends BaseDataSource {
if
(
packetRemaining
==
0
)
{
// We've read all of the data from the current packet. Get another.
try
{
socket
.
receive
(
packet
);
checkNotNull
(
socket
)
.
receive
(
packet
);
}
catch
(
SocketTimeoutException
e
)
{
throw
new
UdpDataSourceException
(
e
,
PlaybackException
.
ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT
);
...
...
@@ -163,7 +163,7 @@ public final class UdpDataSource extends BaseDataSource {
uri
=
null
;
if
(
multicastSocket
!=
null
)
{
try
{
multicastSocket
.
leaveGroup
(
address
);
multicastSocket
.
leaveGroup
(
checkNotNull
(
address
)
);
}
catch
(
IOException
e
)
{
// Do nothing.
}
...
...
@@ -174,7 +174,6 @@ public final class UdpDataSource extends BaseDataSource {
socket
=
null
;
}
address
=
null
;
socketAddress
=
null
;
packetRemaining
=
0
;
if
(
opened
)
{
opened
=
false
;
...
...
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