Skip to content

Commit

Permalink
Cherry pick PR #807: [android] Reset frame rate estimator when the st…
Browse files Browse the repository at this point in the history
…ream fps changed (#807) (#1062)

Cherry pick PR #807: [android] Reset frame rate estimator when the
stream fps changed (#807)

Refer to the original PR: #807

When playing a stream, the key operating rate is set to MediaCodec for
resource planning. It's calculated by the playback rate and the
estimated fps. While the latter is calculated by the number of rendered
frames in duration. When the stream fps is changed, the estimated fps
will be affected by the frames already rendered with the old fps and
slowly adjusted to the new fps. This may lead to insufficient resources
prepared for the stream and cause some performance issues.

b/290409989

Change-Id: I5126794d0ac98d29fc8405359bcb4f62dc444308
  • Loading branch information
mingchou authored Jul 29, 2023
1 parent c014690 commit 44d28a4
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ public void onOutputFormatChanged(MediaCodec codec, MediaFormat format) {
return;
}
nativeOnMediaCodecOutputFormatChanged(mNativeMediaCodecBridge);
if (mFrameRateEstimator != null) {
mFrameRateEstimator.reset();
}
}
}
};
Expand Down

0 comments on commit 44d28a4

Please sign in to comment.