flutter surface crop bug
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 18/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- android, java
- Domain
- audio-video-rtc, mobile
Research direction
The report concerns the Android VideoOutput class, which requests a surface producer from Flutter's TextureRegistry, and the workaround that reflectively builds a legacy SurfaceTextureSurfaceProducer in place of ImageReaderSurfaceProducer. Start by reproducing the green edge on a cropped or rotated video, then check how the surface producer type changes crop and rotation handling. Done means the crop and rotation render correctly without reflection, or the reflective workaround is confirmed as the supported path.
Written by the indexing model from the issue text.
Description
flutter's new renderer FlutterRenderer.createSurfaceProducer now return ImageReaderSurfaceProducer. this new surface producer do NOT process crop & rotation properly. some video report crop & rotation to surface, but not correctly processed, leave 'green edge' on video output.
my workaround:
VideoOutput(TextureRegistry textureRegistryReference, TextureUpdateCallback textureUpdateCallback) {
this.textureUpdateCallback = textureUpdateCallback;
surfaceProducer = createSurfaceProducer(textureRegistryReference);
surfaceProducer.setCallback(this);
}
static TextureRegistry.SurfaceProducer createSurfaceProducer(TextureRegistry textureRegistryReference) {
if (textureRegistryReference instanceof FlutterRenderer) {
try {
return createSurfaceProducerFromRenderer((FlutterRenderer) textureRegistryReference);
} catch (Throwable e) {
Log.i(TAG, "create surface producer from FlutterRenderer failed", e);
}
} else {
Log.i(TAG, "textureRegistryReference is not FlutterRenderer");
}
return textureRegistryReference.createSurfaceProducer();
}
static TextureRegistry.SurfaceProducer createSurfaceProducerFromRenderer(FlutterRenderer renderer) throws NoSuchFieldException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException {
final Field flutterJNIField = FlutterRenderer.class.getDeclaredField("flutterJNI");
final Field handlerField = FlutterRenderer.class.getDeclaredField("handler");
final Class<?> surfaceTextureSurfaceProducerType = Class.forName("io.flutter.embedding.engine.renderer.SurfaceTextureSurfaceProducer");
Constructor<?> surfaceTextureSurfaceProducerConstructor = surfaceTextureSurfaceProducerType.getDeclaredConstructor(
long.class,
Handler.class,
FlutterJNI.class,
TextureRegistry.SurfaceTextureEntry.class);
flutterJNIField.setAccessible(true);
handlerField.setAccessible(true);
surfaceTextureSurfaceProducerConstructor.setAccessible(true);
FlutterJNI flutterJNI = (FlutterJNI) flutterJNIField.get(renderer);
Handler handler = (Handler) handlerField.get(renderer);
TextureRegistry.SurfaceTextureEntry texture = renderer.createSurfaceTexture();
TextureRegistry.SurfaceProducer producer = (TextureRegistry.SurfaceProducer) surfaceTextureSurfaceProducerConstructor.newInstance(texture.id(), handler, flutterJNI, texture);
Log.d(TAG, "create legacy surface producer from flutter renderer");
return producer;
}
- Dominant language
- Dart
- Stars
- 1.9k
- Forks
- 530
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from media-kit/media-kit
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
All issues in media-kit/media-kit
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
finamp-app/finamp#1920 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 75/100
nucleus-ffm/foss_warn#337 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AppFlowy-IO/AppFlowy#9173 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ubuntu/yaru.dart#1121 · 7 comments · 1 reaction ·
Maintainers usually reply within 1 day