Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to extends DefaultHlsExtractorFactory? #5109

Closed
goodibunakov opened this issue Nov 15, 2018 · 20 comments
Closed

How to extends DefaultHlsExtractorFactory? #5109

goodibunakov opened this issue Nov 15, 2018 · 20 comments
Assignees
Labels

Comments

@goodibunakov
Copy link

goodibunakov commented Nov 15, 2018

Everywhere just write that it solves some problems with hls streams (#3712 (comment)). But how to realize this? Can somebody show the example?

@tonihei
Copy link
Collaborator

tonihei commented Nov 15, 2018

You can't extend it because it's final. But if you'd like to reuse the functionality, consider wrapping it in a new HlsExtractorsFactory.

@tonihei tonihei self-assigned this Nov 15, 2018
@goodibunakov
Copy link
Author

@tonihei actually i'd like to see example of realizing this #4861 (comment).

@tonihei
Copy link
Collaborator

tonihei commented Nov 15, 2018

These flags can be set when creating the DefaultHlsExtractorFactory in the constructor. Does that help?

@goodibunakov
Copy link
Author

@tonihei May i use 2 flags for DefaultHlsExtractorFactory() constructor?

@tonihei
Copy link
Collaborator

tonihei commented Nov 19, 2018

Yes, these flags can be combined using the | operator.

@goodibunakov
Copy link
Author

goodibunakov commented Nov 20, 2018

@tonihei i did:
DefaultHlsExtractorFactory defaultHlsExtractorFactory = new DefaultHlsExtractorFactory(FLAG_DETECT_ACCESS_UNITS | FLAG_ALLOW_NON_IDR_KEYFRAMES); Uri uri = Uri.parse(url); MediaSource mediaSource = new HlsMediaSource.Factory(dataSourceFactory) .setExtractorFactory(defaultHlsExtractorFactory) .setAllowChunklessPreparation(true) .createMediaSource(uri);
But my hls stream does not work. I get:
`11-20 09:38:52.390 23124 23124 W System.err: com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.MTK.VIDEO.DECODER.AVC, Format(0, null, null, video/avc, avc1.4D0032, -1, null, [2688, 1520, -1.0], [-1, -1])

11-20 09:38:52.390 23124 23124 W System.err: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.t(SourceFile:479)

11-20 09:38:52.390 23124 23124 W System.err: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.D(SourceFile:1261)

11-20 09:38:52.390 23124 23124 W System.err: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.b(SourceFile:1111)

11-20 09:38:52.390 23124 23124 W System.err: at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.b(SourceFile:552)

11-20 09:38:52.390 23124 23124 W System.err: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.a(SourceFile:647)

11-20 09:38:52.390 23124 23124 W System.err: at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(SourceFile:4536)

11-20 09:38:52.390 23124 23124 W System.err: at android.os.Handler.dispatchMessage(Handler.java:107)

11-20 09:38:52.390 23124 23124 W System.err: at android.os.Looper.loop(Looper.java:207)

11-20 09:38:52.390 23124 23124 W System.err: at android.os.HandlerThread.run(HandlerThread.java:61)

11-20 09:38:52.390 23124 23124 W System.err: Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.MTK.VIDEO.DECODER.AVC, Format(0, null, null, video/avc, avc1.4D0032, -1, null, [2688, 1520, -1.0], [-1, -1])

11-20 09:38:52.390 23124 23124 W System.err: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.a(SourceFile:753)

11-20 09:38:52.390 23124 23124 W System.err: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.t(SourceFile:474)

11-20 09:38:52.390 23124 23124 W System.err: ... 8 more

11-20 09:38:52.390 23124 23124 W System.err: Caused by: android.media.MediaCodec$CodecException: Error 0x80001001

11-20 09:38:52.391 23124 23124 W System.err: at android.media.MediaCodec.native_configure(Native Method)

11-20 09:38:52.391 23124 23124 W System.err: at android.media.MediaCodec.configure(MediaCodec.java:1791)

11-20 09:38:52.391 23124 23124 W System.err: at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.a(SourceFile:483)

11-20 09:38:52.391 23124 23124 W System.err: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.a(SourceFile:8805)

11-20 09:38:52.391 23124 23124 W System.err: ... 9 more

11-20 09:38:52.391 23124 23124 I ExoPlayerImpl: Release 373346c [ExoPlayerLib/2.9.1] [F3311, F3311, Sony, 23] [goog.exo.core, goog.exo.ui, goog.exo.hls]`

@tonihei
Copy link
Collaborator

tonihei commented Nov 20, 2018

Looks like your device may just not support this format. It would be helpful to get the output of the EventLogger. Can you attach one with player.addAnalyticsListener(new EventLogger(trackSelector));?

@goodibunakov
Copy link
Author

`11-21 12:02:32.386 21141 21141 E EventLogger: playerFailed [0.68, 0.00, window=0]

11-21 12:02:32.386 21141 21141 E EventLogger: com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.MTK.VIDEO.DECODER.AVC, Format(0, null, null, video/avc, avc1.4D0032, -1, null, [2688, 1520, -1.0], [-1, -1])

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.t(SourceFile:479)

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.D(SourceFile:1261)

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.b(SourceFile:1111)

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.b(SourceFile:552)

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.a(SourceFile:647)

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(SourceFile:4536)

11-21 12:02:32.386 21141 21141 E EventLogger: at android.os.Handler.dispatchMessage(Handler.java:107)

11-21 12:02:32.386 21141 21141 E EventLogger: at android.os.Looper.loop(Looper.java:207)

11-21 12:02:32.386 21141 21141 E EventLogger: at android.os.HandlerThread.run(HandlerThread.java:61)

11-21 12:02:32.386 21141 21141 E EventLogger: Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.MTK.VIDEO.DECODER.AVC, Format(0, null, null, video/avc, avc1.4D0032, -1, null, [2688, 1520, -1.0], [-1, -1])

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.a(SourceFile:753)

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.t(SourceFile:474)

11-21 12:02:32.386 21141 21141 E EventLogger: ... 8 more

11-21 12:02:32.386 21141 21141 E EventLogger: Caused by: android.media.MediaCodec$CodecException: Error 0x80001001

11-21 12:02:32.386 21141 21141 E EventLogger: at android.media.MediaCodec.native_configure(Native Method)

11-21 12:02:32.386 21141 21141 E EventLogger: at android.media.MediaCodec.configure(MediaCodec.java:1791)

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.a(SourceFile:483)

11-21 12:02:32.386 21141 21141 E EventLogger: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.a(SourceFile:8805)

11-21 12:02:32.386 21141 21141 E EventLogger: ... 9 more

11-21 12:02:32.387 21141 21141 I ExoPlayerImpl: Release 695c710 [ExoPlayerLib/2.9.1] [F3311, F3311, Sony, 23] [goog.exo.core, goog.exo.ui, goog.exo.hls]

11-21 12:02:32.387 21141 21141 E debug exoplayer: TYPE_RENDERER: Decoder init failed: OMX.MTK.VIDEO.DECODER.AVC, Format(0, null, null, video/avc, avc1.4D0032, -1, null, [2688, 1520, -1.0], [-1, -1])`

If i missed something, here is full log file log android6.txt

@tonihei
Copy link
Collaborator

tonihei commented Nov 21, 2018

There should be more logging especially about tracks, state changes etc. Can you enable the INFO log level for the output? Or even better, provide a full bugreport (with "adb bugreport").

@goodibunakov
Copy link
Author

goodibunakov commented Nov 21, 2018

There was not any state changes as i think, playback does not start. We have "loading" and then onPlayerError.
Help me, where i have to enable INFO log? Or how to provide a full bug report?..

@tonihei
Copy link
Collaborator

tonihei commented Nov 21, 2018

@goodibunakov
Copy link
Author

I hope this helps bugreport-2018-11-22-11-12-54.txt

@tonihei
Copy link
Collaborator

tonihei commented Nov 22, 2018

That bug report doesn't contain the failing playback. Can you try to get one immediately after the error occured? And also with the EventLogger attached.

@goodibunakov
Copy link
Author

goodibunakov commented Nov 23, 2018

I did:
eventLogger = new EventLogger(defaultTrackSelector); player.addAnalyticsListener(eventLogger);

I get:
Logs logs.txt

XML
<com.google.android.exoplayer2.ui.PlayerView android:id="@+id/video_view" android:layout_width="match_parent" android:layout_height="190dp" app:auto_show="false" app:controller_layout_id="@layout/exo_playback_control_view" app:resize_mode="fill"/>

Stream specifications:
ffmpeg -rtsp_transport tcp -i ${INPUT} -acodec aac -vcodec h264 -no-scenecut -keyint_min=1 -hls_list_size 2 hls_init_time 1 -hls_time 1 -hls_flags delete_segments ${OUTPUT_PATH}${OUTPUT}.m3u8
where {INPUT} is a stream from a video camera in the rtsp format.

@tonihei
Copy link
Collaborator

tonihei commented Nov 23, 2018

The logs still don't tell anything new. But as said above, I suspect the device doesn't support the video resolution (2688x1520) and there is probably nothing we can do about that.

@goodibunakov
Copy link
Author

goodibunakov commented Nov 23, 2018

Well, i took logs from Logcat. Why there does not shows what you need?

And may be we have to correct our m3u8 for success on this phone?

I also need to fix to not receive onPlayerError on other devices. I get it so often.

@tonihei
Copy link
Collaborator

tonihei commented Nov 23, 2018

We can't help you with content creation, but it's usually a good idea to have multiple formats (including low-res formats) such that all devices support at least one of them.

Why there does not shows what you need?

I was looking for the list of available formats and whether they are supported. This list should be reported when using the EventLogger. But it's not part of your logs.

@goodibunakov
Copy link
Author

What should i do besides this: eventLogger = new EventLogger(defaultTrackSelector); player.addAnalyticsListener(eventLogger); ?

@tonihei
Copy link
Collaborator

tonihei commented Nov 23, 2018

Have you done this before calling player.prepare? That could be a reason for not reporting everything.

@goodibunakov
Copy link
Author

goodibunakov commented Nov 23, 2018

logs.txt

Now I did addAnalyticsListener after prepare.

@google google locked and limited conversation to collaborators May 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants