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
052550e9
authored
Dec 13, 2019
by
olly
Committed by
Oliver Woodman
Jan 17, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Rename getPhysicalDisplaySize to getCurrentDisplayModeSize
PiperOrigin-RevId: 285405910
parent
18cdd8ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
9 deletions
library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java
library/core/src/main/java/com/google/android/exoplayer2/util/Util.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java
View file @
052550e9
...
@@ -355,7 +355,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
...
@@ -355,7 +355,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
/**
/**
* Equivalent to calling {@link #setViewportSize(int, int, boolean)} with the viewport size
* Equivalent to calling {@link #setViewportSize(int, int, boolean)} with the viewport size
* obtained from {@link Util#get
PhysicalDisplay
Size(Context)}.
* obtained from {@link Util#get
CurrentDisplayMode
Size(Context)}.
*
*
* @param context Any context.
* @param context Any context.
* @param viewportOrientationMayChange Whether the viewport orientation may change during
* @param viewportOrientationMayChange Whether the viewport orientation may change during
...
@@ -365,7 +365,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
...
@@ -365,7 +365,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
public
ParametersBuilder
setViewportSizeToPhysicalDisplaySize
(
public
ParametersBuilder
setViewportSizeToPhysicalDisplaySize
(
Context
context
,
boolean
viewportOrientationMayChange
)
{
Context
context
,
boolean
viewportOrientationMayChange
)
{
// Assume the viewport is fullscreen.
// Assume the viewport is fullscreen.
Point
viewportSize
=
Util
.
get
PhysicalDisplay
Size
(
context
);
Point
viewportSize
=
Util
.
get
CurrentDisplayMode
Size
(
context
);
return
setViewportSize
(
viewportSize
.
x
,
viewportSize
.
y
,
viewportOrientationMayChange
);
return
setViewportSize
(
viewportSize
.
x
,
viewportSize
.
y
,
viewportOrientationMayChange
);
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
052550e9
...
@@ -43,6 +43,7 @@ import android.security.NetworkSecurityPolicy;
...
@@ -43,6 +43,7 @@ import android.security.NetworkSecurityPolicy;
import
android.telephony.TelephonyManager
;
import
android.telephony.TelephonyManager
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.Display
;
import
android.view.Display
;
import
android.view.SurfaceView
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
...
@@ -1903,24 +1904,36 @@ public final class Util {
...
@@ -1903,24 +1904,36 @@ public final class Util {
}
}
/**
/**
* Gets the physical size of the default display, in pixels.
* Gets the size of the current mode of the default display, in pixels.
*
* <p>Note that due to application UI scaling, the number of pixels made available to applications
* (as reported by {@link Display#getSize(Point)} may differ from the mode's actual resolution (as
* reported by this function). For example, applications running on a display configured with a 4K
* mode may have their UI laid out and rendered in 1080p and then scaled up. Applications can take
* advantage of the full mode resolution through a {@link SurfaceView} using full size buffers.
*
*
* @param context Any context.
* @param context Any context.
* @return The
physical display siz
e, in pixels.
* @return The
size of the current mod
e, in pixels.
*/
*/
public
static
Point
get
PhysicalDisplay
Size
(
Context
context
)
{
public
static
Point
get
CurrentDisplayMode
Size
(
Context
context
)
{
WindowManager
windowManager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
windowManager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
return
get
PhysicalDisplay
Size
(
context
,
windowManager
.
getDefaultDisplay
());
return
get
CurrentDisplayMode
Size
(
context
,
windowManager
.
getDefaultDisplay
());
}
}
/**
/**
* Gets the physical size of the specified display, in pixels.
* Gets the size of the current mode of the specified display, in pixels.
*
* <p>Note that due to application UI scaling, the number of pixels made available to applications
* (as reported by {@link Display#getSize(Point)} may differ from the mode's actual resolution (as
* reported by this function). For example, applications running on a display configured with a 4K
* mode may have their UI laid out and rendered in 1080p and then scaled up. Applications can take
* advantage of the full mode resolution through a {@link SurfaceView} using full size buffers.
*
*
* @param context Any context.
* @param context Any context.
* @param display The display whose size is to be returned.
* @param display The display whose size is to be returned.
* @return The
physical display siz
e, in pixels.
* @return The
size of the current mod
e, in pixels.
*/
*/
public
static
Point
get
PhysicalDisplay
Size
(
Context
context
,
Display
display
)
{
public
static
Point
get
CurrentDisplayMode
Size
(
Context
context
,
Display
display
)
{
if
(
Util
.
SDK_INT
<=
29
&&
display
.
getDisplayId
()
==
Display
.
DEFAULT_DISPLAY
&&
isTv
(
context
))
{
if
(
Util
.
SDK_INT
<=
29
&&
display
.
getDisplayId
()
==
Display
.
DEFAULT_DISPLAY
&&
isTv
(
context
))
{
// On Android TVs it is common for the UI to be configured for a lower resolution than
// On Android TVs it is common for the UI to be configured for a lower resolution than
// SurfaceViews can output. Before API 26 the Display object does not provide a way to
// SurfaceViews can output. Before API 26 the Display object does not provide a way to
...
...
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