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
33c37ebc
authored
Nov 20, 2014
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix AudioTrack position reporting whilst paused.
Issue: #158
parent
2a832fd3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
library/src/main/java/com/google/android/exoplayer/audio/AudioTrack.java
library/src/main/java/com/google/android/exoplayer/audio/AudioTrack.java
View file @
33c37ebc
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
*/
*/
package
com
.
google
.
android
.
exoplayer
.
audio
;
package
com
.
google
.
android
.
exoplayer
.
audio
;
import
com.google.android.exoplayer.ExoPlaybackException
;
import
com.google.android.exoplayer.util.Assertions
;
import
com.google.android.exoplayer.util.Assertions
;
import
com.google.android.exoplayer.util.Util
;
import
com.google.android.exoplayer.util.Util
;
...
@@ -192,9 +191,12 @@ public final class AudioTrack {
...
@@ -192,9 +191,12 @@ public final class AudioTrack {
return
CURRENT_POSITION_NOT_SET
;
return
CURRENT_POSITION_NOT_SET
;
}
}
if
(
audioTrack
.
getPlayState
()
==
android
.
media
.
AudioTrack
.
PLAYSTATE_PLAYING
)
{
maybeSampleSyncParams
();
}
long
systemClockUs
=
System
.
nanoTime
()
/
1000
;
long
systemClockUs
=
System
.
nanoTime
()
/
1000
;
long
currentPositionUs
;
long
currentPositionUs
;
maybeSampleSyncParams
();
if
(
audioTimestampSet
)
{
if
(
audioTimestampSet
)
{
// How long ago in the past the audio timestamp is (negative if it's in the future).
// How long ago in the past the audio timestamp is (negative if it's in the future).
long
presentationDiff
=
systemClockUs
-
(
audioTimestampCompat
.
getNanoTime
()
/
1000
);
long
presentationDiff
=
systemClockUs
-
(
audioTimestampCompat
.
getNanoTime
()
/
1000
);
...
@@ -508,10 +510,6 @@ public final class AudioTrack {
...
@@ -508,10 +510,6 @@ public final class AudioTrack {
/** Updates the audio track latency and playback position parameters. */
/** Updates the audio track latency and playback position parameters. */
private
void
maybeSampleSyncParams
()
{
private
void
maybeSampleSyncParams
()
{
if
(!
hasCurrentPositionUs
())
{
return
;
}
long
playbackPositionUs
=
getPlaybackPositionUs
();
long
playbackPositionUs
=
getPlaybackPositionUs
();
if
(
playbackPositionUs
==
0
)
{
if
(
playbackPositionUs
==
0
)
{
// The AudioTrack hasn't output anything yet.
// The AudioTrack hasn't output anything yet.
...
@@ -574,7 +572,7 @@ public final class AudioTrack {
...
@@ -574,7 +572,7 @@ public final class AudioTrack {
* method is a no-op. If it hasn't then {@link #audioTrack} is released and set to null, and an
* method is a no-op. If it hasn't then {@link #audioTrack} is released and set to null, and an
* exception is thrown.
* exception is thrown.
*
*
* @throws
ExoPlayback
Exception If {@link #audioTrack} has not been successfully initialized.
* @throws
Initialization
Exception If {@link #audioTrack} has not been successfully initialized.
*/
*/
private
void
checkAudioTrackInitialized
()
throws
InitializationException
{
private
void
checkAudioTrackInitialized
()
throws
InitializationException
{
int
state
=
audioTrack
.
getState
();
int
state
=
audioTrack
.
getState
();
...
...
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