Repository: flutter
Issue: [video_player][Android TV] com.google.android.exoplayer2.ExoPlaybackException
Labels: e: device-specific,platform-android,p: video_player,package,has reproducible steps,P2,found in release: 2.2,team-android,triaged-android

Video player is not working. When I try to open it it results in this exception

```
I/art     (32290): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
I/art     (32290): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
I/art     (32290): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
I/art     (32290): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
I/art     (32290): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
I/ExoPlayerImpl(32290): Init 314f79d1 [ExoPlayerLib/2.12.1] [generic_x86, sdk_google_atv_x86, unknown, 22]
I/VideoCapabilities(32290): Unsupported profile 4 for video/mp4v-es
I/OMXClient(32290): Using client-side OMX mux.
W/OMXNodeInstance(32290): [1:google.h264.decoder] component does not support metadata mode; using fallback
E/ACodec  (32290): [OMX.google.h264.decoder] storeMetaDataInBuffers failed w/ err -1010
I/OMXClient(32290): Using client-side OMX mux.
I/SoftAAC2(32290): limiting to stereo output
I/SoftAAC2(32290): Reconfiguring decoder: 0->48000 Hz, 0->2 channels
E/SoftAVC (32290): Decoder failed: -2
E/ACodec  (32290): [OMX.google.h264.decoder] ERROR(0x80001001)
E/ACodec  (32290): signalError(omxError 0x80001001, internalError -2147483648)
E/MediaCodec(32290): Codec reported err 0x80001001, actionCode 0, while in state 6
E/ExoPlayerImplInternal(32290): Playback error
E/ExoPlayerImplInternal(32290):   com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, null, -1, null, [1280, 720, 25.0], [-1, -1]), format_supported=YES
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:542)
E/ExoPlayerImplInternal(32290):       at android.os.Handler.dispatchMessage(Handler.java:98)
E/ExoPlayerImplInternal(32290):       at android.os.Looper.loop(Looper.java:135)
E/ExoPlayerImplInternal(32290):       at android.os.HandlerThread.run(HandlerThread.java:61)
E/ExoPlayerImplInternal(32290):   Caused by: com.google.android.exoplayer2.video.MediaCodecVideoDecoderException: Decoder failed: OMX.google.h264.decoder
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.createDecoderException(MediaCodecVideoRenderer.java:1377)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:872)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:892)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:467)
E/ExoPlayerImplInternal(32290):       ... 3 more
E/ExoPlayerImplInternal(32290):   Caused by: java.lang.IllegalStateException
E/ExoPlayerImplInternal(32290):       at android.media.MediaCodec.native_queueInputBuffer(Native Method)
E/ExoPlayerImplInternal(32290):       at android.media.MediaCodec.queueInputBuffer(MediaCodec.java:831)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.queueInputBuffer(SynchronousMediaCodecAdapter.java:69)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1419)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:859)
E/ExoPlayerImplInternal(32290):       ... 5 more
E/ExoPlayerImplInternal(32290): Disable failed.
E/ExoPlayerImplInternal(32290):   java.lang.IllegalStateException
E/ExoPlayerImplInternal(32290):       at android.media.MediaCodec.native_flush(Native Method)
E/ExoPlayerImplInternal(32290):       at android.media.MediaCodec.flush(MediaCodec.java:662)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.flush(SynchronousMediaCodecAdapter.java:81)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:914)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:773)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onDisabled(MediaCodecVideoRenderer.java:454)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.BaseRenderer.disable(BaseRenderer.java:175)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1507)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:1254)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:1218)
E/ExoPlayerImplInternal(32290):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:546)
E/ExoPlayerImplInternal(32290):       at android.os.Handler.dispatchMessage(Handler.java:98)
E/ExoPlayerImplInternal(32290):       at android.os.Looper.loop(Looper.java:135)
E/ExoPlayerImplInternal(32290):       at android.os.HandlerThread.run(HandlerThread.java:61)
E/flutter (32290): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, null, -1, null, [1280, 720, 25.0], [-1, -1]), format_supported=YES, null, null)
E/flutter (32290): 
I/art     (32290): Background sticky concurrent mark sweep GC freed 34523(1710KB) AllocSpace objects, 1(64KB) LOS objects, 39% free, 2MB/4MB, paused 5.773ms total 189.160ms
```

