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
3a31bc17
authored
Jan 06, 2020
by
tonihei
Committed by
Ian Baker
Jan 06, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Support 5G in network type detection
PiperOrigin-RevId: 288280500
parent
6f312c05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
library/core/src/main/java/com/google/android/exoplayer2/C.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeter.java
library/core/src/main/java/com/google/android/exoplayer2/util/Util.java
library/core/src/main/java/com/google/android/exoplayer2/C.java
View file @
3a31bc17
...
...
@@ -977,8 +977,8 @@ public final class C {
/**
* Network connection type. One of {@link #NETWORK_TYPE_UNKNOWN}, {@link #NETWORK_TYPE_OFFLINE},
* {@link #NETWORK_TYPE_WIFI}, {@link #NETWORK_TYPE_2G}, {@link #NETWORK_TYPE_3G}, {@link
* #NETWORK_TYPE_4G}, {@link #NETWORK_TYPE_
CELLULAR_UNKNOWN}, {@link #NETWORK_TYPE_ETHERNET} or
* {@link #NETWORK_TYPE_OTHER}.
* #NETWORK_TYPE_4G}, {@link #NETWORK_TYPE_
5G}, {@link #NETWORK_TYPE_CELLULAR_UNKNOWN}, {@link
*
#NETWORK_TYPE_ETHERNET} or
{@link #NETWORK_TYPE_OTHER}.
*/
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
...
...
@@ -989,6 +989,7 @@ public final class C {
NETWORK_TYPE_2G
,
NETWORK_TYPE_3G
,
NETWORK_TYPE_4G
,
NETWORK_TYPE_5G
,
NETWORK_TYPE_CELLULAR_UNKNOWN
,
NETWORK_TYPE_ETHERNET
,
NETWORK_TYPE_OTHER
...
...
@@ -1006,6 +1007,8 @@ public final class C {
public
static
final
int
NETWORK_TYPE_3G
=
4
;
/** Network type for a 4G cellular connection. */
public
static
final
int
NETWORK_TYPE_4G
=
5
;
/** Network type for a 5G cellular connection. */
public
static
final
int
NETWORK_TYPE_5G
=
9
;
/**
* Network type for cellular connections which cannot be mapped to one of {@link
* #NETWORK_TYPE_2G}, {@link #NETWORK_TYPE_3G}, or {@link #NETWORK_TYPE_4G}.
...
...
@@ -1013,10 +1016,7 @@ public final class C {
public
static
final
int
NETWORK_TYPE_CELLULAR_UNKNOWN
=
6
;
/** Network type for an Ethernet connection. */
public
static
final
int
NETWORK_TYPE_ETHERNET
=
7
;
/**
* Network type for other connections which are not Wifi or cellular (e.g. Ethernet, VPN,
* Bluetooth).
*/
/** Network type for other connections which are not Wifi or cellular (e.g. VPN, Bluetooth). */
public
static
final
int
NETWORK_TYPE_OTHER
=
8
;
/**
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeter.java
View file @
3a31bc17
...
...
@@ -203,9 +203,10 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
result
.
append
(
C
.
NETWORK_TYPE_2G
,
DEFAULT_INITIAL_BITRATE_ESTIMATES_2G
[
groupIndices
[
1
]]);
result
.
append
(
C
.
NETWORK_TYPE_3G
,
DEFAULT_INITIAL_BITRATE_ESTIMATES_3G
[
groupIndices
[
2
]]);
result
.
append
(
C
.
NETWORK_TYPE_4G
,
DEFAULT_INITIAL_BITRATE_ESTIMATES_4G
[
groupIndices
[
3
]]);
// Assume default Wifi bitrate for Ethernet
to prevent using the slower fallback bitrate
.
// Assume default Wifi bitrate for Ethernet
and 5G to prevent using the slower fallback
.
result
.
append
(
C
.
NETWORK_TYPE_ETHERNET
,
DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI
[
groupIndices
[
0
]]);
result
.
append
(
C
.
NETWORK_TYPE_5G
,
DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI
[
groupIndices
[
0
]]);
return
result
;
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
3a31bc17
...
...
@@ -2126,6 +2126,8 @@ public final class Util {
return
C
.
NETWORK_TYPE_3G
;
case
TelephonyManager
.
NETWORK_TYPE_LTE
:
return
C
.
NETWORK_TYPE_4G
;
case
TelephonyManager
.
NETWORK_TYPE_NR
:
return
C
.
NETWORK_TYPE_5G
;
case
TelephonyManager
.
NETWORK_TYPE_IWLAN
:
return
C
.
NETWORK_TYPE_WIFI
;
case
TelephonyManager
.
NETWORK_TYPE_GSM
:
...
...
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