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
This commit is contained in:
parent
918a43e48d
commit
1726f9e5fe
@ -632,7 +632,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
|
|||||||
consecutiveDroppedFrameCount += droppedBufferCount;
|
consecutiveDroppedFrameCount += droppedBufferCount;
|
||||||
decoderCounters.maxConsecutiveDroppedBufferCount =
|
decoderCounters.maxConsecutiveDroppedBufferCount =
|
||||||
Math.max(consecutiveDroppedFrameCount, decoderCounters.maxConsecutiveDroppedBufferCount);
|
Math.max(consecutiveDroppedFrameCount, decoderCounters.maxConsecutiveDroppedBufferCount);
|
||||||
if (droppedFrames >= maxDroppedFramesToNotify) {
|
if (maxDroppedFramesToNotify > 0 && droppedFrames >= maxDroppedFramesToNotify) {
|
||||||
maybeNotifyDroppedFrames();
|
maybeNotifyDroppedFrames();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||||||
allowedJoiningTimeMs,
|
allowedJoiningTimeMs,
|
||||||
/* eventHandler= */ null,
|
/* eventHandler= */ null,
|
||||||
/* eventListener= */ 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
|
* @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
|
||||||
* null if delivery of events is not required.
|
* 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 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)}.
|
* invocations of {@link VideoRendererEventListener#onDroppedFrames(int, long)}.
|
||||||
*/
|
*/
|
||||||
public MediaCodecVideoRenderer(Context context, MediaCodecSelector mediaCodecSelector,
|
public MediaCodecVideoRenderer(
|
||||||
long allowedJoiningTimeMs, @Nullable Handler eventHandler,
|
Context context,
|
||||||
@Nullable VideoRendererEventListener eventListener, int maxDroppedFrameCountToNotify) {
|
MediaCodecSelector mediaCodecSelector,
|
||||||
|
long allowedJoiningTimeMs,
|
||||||
|
@Nullable Handler eventHandler,
|
||||||
|
@Nullable VideoRendererEventListener eventListener,
|
||||||
|
int maxDroppedFramesToNotify) {
|
||||||
this(
|
this(
|
||||||
context,
|
context,
|
||||||
mediaCodecSelector,
|
mediaCodecSelector,
|
||||||
@ -185,7 +189,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||||||
/* playClearSamplesWithoutKeys= */ false,
|
/* playClearSamplesWithoutKeys= */ false,
|
||||||
eventHandler,
|
eventHandler,
|
||||||
eventListener,
|
eventListener,
|
||||||
maxDroppedFrameCountToNotify);
|
maxDroppedFramesToNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -850,7 +854,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||||||
consecutiveDroppedFrameCount += droppedBufferCount;
|
consecutiveDroppedFrameCount += droppedBufferCount;
|
||||||
decoderCounters.maxConsecutiveDroppedBufferCount = Math.max(consecutiveDroppedFrameCount,
|
decoderCounters.maxConsecutiveDroppedBufferCount = Math.max(consecutiveDroppedFrameCount,
|
||||||
decoderCounters.maxConsecutiveDroppedBufferCount);
|
decoderCounters.maxConsecutiveDroppedBufferCount);
|
||||||
if (droppedFrames >= maxDroppedFramesToNotify) {
|
if (maxDroppedFramesToNotify > 0 && droppedFrames >= maxDroppedFramesToNotify) {
|
||||||
maybeNotifyDroppedFrames();
|
maybeNotifyDroppedFrames();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user