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
32c5ea06
authored
Apr 20, 2021
by
olly
Committed by
Oliver Woodman
Apr 21, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Adds Format to MediaCodecAdapter.Configuration.
PiperOrigin-RevId: 369444747
parent
efce7b9e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
3 deletions
library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecAdapter.java
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
library/core/src/test/java/com/google/android/exoplayer2/mediacodec/AsynchronousMediaCodecAdapterTest.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/MediaCodecAdapterWrapper.java
library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java
View file @
32c5ea06
...
@@ -362,7 +362,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
...
@@ -362,7 +362,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
&&
!
MimeTypes
.
AUDIO_RAW
.
equals
(
format
.
sampleMimeType
);
&&
!
MimeTypes
.
AUDIO_RAW
.
equals
(
format
.
sampleMimeType
);
decryptOnlyCodecFormat
=
decryptOnlyCodecEnabled
?
format
:
null
;
decryptOnlyCodecFormat
=
decryptOnlyCodecEnabled
?
format
:
null
;
return
new
MediaCodecAdapter
.
Configuration
(
return
new
MediaCodecAdapter
.
Configuration
(
codecInfo
,
mediaFormat
,
/* surface= */
null
,
crypto
,
/* flags= */
0
);
codecInfo
,
mediaFormat
,
format
,
/* surface= */
null
,
crypto
,
/* flags= */
0
);
}
}
@Override
@Override
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecAdapter.java
View file @
32c5ea06
...
@@ -25,6 +25,7 @@ import android.view.Surface;
...
@@ -25,6 +25,7 @@ import android.view.Surface;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
androidx.annotation.RequiresApi
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.decoder.CryptoInfo
;
import
com.google.android.exoplayer2.decoder.CryptoInfo
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
...
@@ -37,11 +38,13 @@ import java.nio.ByteBuffer;
...
@@ -37,11 +38,13 @@ import java.nio.ByteBuffer;
*/
*/
public
interface
MediaCodecAdapter
{
public
interface
MediaCodecAdapter
{
/** Configuration parameters for a {@link MediaCodecAdapter}. */
/** Configuration parameters for a {@link MediaCodecAdapter}. */
class
Configuration
{
final
class
Configuration
{
/** Information about the {@link MediaCodec} being configured. */
/** Information about the {@link MediaCodec} being configured. */
public
final
MediaCodecInfo
codecInfo
;
public
final
MediaCodecInfo
codecInfo
;
/** The {@link MediaFormat} for which the codec is being configured. */
/** The {@link MediaFormat} for which the codec is being configured. */
public
final
MediaFormat
mediaFormat
;
public
final
MediaFormat
mediaFormat
;
/** The {@link Format} for which the codec is being configured. */
public
final
Format
format
;
/** For video playbacks, the output where the object will render the decoded frames. */
/** For video playbacks, the output where the object will render the decoded frames. */
@Nullable
public
final
Surface
surface
;
@Nullable
public
final
Surface
surface
;
/** For DRM protected playbacks, a {@link MediaCrypto} to use for decryption. */
/** For DRM protected playbacks, a {@link MediaCrypto} to use for decryption. */
...
@@ -56,11 +59,13 @@ public interface MediaCodecAdapter {
...
@@ -56,11 +59,13 @@ public interface MediaCodecAdapter {
public
Configuration
(
public
Configuration
(
MediaCodecInfo
codecInfo
,
MediaCodecInfo
codecInfo
,
MediaFormat
mediaFormat
,
MediaFormat
mediaFormat
,
Format
format
,
@Nullable
Surface
surface
,
@Nullable
Surface
surface
,
@Nullable
MediaCrypto
crypto
,
@Nullable
MediaCrypto
crypto
,
int
flags
)
{
int
flags
)
{
this
.
codecInfo
=
codecInfo
;
this
.
codecInfo
=
codecInfo
;
this
.
mediaFormat
=
mediaFormat
;
this
.
mediaFormat
=
mediaFormat
;
this
.
format
=
format
;
this
.
surface
=
surface
;
this
.
surface
=
surface
;
this
.
crypto
=
crypto
;
this
.
crypto
=
crypto
;
this
.
flags
=
flags
;
this
.
flags
=
flags
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
View file @
32c5ea06
...
@@ -625,7 +625,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -625,7 +625,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
surface
=
dummySurface
;
surface
=
dummySurface
;
}
}
return
new
MediaCodecAdapter
.
Configuration
(
return
new
MediaCodecAdapter
.
Configuration
(
codecInfo
,
mediaFormat
,
surface
,
crypto
,
/* flags= */
0
);
codecInfo
,
mediaFormat
,
format
,
surface
,
crypto
,
/* flags= */
0
);
}
}
@Override
@Override
...
...
library/core/src/test/java/com/google/android/exoplayer2/mediacodec/AsynchronousMediaCodecAdapterTest.java
View file @
32c5ea06
...
@@ -24,6 +24,7 @@ import android.media.MediaCodec;
...
@@ -24,6 +24,7 @@ import android.media.MediaCodec;
import
android.media.MediaFormat
;
import
android.media.MediaFormat
;
import
android.os.HandlerThread
;
import
android.os.HandlerThread
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.Format
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Constructor
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -45,6 +46,7 @@ public class AsynchronousMediaCodecAdapterTest {
...
@@ -45,6 +46,7 @@ public class AsynchronousMediaCodecAdapterTest {
new
MediaCodecAdapter
.
Configuration
(
new
MediaCodecAdapter
.
Configuration
(
codecInfo
,
codecInfo
,
createMediaFormat
(
"format"
),
createMediaFormat
(
"format"
),
/* format= */
new
Format
.
Builder
().
build
(),
/* surface= */
null
,
/* surface= */
null
,
/* crypto= */
null
,
/* crypto= */
null
,
/* flags= */
0
);
/* flags= */
0
);
...
...
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/MediaCodecAdapterWrapper.java
View file @
32c5ea06
...
@@ -116,6 +116,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -116,6 +116,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
new
MediaCodecAdapter
.
Configuration
(
new
MediaCodecAdapter
.
Configuration
(
createPlaceholderMediaCodecInfo
(),
createPlaceholderMediaCodecInfo
(),
mediaFormat
,
mediaFormat
,
format
,
/* surface= */
null
,
/* surface= */
null
,
/* crypto= */
null
,
/* crypto= */
null
,
/* flags= */
0
));
/* flags= */
0
));
...
@@ -151,6 +152,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -151,6 +152,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
new
MediaCodecAdapter
.
Configuration
(
new
MediaCodecAdapter
.
Configuration
(
createPlaceholderMediaCodecInfo
(),
createPlaceholderMediaCodecInfo
(),
mediaFormat
,
mediaFormat
,
format
,
/* surface= */
null
,
/* surface= */
null
,
/* crypto= */
null
,
/* crypto= */
null
,
/* flags= */
MediaCodec
.
CONFIGURE_FLAG_ENCODE
));
/* flags= */
MediaCodec
.
CONFIGURE_FLAG_ENCODE
));
...
...
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