Commit 1726f9e5 by sharjeel Committed by Oliver Woodman

Don't notify drop frames when maxDroppedFramesToNotify < 1

With default of value set to -1, every single dropped frame is reported because of expression: if (droppedFrames >= maxDroppedFramesToNotify) {  maybeNotifyDroppedFrames(); }

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213502573
parent 918a43e4
......@@ -632,7 +632,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
consecutiveDroppedFrameCount += droppedBufferCount;
decoderCounters.maxConsecutiveDroppedBufferCount =
Math.max(consecutiveDroppedFrameCount, decoderCounters.maxConsecutiveDroppedBufferCount);
if (droppedFrames >= maxDroppedFramesToNotify) {
if (maxDroppedFramesToNotify > 0 && droppedFrames >= maxDroppedFramesToNotify) {
maybeNotifyDroppedFrames();
}
}
......
......@@ -160,7 +160,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
allowedJoiningTimeMs,
/* eventHandler= */ null,
/* eventListener= */ null,
-1);
/* maxDroppedFramesToNotify= */ -1);
}
/**
......@@ -171,12 +171,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
* @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
* null if delivery of events is not required.
* @param eventListener A listener of events. May be null if delivery of events is not required.
* @param maxDroppedFrameCountToNotify The maximum number of frames that can be dropped between
* @param maxDroppedFramesToNotify The maximum number of frames that can be dropped between
* invocations of {@link VideoRendererEventListener#onDroppedFrames(int, long)}.
*/
public MediaCodecVideoRenderer(Context context, MediaCodecSelector mediaCodecSelector,
long allowedJoiningTimeMs, @Nullable Handler eventHandler,
@Nullable VideoRendererEventListener eventListener, int maxDroppedFrameCountToNotify) {
public MediaCodecVideoRenderer(
Context context,
MediaCodecSelector mediaCodecSelector,
long allowedJoiningTimeMs,
@Nullable Handler eventHandler,
@Nullable VideoRendererEventListener eventListener,
int maxDroppedFramesToNotify) {
this(
context,
mediaCodecSelector,
......@@ -185,7 +189,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
/* playClearSamplesWithoutKeys= */ false,
eventHandler,
eventListener,
maxDroppedFrameCountToNotify);
maxDroppedFramesToNotify);
}
/**
......@@ -850,7 +854,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
consecutiveDroppedFrameCount += droppedBufferCount;
decoderCounters.maxConsecutiveDroppedBufferCount = Math.max(consecutiveDroppedFrameCount,
decoderCounters.maxConsecutiveDroppedBufferCount);
if (droppedFrames >= maxDroppedFramesToNotify) {
if (maxDroppedFramesToNotify > 0 && droppedFrames >= maxDroppedFramesToNotify) {
maybeNotifyDroppedFrames();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment