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
7b8f33e8
authored
Jan 24, 2022
by
kimvde
Committed by
Ian Baker
Jan 25, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Various nits in Transformer
PiperOrigin-RevId: 423822317
parent
8f3439ae
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
26 deletions
libraries/transformer/src/main/java/androidx/media3/transformer/AudioSamplePipeline.java → libraries/transformer/src/main/java/androidx/media3/transformer/AudioTranscodingSamplePipeline.java
libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java
libraries/transformer/src/main/java/androidx/media3/transformer/TransformerAudioRenderer.java
libraries/transformer/src/main/java/androidx/media3/transformer/TransformerVideoRenderer.java
libraries/transformer/src/main/java/androidx/media3/transformer/VideoSamplePipeline.java → libraries/transformer/src/main/java/androidx/media3/transformer/VideoTranscodingSamplePipeline.java
libraries/transformer/src/main/java/androidx/media3/transformer/AudioSamplePipeline.java
→
libraries/transformer/src/main/java/androidx/media3/transformer/Audio
Transcoding
SamplePipeline.java
View file @
7b8f33e8
...
...
@@ -18,7 +18,6 @@ package androidx.media3.transformer;
import
static
androidx
.
media3
.
common
.
util
.
Assertions
.
checkNotNull
;
import
static
androidx
.
media3
.
common
.
util
.
Assertions
.
checkState
;
import
static
androidx
.
media3
.
common
.
util
.
Assertions
.
checkStateNotNull
;
import
static
java
.
lang
.
Math
.
min
;
import
android.media.MediaCodec.BufferInfo
;
...
...
@@ -37,9 +36,8 @@ import org.checkerframework.dataflow.qual.Pure;
/**
* Pipeline to decode audio samples, apply transformations on the raw samples, and re-encode them.
*/
/* package */
final
class
AudioSamplePipeline
implements
SamplePipeline
{
/* package */
final
class
Audio
Transcoding
SamplePipeline
implements
SamplePipeline
{
private
static
final
String
TAG
=
"AudioSamplePipeline"
;
private
static
final
int
DEFAULT_ENCODER_BITRATE
=
128
*
1024
;
private
final
Codec
decoder
;
...
...
@@ -61,7 +59,7 @@ import org.checkerframework.dataflow.qual.Pure;
private
boolean
drainingSonicForSpeedChange
;
private
float
currentSpeed
;
public
AudioSamplePipeline
(
public
Audio
Transcoding
SamplePipeline
(
Format
inputFormat
,
TransformationRequest
transformationRequest
,
Codec
.
DecoderFactory
decoderFactory
,
...
...
@@ -142,40 +140,36 @@ import org.checkerframework.dataflow.qual.Pure;
@Override
@Nullable
public
Format
getOutputFormat
()
throws
TransformationException
{
return
encoder
!=
null
?
encoder
.
getOutputFormat
()
:
null
;
return
encoder
.
getOutputFormat
()
;
}
@Override
@Nullable
public
DecoderInputBuffer
getOutputBuffer
()
throws
TransformationException
{
if
(
encoder
!=
null
)
{
encoderOutputBuffer
.
data
=
encoder
.
getOutputBuffer
();
if
(
encoderOutputBuffer
.
data
!=
null
)
{
encoderOutputBuffer
.
timeUs
=
checkNotNull
(
encoder
.
getOutputBufferInfo
()).
presentationTimeUs
;
encoderOutputBuffer
.
setFlags
(
C
.
BUFFER_FLAG_KEY_FRAME
);
return
encoderOutputBuffer
;
}
encoderOutputBuffer
.
data
=
encoder
.
getOutputBuffer
();
if
(
encoderOutputBuffer
.
data
==
null
)
{
return
null
;
}
return
null
;
encoderOutputBuffer
.
timeUs
=
checkNotNull
(
encoder
.
getOutputBufferInfo
()).
presentationTimeUs
;
encoderOutputBuffer
.
setFlags
(
C
.
BUFFER_FLAG_KEY_FRAME
);
return
encoderOutputBuffer
;
}
@Override
public
void
releaseOutputBuffer
()
throws
TransformationException
{
checkStateNotNull
(
encoder
)
.
releaseOutputBuffer
();
encoder
.
releaseOutputBuffer
();
}
@Override
public
boolean
isEnded
()
{
return
encoder
!=
null
&&
encoder
.
isEnded
();
return
encoder
.
isEnded
();
}
@Override
public
void
release
()
{
sonicAudioProcessor
.
reset
();
decoder
.
release
();
if
(
encoder
!=
null
)
{
encoder
.
release
();
}
encoder
.
release
();
}
/**
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java
View file @
7b8f33e8
...
...
@@ -919,7 +919,7 @@ public final class Transformer {
@Override
public
void
onPlayerError
(
PlaybackException
error
)
{
Throwable
cause
=
error
.
getCause
();
@Nullable
Throwable
cause
=
error
.
getCause
();
handleTransformationEnded
(
cause
instanceof
TransformationException
?
(
TransformationException
)
cause
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/TransformerAudioRenderer.java
View file @
7b8f33e8
...
...
@@ -73,7 +73,7 @@ import androidx.media3.extractor.metadata.mp4.SlowMotionData;
new
PassthroughSamplePipeline
(
inputFormat
,
transformationRequest
,
fallbackListener
);
}
else
{
samplePipeline
=
new
AudioSamplePipeline
(
new
Audio
Transcoding
SamplePipeline
(
inputFormat
,
transformationRequest
,
decoderFactory
,
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/TransformerVideoRenderer.java
View file @
7b8f33e8
...
...
@@ -82,7 +82,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
new
PassthroughSamplePipeline
(
inputFormat
,
transformationRequest
,
fallbackListener
);
}
else
{
samplePipeline
=
new
VideoSamplePipeline
(
new
Video
Transcoding
SamplePipeline
(
context
,
inputFormat
,
transformationRequest
,
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/VideoSamplePipeline.java
→
libraries/transformer/src/main/java/androidx/media3/transformer/Video
Transcoding
SamplePipeline.java
View file @
7b8f33e8
...
...
@@ -36,9 +36,7 @@ import org.checkerframework.dataflow.qual.Pure;
/**
* Pipeline to decode video samples, apply transformations on the raw samples, and re-encode them.
*/
/* package */
final
class
VideoSamplePipeline
implements
SamplePipeline
{
private
static
final
String
TAG
=
"VideoSamplePipeline"
;
/* package */
final
class
VideoTranscodingSamplePipeline
implements
SamplePipeline
{
private
final
int
outputRotationDegrees
;
private
final
DecoderInputBuffer
decoderInputBuffer
;
...
...
@@ -51,7 +49,7 @@ import org.checkerframework.dataflow.qual.Pure;
private
boolean
waitingForFrameEditorInput
;
public
VideoSamplePipeline
(
public
Video
Transcoding
SamplePipeline
(
Context
context
,
Format
inputFormat
,
TransformationRequest
transformationRequest
,
...
...
@@ -233,7 +231,7 @@ import org.checkerframework.dataflow.qual.Pure;
@Override
@Nullable
public
Format
getOutputFormat
()
throws
TransformationException
{
Format
format
=
encoder
.
getOutputFormat
();
@Nullable
Format
format
=
encoder
.
getOutputFormat
();
return
format
==
null
?
null
:
format
.
buildUpon
().
setRotationDegrees
(
outputRotationDegrees
).
build
();
...
...
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