Closed mzorz closed 3 years ago
Interesting, I found a video on my emulator that produces the same result, but while it doesn't crash on mobile Gutenberg, it throws the same Exception (which apparently is logged but eaten):
2020-12-04 18:55:36.373 6053-6053/org.wordpress.android I/WordPress-MEDIA: MediaUploadHandler > Upload completed - localId=107 title=file_example_WMV_1920_9_3MB-2.wmv
2020-12-04 18:55:36.392 6053-6053/org.wordpress.android E/WordPress-MEDIA: Can't read duration of the video due to a Runtime Exception happened setting the datasource
java.lang.RuntimeException: setDataSource failed: status = 0x80000000
at android.media.MediaMetadataRetriever.setDataSource(Native Method)
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:75)
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:163)
at org.wordpress.android.util.VideoUtils.getVideoDurationMS(VideoUtils.java:26)
at org.wordpress.android.util.VideoUtils.getVideoDurationMS(VideoUtils.java:16)
at org.wordpress.android.util.analytics.AnalyticsUtils.getMediaProperties(AnalyticsUtils.java:605)
at org.wordpress.android.ui.uploads.MediaUploadHandler.trackUploadMediaEvents(MediaUploadHandler.java:381)
at org.wordpress.android.ui.uploads.MediaUploadHandler.handleOnMediaUploadedSuccess(MediaUploadHandler.java:181)
at org.wordpress.android.ui.uploads.MediaUploadHandler.onMediaUploaded(MediaUploadHandler.java:366)
at java.lang.reflect.Method.invoke(Native Method)
at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:507)
at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:501)
at org.greenrobot.eventbus.HandlerPoster.handleMessage(HandlerPoster.java:67)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2020-12-04 18:55:36.400 6053-6053/org.wordpress.android I/WordPress-STATS: 🔵 Tracked: media_service_upload_response_ok, Properties: {"ext":"wmv","age_ms":14374,"bytes":9338829,"mime":"video\/x-ms-wmv","duration_secs":0}
2020-12-04 18:55:36.409 6053-6053/org.wordpress.android E/WordPress-MEDIA: Can't read duration of the video due to a Runtime Exception happened setting the datasource
java.lang.RuntimeException: setDataSource failed: status = 0x80000000
at android.media.MediaMetadataRetriever.setDataSource(Native Method)
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:75)
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:163)
at org.wordpress.android.util.VideoUtils.getVideoDurationMS(VideoUtils.java:26)
at org.wordpress.android.util.VideoUtils.getVideoDurationMS(VideoUtils.java:16)
at org.wordpress.android.util.analytics.AnalyticsUtils.getMediaProperties(AnalyticsUtils.java:605)
at org.wordpress.android.ui.uploads.MediaUploadHandler.trackUploadMediaEvents(MediaUploadHandler.java:381)
at org.wordpress.android.ui.uploads.MediaUploadHandler.completeUploadWithId(MediaUploadHandler.java:224)
at org.wordpress.android.ui.uploads.MediaUploadHandler.handleOnMediaUploadedSuccess(MediaUploadHandler.java:183)
at org.wordpress.android.ui.uploads.MediaUploadHandler.onMediaUploaded(MediaUploadHandler.java:366)
at java.lang.reflect.Method.invoke(Native Method)
at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:507)
at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:501)
at org.greenrobot.eventbus.HandlerPoster.handleMessage(HandlerPoster.java:67)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2020-12-04 18:55:36.418 6053-6053/org.wordpress.android I/WordPress-STATS: 🔵 Tracked: media_service_upload_started, Properties: {"ext":"wmv","age_ms":14400,"bytes":9338829,"mime":"video\/x-ms-wmv","duration_secs":0}
2020-12-04 18:55:36.418 6053-6053/org.wordpress.android W/WordPress-MEDIA: MediaUploadHandler > No more media items to upload. Skipping this request.
2020-12-04 18:55:36.419 6053-6053/org.wordpress.android I/WordPress-MEDIA: MediaUploadHandler > Completed
2020-12-04 18:55:36.419 6053-6053/org.wordpress.android I/WordPress-MAIN: UploadService > Processing completed media with id 107 and local post id 93
2020-12-04 18:55:36.457 6053-6053/org.wordpress.android I/ExoPlayerImpl: Init a245acf [ExoPlayerLib/2.9.3] [generic_x86, Android SDK built for x86, Google, 29]
2020-12-04 18:55:36.541 6053-6416/org.wordpress.android E/ExoPlayerImplInternal: Source error.
com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor) could read the stream.
at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:973)
at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:891)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
2020-12-04 18:55:36.802 1776-6419/? E/ResolverController: No valid NAT64 prefix (101, <unspecified>/0)
2020-12-04 18:55:37.180 6053-6416/org.wordpress.android E/ExoPlayerImplInternal: Source error.
com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor) could read the stream.
at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:973)
at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:891)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
2020-12-04 18:55:38.668 2045-5105/system_process W/AppOps: Noting op not finished: uid 10098 pkg com.google.android.gms code 41 time=1607118933649 duration=0
2020-12-04 18:55:40.788 2694-22635/com.google.android.gms.persistent E/WakeLock: GCM_HB_ALARM release without a matched acquire!
Here we can see the exception happens 2 times: one for the analytics tracking that tries to establish the duration of the video in miliseconds by using setDataSource on the media metadata extractor, and the last one which is by ExoPlayer which is used in the React Native video player component.
I'll look further into how Stories work so to be able to catch the Exception and continue the same way as it goes for Gutenberg (given we don't really care if we couldn't track the duration of a video)
I haven't been able to reproduce. Checked Sentry and a search for setDataSource
only throws these 2 results:
Last time this one was seen was on version 16.3 of WPAndroid, when we changed the mode to copy media from external URLs, which I think helps to eliminate the problem given it should mostly be fine to open local urls in setDataSource().
Closing this one then.
First reported by @jd-alexander in https://github.com/Automattic/stories-android/pull/623#pullrequestreview-545163609
Copying the text here: