File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
lib/src/main/java/com/otaliastudios/transcoder/internal Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,17 @@ internal class Codecs(
74
74
val eglWindow = EglWindowSurface (eglContext, surface, true )
75
75
eglWindow.makeCurrent()
76
76
77
+ // On API28 (possibly others) emulator, this happens. If we don't throw early, it fails later with unclear
78
+ // errors - a tombstone dump saying that src.width() & 1 == 0 (basically, complains that surface size is odd)
79
+ // and an error much later on during encoder's dequeue. Surface size is odd because it's 1x1.
80
+ val (eglWidth, eglHeight) = eglWindow.getWidth() to eglWindow.getHeight()
81
+ if (eglWidth != width || eglHeight != height) {
82
+ log.e(" OpenGL surface has wrong size (expected: ${width} x${height} , found: ${eglWindow.getWidth()} x${eglWindow.getHeight()} )." )
83
+ // Throw a clear error in this very specific scenario so we can catch it in tests.
84
+ if (codec.name == " c2.android.avc.encoder" && eglWidth == 1 && eglHeight == 1 ) {
85
+ error(" c2.android.avc.encoder was unable to create the input surface (1x1)." )
86
+ }
87
+ }
77
88
codec to Surface (eglContext, eglWindow)
78
89
}
79
90
You can’t perform that action at this time.
0 commit comments