fluttercommunity / fluttercommunity/chewie
chewie crashed after play a few video
- Dominant language
- Dart
- Stars
- 2.1k
- Forks
- 1.1k
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 6
Description
after play a few videos, chewie will crashed with errors as follow:
```
D/SurfaceUtils( 9431): connecting to surface 0x78e7d008, reason connectToSurface
I/MediaCodec( 9431): [OMX.google.h264.decoder] setting surface generation to 9657373
D/SurfaceUtils( 9431): disconnecting from surface 0x78e7d008, reason connectToSurface(reconnect)
D/SurfaceUtils( 9431): connecting to surface 0x78e7d008, reason connectToSurface(reconnect)
E/ACodec ( 9431): [OMX.google.h264.decoder] setPortMode on output to DynamicANWBuffer failed w/ err -1010
I/ACodec ( 9431): codec does not support config priority (err -1010)
I/OMXClient( 9431): Treble IOmx obtained
I/ACodec ( 9431): codec does not support config priority (err -2147483648)
I/OMXClient( 9431): Treble IOmx obtained
D/SurfaceUtils( 9431): connecting to surface 0x82a7a008, reason connectToSurface
I/MediaCodec( 9431): [OMX.google.h264.decoder] setting surface generation to 9657374
D/SurfaceUtils( 9431): disconnecting from surface 0x82a7a008, reason connectToSurface(reconnect)
D/SurfaceUtils( 9431): connecting to surface 0x82a7a008, reason connectToSurface(reconnect)
E/ACodec ( 9431): [OMX.google.h264.decoder] setPortMode on output to DynamicANWBuffer failed w/ err -1010
I/ACodec ( 9431): codec does not support config priority (err -1010)
E/AudioTrack( 9431): AudioFlinger could not create track, status: -12
E/AudioTrack-JNI( 9431): Error -12 initializing AudioTrack
E/android.media.AudioTrack( 9431): Error code -20 when initializing AudioTrack.
I/OMXClient( 9431): Treble IOmx obtained
E/ExoPlayerImplInternal( 9431): Playback error.
E/ExoPlayerImplInternal( 9431): com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.audio.AudioSink$InitializationException: AudioTrack init failed: 0, Config(44100, 12, 44100)
E/ExoPlayerImplInternal( 9431): at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.processOutputBuffer(MediaCodecAudioRenderer.java:646)
E/ExoPlayerImplInternal( 9431): at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1355)
E/ExoPlayerImplInternal( 9431): at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:663)
E/ExoPlayerImplInternal( 9431): at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:529)
E/ExoPlayerImplInternal( 9431): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:300)
E/ExoPlayerImplInternal( 9431): at android.os.Handler.dispatchMessage(Handler.java:101)
E/ExoPlayerImplInternal( 9431): at android.os.Looper.loop(Looper.java:164)
E/ExoPlayerImplInternal( 9431): at android.os.HandlerThread.run(HandlerThread.java:65)
E/ExoPlayerImplInternal( 9431): Caused by: com.google.android.exoplayer2.audio.AudioSink$InitializationException: AudioTrack init failed: 0, Config(44100, 12, 44100)
E/ExoPlayerImplInternal( 9431): at com.google.android.exoplayer2.audio.DefaultAudioSink.initializeAudioTrack(DefaultAudioSink.java:1128)
E/ExoPlayerImplInternal( 9431): at com.google.android.exoplayer2.audio.DefaultAudioSink.initialize(DefaultAudioSink.java:532)
E/ExoPlayerImplInternal( 9431): at com.google.android.exoplayer2.audio.DefaultAudioSink.handleBuffer(DefaultAudioSink.java:593)
E/ExoPlayerImplInternal( 9431): at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.processOutputBuffer(MediaCodecAudioRenderer.java:640)
E/ExoPlayerImplInternal( 9431): ... 7 more
```
this is my code:
```dart
import 'package:video_player/video_player.dart';
import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:my_news/model/index.dart';
class ShortVideo extends StatefulWidget {
ShortVideo(this.sampleInfo);
final NewSample sampleInfo;
@override
_ShortVideoState createState() => _ShortVideoState();
}
class _ShortVideoState extends State {
VideoPlayerController _controller;
ChewieController _chewieController;
@override
void initState() {
super.initState();
try{
_controller = VideoPlayerController.network(widget.sampleInfo.videoList[0])
..initialize().then((_) {
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
setState(() {});
});
_chewieController = new ChewieController(
videoPlayerController: _controller,
aspectRatio: 9 / 16,
autoPlay: true,
looping: true,
showControls: true,
// 占位图
placeholder: new Container(
color: Colors.grey,
),
// 是否在 UI 构建的时候就加载视频
autoInitialize: !true,
// 拖动条样式颜色
materialProgressColors: new ChewieProgressColors(
playedColor: Colors.red,
handleColor: Colors.blue,
backgroundColor: Colors.grey,
bufferedColor: Colors.lightGreen,
),
);
}catch(e){
print('error ---------------');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
// appBar: new AppBar(title: new Text(widget.sampleInfo.title)),
body: Center(
child: new Chewie(
controller: _chewieController,
)));
}
@override
void dispose() {
_controller.dispose();
_chewieController.dispose();
super.dispose();
}
}
```
version:
```
chewie: 0.9.8
video_player: ">=0.7.0 <0.11.0"
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the ShortVideo widget shown in the report and reproduce the failure by playing several videos on Android with Chewie 0.9.8 and the stated video_player range. Compare the playback and disposal lifecycle with the reported ExoPlayer AudioTrack errors; done means repeated playback no longer crashes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- audio-video-rtc, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100