File tree Expand file tree Collapse file tree
lib/src/main/java/com/otaliastudios/transcoder/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,6 +74,17 @@ internal class Codecs(
7474 val eglWindow = EglWindowSurface (eglContext, surface, true )
7575 eglWindow.makeCurrent()
7676
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+ }
7788 codec to Surface (eglContext, eglWindow)
7889 }
7990
You can’t perform that action at this time.
0 commit comments