AndroidVideoDecoder: Ignore format updates with zero dimensions
Sometimes c2.qti.vp8.decoder reports format updates with zero frame width / height right after initialization, that leads to the precondition check failure made by SurfaceTextureHelper.setTextureSize. This patch makes AndroidVideoDecoder.reformat to ignore such format updates so as to continue to use this HW decoder. It seems to be safe because this decoder singals one more format update with valid dimensions soon and continue to operate in normal mode. Bug: webrtc:12492 Change-Id: I5155166637bd2d4247d31e608d714e687e0ad1df Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208222 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33332}
This commit is contained in:
@ -585,13 +585,21 @@ class AndroidVideoDecoder implements VideoDecoder, VideoSink {
|
||||
}
|
||||
// Compare to existing width, height, and save values under the dimension lock.
|
||||
synchronized (dimensionLock) {
|
||||
if (hasDecodedFirstFrame && (width != newWidth || height != newHeight)) {
|
||||
stopOnOutputThread(new RuntimeException("Unexpected size change. Configured " + width + "*"
|
||||
+ height + ". New " + newWidth + "*" + newHeight));
|
||||
return;
|
||||
if (newWidth != width || newHeight != height) {
|
||||
if (hasDecodedFirstFrame) {
|
||||
stopOnOutputThread(new RuntimeException("Unexpected size change. "
|
||||
+ "Configured " + width + "*" + height + ". "
|
||||
+ "New " + newWidth + "*" + newHeight));
|
||||
return;
|
||||
} else if (newWidth <= 0 || newHeight <= 0) {
|
||||
Logging.w(TAG,
|
||||
"Unexpected format dimensions. Configured " + width + "*" + height + ". "
|
||||
+ "New " + newWidth + "*" + newHeight + ". Skip it");
|
||||
return;
|
||||
}
|
||||
width = newWidth;
|
||||
height = newHeight;
|
||||
}
|
||||
width = newWidth;
|
||||
height = newHeight;
|
||||
}
|
||||
|
||||
// Note: texture mode ignores colorFormat. Hence, if the texture helper is non-null, skip
|
||||
|
||||
Reference in New Issue
Block a user