本文整理汇总了Java中com.google.android.exoplayer.audio.AudioTrack.CURRENT_POSITION_NOT_SET属性的典型用法代码示例。如果您正苦于以下问题:Java AudioTrack.CURRENT_POSITION_NOT_SET属性的具体用法?Java AudioTrack.CURRENT_POSITION_NOT_SET怎么用?Java AudioTrack.CURRENT_POSITION_NOT_SET使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.android.exoplayer.audio.AudioTrack
的用法示例。
在下文中一共展示了AudioTrack.CURRENT_POSITION_NOT_SET属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPositionUs
@Override
public long getPositionUs() {
if (!AUDIO_TRACK.isInitialized()) {
return mAudioClock.getPositionUs();
} else if (!AUDIO_TRACK.isEnabled()) {
if (mInterpolatedTimeUs > 0) {
return mInterpolatedTimeUs - ESTIMATED_TRACK_RENDERING_DELAY_US;
}
return mPresentationTimeUs;
}
long audioTrackCurrentPositionUs = AUDIO_TRACK.getCurrentPositionUs(isEnded());
if (audioTrackCurrentPositionUs == AudioTrack.CURRENT_POSITION_NOT_SET) {
mPreviousPositionUs = 0L;
if (DEBUG) {
long oldPositionUs = Math.max(mCurrentPositionUs, 0);
long currentPositionUs = Math.max(mPresentationTimeUs, mCurrentPositionUs);
Log.d(TAG, "Audio position is not set, diff in us: "
+ String.valueOf(currentPositionUs - oldPositionUs));
}
mCurrentPositionUs = Math.max(mPresentationTimeUs, mCurrentPositionUs);
} else {
if (mPreviousPositionUs
> audioTrackCurrentPositionUs + BACKWARD_AUDIO_TRACK_MOVE_THRESHOLD_US) {
Log.e(TAG, "audio_position BACK JUMP: "
+ (mPreviousPositionUs - audioTrackCurrentPositionUs));
mCurrentPositionUs = audioTrackCurrentPositionUs;
} else {
mCurrentPositionUs = Math.max(mCurrentPositionUs, audioTrackCurrentPositionUs);
}
mPreviousPositionUs = audioTrackCurrentPositionUs;
}
long upperBound = mPresentationTimeUs + CURRENT_POSITION_FROM_PTS_LIMIT_US;
if (mCurrentPositionUs > upperBound) {
mCurrentPositionUs = upperBound;
}
return mCurrentPositionUs;
}
示例2: getPositionUs
@Override
public long getPositionUs() {
long newCurrentPositionUs = audioTrack.getCurrentPositionUs(isEnded());
if (newCurrentPositionUs != AudioTrack.CURRENT_POSITION_NOT_SET) {
currentPositionUs = allowPositionDiscontinuity
? newCurrentPositionUs
: Math.max(currentPositionUs, newCurrentPositionUs);
allowPositionDiscontinuity = false;
}
return (long) (currentPositionUs * audioTrack.getPlaybackSpeed());
}
示例3: getPositionUs
@Override
public long getPositionUs() {
long newCurrentPositionUs = audioTrack.getCurrentPositionUs(isEnded());
if (newCurrentPositionUs != AudioTrack.CURRENT_POSITION_NOT_SET) {
currentPositionUs = allowPositionDiscontinuity ? newCurrentPositionUs
: Math.max(currentPositionUs, newCurrentPositionUs);
allowPositionDiscontinuity = false;
}
return currentPositionUs;
}