Skip to content

Commit

Permalink
Merge pull request #9045 from google/dev-v2-r2.14.1
Browse files Browse the repository at this point in the history
r2.14.1
  • Loading branch information
icbaker authored Jun 14, 2021
2 parents 9be5ece + c1b7c47 commit b2333c8
Show file tree
Hide file tree
Showing 111 changed files with 7,321 additions and 1,577 deletions.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ and extend, and can be updated through Play Store application updates.
ExoPlayer modules can be obtained from [the Google Maven repository][]. It's
also possible to clone the repository and depend on the modules locally.

[the Google Maven repository]: https://developer.android.com/studio/build/dependencies#google-maven

### From the Google Maven repository

#### 1. Add ExoPlayer module dependencies ####
Expand All @@ -39,13 +41,10 @@ implementation 'com.google.android.exoplayer:exoplayer:2.X.X'

where `2.X.X` is your preferred version.

Note: old versions of ExoPlayer are available via JCenter. To use them, you need
to add `jcenter()` to your project's root build.gradle `repositories` block.

As an alternative to the full library, you can depend on only the library
modules that you actually need. For example the following will add dependencies
on the Core, DASH and UI library modules, as might be required for an app that
plays DASH content:
only plays DASH content:

```gradle
implementation 'com.google.android.exoplayer:exoplayer-core:2.X.X'
Expand All @@ -54,13 +53,15 @@ implementation 'com.google.android.exoplayer:exoplayer-ui:2.X.X'
```

The available library modules are listed below. Adding a dependency to the full
library is equivalent to adding dependencies on all of the library modules
individually.
ExoPlayer library is equivalent to adding dependencies on all of the library
modules individually.

* `exoplayer-core`: Core functionality (required).
* `exoplayer-dash`: Support for DASH content.
* `exoplayer-hls`: Support for HLS content.
* `exoplayer-rtsp`: Support for RTSP content.
* `exoplayer-smoothstreaming`: Support for SmoothStreaming content.
* `exoplayer-transformer`: Media transformation functionality.
* `exoplayer-ui`: UI components and resources for use with ExoPlayer.

In addition to library modules, ExoPlayer has extension modules that depend on
Expand All @@ -72,7 +73,6 @@ More information on the library and extension modules that are available can be
found on the [Google Maven ExoPlayer page][].

[extensions directory]: https://github.com/google/ExoPlayer/tree/release-v2/extensions/
[the Google Maven repository]: https://developer.android.com/studio/build/dependencies#google-maven
[Google Maven ExoPlayer page]: https://maven.google.com/web/index.html#com.google.android.exoplayer

#### 2. Turn on Java 8 support ####
Expand All @@ -87,6 +87,12 @@ compileOptions {
}
```

#### 3. Enable multidex ####

If your Gradle `minSdkVersion` is 20 or lower, you should
[enable multidex](https://developer.android.com/studio/build/multidex) in order
to prevent build errors.

### Locally ###

Cloning the repository and depending on the modules locally is required when
Expand All @@ -104,12 +110,12 @@ git checkout release-v2
```

Next, add the following to your project's `settings.gradle` file, replacing
`/absolute/path/to/exoplayer` with the absolute path to your local copy:
`path/to/exoplayer` with the path to your local copy:

```gradle
gradle.ext.exoplayerRoot = '/absolute/path/to/exoplayer'
gradle.ext.exoplayerRoot = 'path/to/exoplayer'
gradle.ext.exoplayerModulePrefix = 'exoplayer-'
apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle')
apply from: file("$gradle.ext.exoplayerRoot/core_settings.gradle")
```

You should now see the ExoPlayer modules appear as part of your project. You can
Expand Down
52 changes: 52 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# Release notes

### 2.14.1 (2021-06-11)

