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
21fe2f1e
authored
Jul 22, 2020
by
olly
Committed by
Oliver Woodman
Jul 24, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Make the output mode more explicit in DefaultAudioSink
PiperOrigin-RevId: 322609230
parent
bdadd572
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
library/core/src/main/java/com/google/android/exoplayer2/audio/AudioTrackPositionTracker.java
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
library/core/src/main/java/com/google/android/exoplayer2/audio/AudioTrackPositionTracker.java
View file @
21fe2f1e
...
@@ -34,12 +34,12 @@ import java.lang.reflect.Method;
...
@@ -34,12 +34,12 @@ import java.lang.reflect.Method;
* Wraps an {@link AudioTrack}, exposing a position based on {@link
* Wraps an {@link AudioTrack}, exposing a position based on {@link
* AudioTrack#getPlaybackHeadPosition()} and {@link AudioTrack#getTimestamp(AudioTimestamp)}.
* AudioTrack#getPlaybackHeadPosition()} and {@link AudioTrack#getTimestamp(AudioTimestamp)}.
*
*
* <p>Call {@link #setAudioTrack(AudioTrack,
int, int, int)} to set the audio track to wrap. Call
* <p>Call {@link #setAudioTrack(AudioTrack,
boolean, int, int, int)} to set the audio track to
*
{@link #mayHandleBuffer(long)} if there is input data to write to the track. If it returns false,
*
wrap. Call {@link #mayHandleBuffer(long)} if there is input data to write to the track. If it
*
the audio track position is stabilizing and no data may be written. Call {@link #start()}
*
returns false, the audio track position is stabilizing and no data may be written. Call {@link
*
immediately before calling {@link AudioTrack#play()}. Call {@link #pause()} when pausing the
*
#start()} immediately before calling {@link AudioTrack#play()}. Call {@link #pause()} when
*
track. Call {@link #handleEndOfStream(long)} when no more data will be written to the track. When
*
pausing the track. Call {@link #handleEndOfStream(long)} when no more data will be written to the
* the audio track will no longer be used, call {@link #reset()}.
* t
rack. When t
he audio track will no longer be used, call {@link #reset()}.
*/
*/
/* package */
final
class
AudioTrackPositionTracker
{
/* package */
final
class
AudioTrackPositionTracker
{
...
@@ -193,6 +193,7 @@ import java.lang.reflect.Method;
...
@@ -193,6 +193,7 @@ import java.lang.reflect.Method;
* track's position, until the next call to {@link #reset()}.
* track's position, until the next call to {@link #reset()}.
*
*
* @param audioTrack The audio track to wrap.
* @param audioTrack The audio track to wrap.
* @param isPassthrough Whether passthrough mode is being used.
* @param outputEncoding The encoding of the audio track.
* @param outputEncoding The encoding of the audio track.
* @param outputPcmFrameSize For PCM output encodings, the frame size. The value is ignored
* @param outputPcmFrameSize For PCM output encodings, the frame size. The value is ignored
* otherwise.
* otherwise.
...
@@ -200,6 +201,7 @@ import java.lang.reflect.Method;
...
@@ -200,6 +201,7 @@ import java.lang.reflect.Method;
*/
*/
public
void
setAudioTrack
(
public
void
setAudioTrack
(
AudioTrack
audioTrack
,
AudioTrack
audioTrack
,
boolean
isPassthrough
,
@C
.
Encoding
int
outputEncoding
,
@C
.
Encoding
int
outputEncoding
,
int
outputPcmFrameSize
,
int
outputPcmFrameSize
,
int
bufferSize
)
{
int
bufferSize
)
{
...
@@ -208,7 +210,7 @@ import java.lang.reflect.Method;
...
@@ -208,7 +210,7 @@ import java.lang.reflect.Method;
this
.
bufferSize
=
bufferSize
;
this
.
bufferSize
=
bufferSize
;
audioTimestampPoller
=
new
AudioTimestampPoller
(
audioTrack
);
audioTimestampPoller
=
new
AudioTimestampPoller
(
audioTrack
);
outputSampleRate
=
audioTrack
.
getSampleRate
();
outputSampleRate
=
audioTrack
.
getSampleRate
();
needsPassthroughWorkarounds
=
needsPassthroughWorkarounds
(
outputEncoding
);
needsPassthroughWorkarounds
=
isPassthrough
&&
needsPassthroughWorkarounds
(
outputEncoding
);
isOutputPcm
=
Util
.
isEncodingLinearPcm
(
outputEncoding
);
isOutputPcm
=
Util
.
isEncodingLinearPcm
(
outputEncoding
);
bufferSizeUs
=
isOutputPcm
?
framesToDurationUs
(
bufferSize
/
outputPcmFrameSize
)
:
C
.
TIME_UNSET
;
bufferSizeUs
=
isOutputPcm
?
framesToDurationUs
(
bufferSize
/
outputPcmFrameSize
)
:
C
.
TIME_UNSET
;
lastRawPlaybackHeadPosition
=
0
;
lastRawPlaybackHeadPosition
=
0
;
...
@@ -390,7 +392,7 @@ import java.lang.reflect.Method;
...
@@ -390,7 +392,7 @@ import java.lang.reflect.Method;
/**
/**
* Resets the position tracker. Should be called when the audio track previously passed to {@link
* Resets the position tracker. Should be called when the audio track previously passed to {@link
* #setAudioTrack(AudioTrack, int, int, int)} is no longer in use.
* #setAudioTrack(AudioTrack,
boolean,
int, int, int)} is no longer in use.
*/
*/
public
void
reset
()
{
public
void
reset
()
{
resetSyncParams
();
resetSyncParams
();
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
View file @
21fe2f1e
This diff is collapsed.
Click to expand it.
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