Skip to content

Commit

Permalink
Avoid skipping the first decoder output buffers after speed change
Browse files Browse the repository at this point in the history
#minor-release

PiperOrigin-RevId: 355652144
  • Loading branch information
kim-vde authored and ojw28 committed Feb 4, 2021
1 parent 7fb166b commit 77798e4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,11 @@ private boolean drainDecoderToFeedSonic() {
MediaCodecAdapterWrapper decoder = checkNotNull(this.decoder);

if (drainingSonicForSpeedChange) {
if (!sonicAudioProcessor.isEnded()) {
// Sonic needs draining, but has not fully drained yet.
return false;
if (sonicAudioProcessor.isEnded() && !sonicOutputBuffer.hasRemaining()) {
flushSonicAndSetSpeed(currentSpeed);
drainingSonicForSpeedChange = false;
}
flushSonicAndSetSpeed(currentSpeed);
drainingSonicForSpeedChange = false;
return false;
}

// Sonic invalidates any previous output buffer when more input is queued, so we don't queue if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,44 @@ sample:
presentationTimeUs = 36499
sample:
trackIndex = 0
dataHashCode = -2124187794
dataHashCode = 250093960
isKeyFrame = true
presentationTimeUs = 44415
sample:
trackIndex = 0
dataHashCode = 1016665126
dataHashCode = 1895536226
isKeyFrame = true
presentationTimeUs = 63081
presentationTimeUs = 59998
sample:
trackIndex = 0
dataHashCode = 1723596464
isKeyFrame = true
presentationTimeUs = 81748
sample:
trackIndex = 0
dataHashCode = -978803114
isKeyFrame = true
presentationTimeUs = 101414
sample:
trackIndex = 0
dataHashCode = 387377078
isKeyFrame = true
presentationTimeUs = 121080
sample:
trackIndex = 0
dataHashCode = -132658698
isKeyFrame = true
presentationTimeUs = 140746
sample:
trackIndex = 0
dataHashCode = 1495036471
isKeyFrame = true
presentationTimeUs = 159496
sample:
trackIndex = 0
dataHashCode = 304440590
isKeyFrame = true
presentationTimeUs = 178162
sample:
trackIndex = 1
dataHashCode = 2139021989
Expand All @@ -151,6 +181,11 @@ sample:
dataHashCode = -1893277090
isKeyFrame = false
presentationTimeUs = 734083
sample:
trackIndex = 0
dataHashCode = -752661703
isKeyFrame = true
presentationTimeUs = 196412
sample:
trackIndex = 1
dataHashCode = -1554795381
Expand Down

0 comments on commit 77798e4

Please sign in to comment.