* Core Library:
* Fix gradle config to allow specifying a relative path for
`exoplayerRoot` when [depending on ExoPlayer locally](README.md#locally)
([#8927](https://github.com/google/ExoPlayer/issues/8927)).
* Update `MediaItem.Builder` javadoc to discourage calling setters that
will be (currently) ignored if another setter is not also called.
* Extractors:
* Add support for MPEG-H 3D Audio in MP4 extractors
([#8860](https://github.com/google/ExoPlayer/pull/8860)).
* Video:
* Fix bug that could cause `CodecException: Error 0xffffffff` to be thrown
from `MediaCodec.native_setSurface` in use cases that involve both
swapping the output `Surface` and a mixture of secure and non-secure
content being played
([#8776](https://github.com/google/ExoPlayer/issues/8776)).
* HLS:
* Use the `PRECISE` attribute in `EXT-X-START` to select the default start
position.
* Fix a bug where skipping into spliced-in chunks triggered an assertion
error ([#8937](https://github.com/google/ExoPlayer/issues/8937)).
* DRM:
* Keep secure `MediaCodec` instances initialized when disabling (but not
resetting) `MediaCodecRenderer`. This helps re-use secure decoders in
more contexts, which avoids the 'black flash' caused by detaching a
`Surface` from a secure decoder on some devices
([#8842](https://github.com/google/ExoPlayer/issues/8842)). It will also
result in DRM license refresh network requests while the player is
stopped if `Player#setForegroundMode` is true.
* Fix issue where offline keys were unnecessarily (and incorrectly)
restored into a session before being released. This call sequence is
explicitly disallowed in OEMCrypto v16.
* UI:
* Keep subtitle language features embedded (e.g. rubies & tate-chu-yoko)
in `Cue.text` even when `SubtitleView#setApplyEmbeddedStyles()` is
`false`.
* Fix `NullPointerException` in `StyledPlayerView` that could occur after
calling `StyledPlayerView.setPlayer(null)`
([#8985](https://github.com/google/ExoPlayer/issues/8985)).
* RTSP:
* Add support for RTSP basic and digest authentication
([#8941](https://github.com/google/ExoPlayer/issues/8941)).
* Enable using repeat mode and playlist with RTSP
([#8994](https://github.com/google/ExoPlayer/issues/8994)).
* Add `RtspMediaSource.Factory` option to set the RTSP user agent.
* Add `RtspMediaSource.Factory` option to force using TCP for streaming.
* GL demo app:
* Fix texture transformation to avoid green bars shown on some videos
([#8992](https://github.com/google/ExoPlayer/issues/8992)).

### 2.14.0 (2021-05-13)

* Core Library:
Expand Down Expand Up @@ -1023,6 +1074,7 @@ To learn more about what's new in 2.12, read the corresponding
and the range of API levels for which they are supported is too small to
be useful.
* Remove generic types from DRM components.
* Rename `DefaultDrmSessionEventListener` to `DrmSessionEventListener`.
* Track selection:
* Add `TrackSelection.shouldCancelMediaChunkLoad` to check whether an
ongoing load should be canceled
Expand Down
4 changes: 2 additions & 2 deletions constants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.
project.ext {
// ExoPlayer version and version code.
releaseVersion = '2.14.0'
releaseVersionCode = 2014000
releaseVersion = '2.14.1'
releaseVersionCode = 2014001
minSdkVersion = 16
appTargetSdkVersion = 29
targetSdkVersion = 28 // TODO: Bump once b/143232359 is resolved. Also fix TODOs in UtilTest.
Expand Down
5 changes: 2 additions & 3 deletions core_settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
def rootDir = gradle.ext.exoplayerRoot
def rootDir = file(gradle.ext.exoplayerRoot)
if (!gradle.ext.has('exoplayerSettingsDir')) {
gradle.ext.exoplayerSettingsDir =
new File(rootDir.toString()).getCanonicalPath()
gradle.ext.exoplayerSettingsDir = rootDir.getCanonicalPath()
}
def modulePrefix = ':'
if (gradle.ext.has('exoplayerModulePrefix')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
attribute vec2 a_position;
attribute vec2 a_texcoord;
attribute vec4 a_position;
attribute vec4 a_texcoord;
uniform mat4 tex_transform;
varying vec2 v_texcoord;
void main() {
gl_Position = vec4(a_position.x, a_position.y, 0, 1);
v_texcoord = a_texcoord;
gl_Position = a_position;
v_texcoord = (tex_transform * a_texcoord).xy;
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public void initialize() {
GlUtil.Uniform[] uniforms = GlUtil.getUniforms(program);
for (GlUtil.Attribute attribute : attributes) {
if (attribute.name.equals("a_position")) {
attribute.setBuffer(new float[] {-1, -1, 1, -1, -1, 1, 1, 1}, 2);
attribute.setBuffer(new float[] {-1, -1, 0, 1, 1, -1, 0, 1, -1, 1, 0, 1, 1, 1, 0, 1}, 4);
} else if (attribute.name.equals("a_texcoord")) {
attribute.setBuffer(new float[] {0, 1, 1, 1, 0, 0, 1, 0}, 2);
attribute.setBuffer(new float[] {0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1}, 4);
}
}
this.attributes = attributes;
Expand All @@ -111,7 +111,7 @@ public void setSurfaceSize(int width, int height) {
}

@Override
public void draw(int frameTexture, long frameTimestampUs) {
public void draw(int frameTexture, long frameTimestampUs, float[] transformMatrix) {
// Draw to the canvas and store it in a texture.
String text = String.format(Locale.US, "%.02f", frameTimestampUs / (float) C.MICROS_PER_SECOND);
overlayBitmap.eraseColor(Color.TRANSPARENT);
Expand Down Expand Up @@ -140,6 +140,9 @@ public void draw(int frameTexture, long frameTimestampUs) {
case "scaleY":
uniform.setFloat(bitmapScaleY);
break;
case "tex_transform":
uniform.setFloats(transformMatrix);
break;
default: // fall out
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.view.Surface;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.util.Assertions;
Expand Down Expand Up @@ -61,8 +62,9 @@ public interface VideoProcessor {
*
* @param frameTexture The ID of a GL texture containing a video frame.
* @param frameTimestampUs The presentation timestamp of the frame, in microseconds.
* @param transformMatrix The 4 * 4 transform matrix to be applied to the texture.
*/
void draw(int frameTexture, long frameTimestampUs);
void draw(int frameTexture, long frameTimestampUs, float[] transformMatrix);
}

private static final int EGL_PROTECTED_CONTENT_EXT = 0x32C0;
Expand Down Expand Up @@ -214,6 +216,7 @@ private final class VideoRenderer implements GLSurfaceView.Renderer, VideoFrameM
private final VideoProcessor videoProcessor;
private final AtomicBoolean frameAvailable;
private final TimedValueQueue<Long> sampleTimestampQueue;
private final float[] transformMatrix;

private int texture;
@Nullable private SurfaceTexture surfaceTexture;
Expand All @@ -229,6 +232,8 @@ public VideoRenderer(VideoProcessor videoProcessor) {
sampleTimestampQueue = new TimedValueQueue<>();
width = -1;
height = -1;
frameTimestampUs = C.TIME_UNSET;
transformMatrix = new float[16];
}

@Override
Expand Down Expand Up @@ -271,13 +276,14 @@ public void onDrawFrame(GL10 gl) {
SurfaceTexture surfaceTexture = Assertions.checkNotNull(this.surfaceTexture);
surfaceTexture.updateTexImage();
long lastFrameTimestampNs = surfaceTexture.getTimestamp();
Long frameTimestampUs = sampleTimestampQueue.poll(lastFrameTimestampNs);
@Nullable Long frameTimestampUs = sampleTimestampQueue.poll(lastFrameTimestampNs);
if (frameTimestampUs != null) {
this.frameTimestampUs = frameTimestampUs;
}
surfaceTexture.getTransformMatrix(transformMatrix);
}

videoProcessor.draw(texture, frameTimestampUs);
videoProcessor.draw(texture, frameTimestampUs, transformMatrix);
}

@Override
Expand Down
Loading

0 comments on commit b2333c8

Please sign in to comment.