Repository navigation
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consoleengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.p: video_playerThe Video Player pluginThe Video Player pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
This appears to be closely related to the Huawei ImageReader workaround introduced for #166481. The current workaround excludes Huawei devices running API29 and below, but we can reproduce a nearly identical failure signature on a Huawei Kirin9000 device running Android 12 (API31).
Steps to reproduce
-
Create a Flutter application using
video_player. -
Play an H.264 MP4 video using the default
Texturerendering mode (VideoViewType.textureView). -
Run on a Huawei Kirin device:
- Device: NOH-AN01
- Chipset: Kirin 9000
- Android 12 (API 31)
-
Initialize
VideoPlayerController.
Expected results
The video should initialize and play normally.
Actual results
Video initialization fails with:
PlatformException(VideoError)
androidx.media3.exoplayer.ExoPlaybackException
MediaCodecRenderer$DecoderInitializationException
Decoder init failed:
OMX.hisi.video.decoder.avc
Relevant logcat:
format_supported=YES
ImageReader-1x...
native_window_set_buffer_count failed
IGraphicBufferProducer::setBufferCount
Failed to allocate buffers
Codec reported err 0xffffffea
Code sample
final videoPlayerController = VideoPlayerController.networkUrl(
Uri.parse(videoUrl),
);
videoPlayerController.initialize();
Screenshots or Video
No response
Logs
Logs
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: Failed to initialize decoder: OMX.hisi.video.decoder.avc
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: java.lang.IllegalStateException
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at android.media.MediaCodec.native_stop(Native Method)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at android.media.MediaCodec.stop(MediaCodec.java:2300)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.release(SourceFile:40)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter$Factory.createAdapter(SourceFile:16)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(SourceFile:84)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.initCodec(SourceFile:78)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(SourceFile:111)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(SourceFile:83)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onInputFormatChanged(SourceFile:76)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onInputFormatChanged(SourceFile:1)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(SourceFile:22)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(SourceFile:35)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(SourceFile:19)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.RendererHolder.render(SourceFile:11)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(SourceFile:116)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(SourceFile:370)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at android.os.Handler.dispatchMessage(Handler.java:113)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at android.os.Looper.loopOnce(Looper.java:205)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at android.os.Looper.loop(Looper.java:293)
06-25 13:01:50.049 17884 18460 W MediaCodecRenderer: at android.os.HandlerThread.run(HandlerThread.java:110)
06-25 13:01:50.049 2704 2940 I DeviceStateService: app: cn.shuwenkeji.kouyudashi pid: 17884 start mediacodec.
06-25 13:01:50.050 2704 2940 I DeviceStateService: event is too short, not process app: cn.shuwenkeji.kouyudashi mediacodec action.
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: Video codec error
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: androidx.media3.exoplayer.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.hisi.video.decoder.avc, Format(1, null, video/mp4, video/avc, avc1.4D401F, 366136, und, [1920, 1080, 29.989916, ColorInfo(BT709, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1])
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(SourceFile:143)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(SourceFile:83)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onInputFormatChanged(SourceFile:76)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onInputFormatChanged(SourceFile:1)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(SourceFile:22)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(SourceFile:35)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(SourceFile:19)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.RendererHolder.render(SourceFile:11)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(SourceFile:116)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(SourceFile:370)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at android.os.Handler.dispatchMessage(Handler.java:113)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at android.os.Looper.loopOnce(Looper.java:205)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at android.os.Looper.loop(Looper.java:293)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at android.os.HandlerThread.run(HandlerThread.java:110)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: Caused by: java.lang.IllegalStateException
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at android.media.MediaCodec.native_stop(Native Method)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at android.media.MediaCodec.stop(MediaCodec.java:2300)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.release(SourceFile:40)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter$Factory.createAdapter(SourceFile:16)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(SourceFile:84)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.initCodec(SourceFile:78)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(SourceFile:111)
06-25 13:01:50.050 17884 18460 E MediaCodecVideoRenderer: ... 13 more
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: Playback error
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, video/mp4, video/avc, avc1.4D401F, 366136, und, [1920, 1080, 29.989916, ColorInfo(BT709, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1]), format_supported=YES
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.BaseRenderer.createRendererException(SourceFile:10)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.BaseRenderer.createRendererException(SourceFile:1)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(SourceFile:103)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onInputFormatChanged(SourceFile:76)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onInputFormatChanged(SourceFile:1)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(SourceFile:22)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(SourceFile:35)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(SourceFile:19)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.RendererHolder.render(SourceFile:11)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(SourceFile:116)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(SourceFile:370)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at android.os.Handler.dispatchMessage(Handler.java:113)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at android.os.Looper.loopOnce(Looper.java:205)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at android.os.Looper.loop(Looper.java:293)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at android.os.HandlerThread.run(HandlerThread.java:110)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: Caused by: androidx.media3.exoplayer.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.hisi.video.decoder.avc, Format(1, null, video/mp4, video/avc, avc1.4D401F, 366136, und, [1920, 1080, 29.989916, ColorInfo(BT709, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1])
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(SourceFile:143)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(SourceFile:83)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: ... 12 more
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: Caused by: java.lang.IllegalStateException
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at android.media.MediaCodec.native_stop(Native Method)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at android.media.MediaCodec.stop(MediaCodec.java:2300)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.release(SourceFile:40)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter$Factory.createAdapter(SourceFile:16)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(SourceFile:84)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.initCodec(SourceFile:78)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(SourceFile:111)
06-25 13:01:50.051 17884 18460 E ExoPlayerImplInternal: ... 13 more
06-25 13:01:50.051 1370 18445 I VDEC : VIDEO:[vadpt_exit]:[948] vadpt_exit info, sec_flag:0, ref_cnt:1, sec_ref_cnt:0
06-25 13:01:50.051 1370 18445 I Decoder : VIDEO:[~Decoder]:[85] deinitFlutter Doctor output
Doctor output
Flutter version 3.44.2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c9a6c48423
• Engine revision 77e2e94772
• Dart version 3.12.2
• DevTools version 2.57.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, no-enable-swift-package-manager,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [6.8s]
• Emulator version 34.1.20.0 (build_id 11610631) (CL:N/A)
• Platform android-36, build-tools 36.1.0
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
• All Android licenses accepted.Reacted by Dmitry Marinin and N1eR
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consoleengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.p: video_playerThe Video Player pluginThe Video Player pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Activity
dong11 commentedon Jun 25, 2026
Investigation
The following have been verified.
Video file
Verified with multiple encodings:
The same file plays correctly elsewhere.
Media3
The official AndroidX Media3 demo application plays the same MP4 successfully.
Therefore the issue does not appear to be Media3 or ExoPlayer.
Browser
Huawei Browser plays the same MP4 successfully.
video_player_android
Tested with:
Both reproduce the same failure.
Therefore this is not related to the recent
video_player_androidchanges.PlatformView
Using
works correctly.
Texture
Using
fails.
The log shows that Flutter is using:
Important finding
Flutter already contains the Huawei workaround introduced by fix-huawei-imagereader-166481.
Current implementation:
Since this device is running API31, Flutter still selects:
instead of
Verification
Setting
before FlutterEngine initialization makes the same application work correctly on the same device.
Results:
debugForceSurfaceProducerGlTextures=true)No other code changes were made.
Conclusion
This strongly suggests that the issue is not related to:
The issue appears to be specific to Flutter Engine's
ImageReaderSurfaceProduceron Huawei Kirin devices running Android 12 (API31).The workaround added for #166481 appears to solve the same class of issue on API29 devices, but does not currently cover this API31 Huawei device.
Additional information
The failure signature is very similar to the one documented in the existing Huawei workaround:
The only difference is that the device is running Android 12 (API31), so the current workaround is not applied.
If needed, I can provide:
gmackall commentedon Jun 30, 2026
cc @serbandin, and also cc @camsim99 @reidbaker @gaaclarke as reviewers of that pr - should we consider extending to
API_31here?https://github.com/flutter/flutter/blob/master/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java#L87
gmackall commentedon Jun 30, 2026
I'll try to get my hands on an api ~35 huawei device to see if this is broken still on the newer-est versions of android+huawei
serbandin commentedon Jul 7, 2026
Hi, I would do the following test in order to know if that flag would help for API31 as well (I don't have one at hand unfortunately):
Then try setting
FlutterRenderer.debugForceSurfaceProducerGlTextures = truein an example app. If the video plays then that is a strong signal that this method should be updated to include the tested device.gmackall commentedon Jul 15, 2026
Okay I had forgotten they are banned in the us, unassigning as I'm not going to be able to repro
YaKun-SH commentedon Aug 4, 2026
Using VideoViewType.textureView and adding FlutterRenderer. debugForceSurfaceProducerGalTextures=true can indeed solve the problem of video playback issues on Huawei Android 12 (API31). There is a ghosting issue when using VideoViewType.clatformView. Can this problem be solved?
class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
FlutterRenderer.debugForceSurfaceProducerGlTextures = true
super.onCreate(savedInstanceState)
}
}