For minimal reproducible sample please check out the sample code in video_player package

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```
 +11 ms] I/ExoPlayerImpl(32734): Init 1aa2805b [ExoPlayerLib/2.12.1] [generic_x86, sdk_google_atv_x86, unknown, 22]
[+4471 ms] I/VideoCapabilities(32734): Unsupported profile 4 for video/mp4v-es
[  +10 ms] I/OMXClient(32734): Using client-side OMX mux.
[   +3 ms] W/OMXNodeInstance(32734): [1:google.h264.decoder] component does not support metadata mode; using fallback
[        ] E/ACodec  (32734): [OMX.google.h264.decoder] storeMetaDataInBuffers failed w/ err -1010
[   +5 ms] I/OMXClient(32734): Using client-side OMX mux.
[  +11 ms] I/SoftAAC2(32734): limiting to stereo output
[ +170 ms] I/SoftAAC2(32734): Reconfiguring decoder: 0->48000 Hz, 0->2 channels
[ +469 ms] E/SoftAVC (32734): Decoder failed: -2
[        ] E/ACodec  (32734): [OMX.google.h264.decoder] ERROR(0x80001001)
[        ] E/ACodec  (32734): signalError(omxError 0x80001001, internalError -2147483648)
[        ] E/MediaCodec(32734): Codec reported err 0x80001001, actionCode 0, while in state 6
[   +9 ms] E/ExoPlayerImplInternal(32734): Playback error
[        ] E/ExoPlayerImplInternal(32734):   com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, null, -1, null, [1280,
720, 25.0], [-1, -1]), format_supported=YES
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:542)
[        ] E/ExoPlayerImplInternal(32734):       at android.os.Handler.dispatchMessage(Handler.java:98)
[        ] E/ExoPlayerImplInternal(32734):       at android.os.Looper.loop(Looper.java:135)
[        ] E/ExoPlayerImplInternal(32734):       at android.os.HandlerThread.run(HandlerThread.java:61)
[        ] E/ExoPlayerImplInternal(32734):   Caused by: com.google.android.exoplayer2.video.MediaCodecVideoDecoderException: Decoder failed: OMX.google.h264.decoder
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.createDecoderException(MediaCodecVideoRenderer.java:1377)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:872)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:892)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:467)
[        ] E/ExoPlayerImplInternal(32734):       ... 3 more
[        ] E/ExoPlayerImplInternal(32734):   Caused by: java.lang.IllegalStateException
[        ] E/ExoPlayerImplInternal(32734):       at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
[        ] E/ExoPlayerImplInternal(32734):       at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:1033)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.dequeueOutputBufferIndex(SynchronousMediaCodecAdapter.java:58)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1774)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:857)
[        ] E/ExoPlayerImplInternal(32734):       ... 5 more
[        ] E/ExoPlayerImplInternal(32734): Disable failed.
[        ] E/ExoPlayerImplInternal(32734):   java.lang.IllegalStateException
[        ] E/ExoPlayerImplInternal(32734):       at android.media.MediaCodec.native_flush(Native Method)
[        ] E/ExoPlayerImplInternal(32734):       at android.media.MediaCodec.flush(MediaCodec.java:662)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.flush(SynchronousMediaCodecAdapter.java:81)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:914)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:773)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onDisabled(MediaCodecVideoRenderer.java:454)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.BaseRenderer.disable(BaseRenderer.java:175)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1507)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:1254)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:1218)
[        ] E/ExoPlayerImplInternal(32734):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:546)
[        ] E/ExoPlayerImplInternal(32734):       at android.os.Handler.dispatchMessage(Handler.java:98)
[        ] E/ExoPlayerImplInternal(32734):       at android.os.Looper.loop(Looper.java:135)
[        ] E/ExoPlayerImplInternal(32734):       at android.os.HandlerThread.run(HandlerThread.java:61)
[  +13 ms] E/flutter (32734): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException:
MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, null, -1, null, [1280, 720, 25.0], [-1, -1]), format_supported=YES, null, null)
[        ] E/flutter (32734): 
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
Analyzing ivrata...                                                     
No issues found! (ran in 1.5s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel master, 1.27.0-2.0.pre.102, on Linux, locale en_US.UTF-8)
    • Flutter version 1.27.0-2.0.pre.102 at /home/user/Development/flutter
    • Framework revision b2e05062b6 (9 days ago), 2021-02-15 03:56:03 -0500
    • Engine revision 1d537824d6
    • Dart version 2.13.0 (build 2.13.0-30.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /home/user/Android/Sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /home/user/Documents/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /home/user/Documents/android-studio
    • Flutter plugin version 44.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.52.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.19.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.96
    ! Device 52007e785ffc85c7 is not authorized.
      You might need to check your device for an authorization dialog.

• No issues found!
```

</details>

Paint your app to life in milliseconds!