google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

Frame drops and stalled video while playing MPEG-TS/AVC on Sony Bravia 4K GB #2469

Closed stari4ek closed 4 years ago

stari4ek commented 7 years ago

It could be device's performance, but same video using same decoder (OMX.MTK.VIDEO.DECODER.AVC) in 2 other apps is played well.

ojw28 commented 7 years ago

Are you using FLAG_ALLOW_NON_IDR_KEYFRAMES when building the TsExtractor? It plays fine for me with the flag set. Without it I just see a black screen. Please clarify. Thanks!

ojw28 commented 7 years ago

Note: I was testing on a model running L (API level 22) rather than M (API level 23).

stari4ek commented 7 years ago

This issue was reported by user, so I can not reproduce by myself (don't have Sony TV). But here it is what I have:

System: 3.10.79 (1.6.0.06.14.1.00) Sdk: 23 Device: BRAVIA_ATV2 Product: BRAVIA_ATV2_EU Manufacturer: Sony Model: BRAVIA 4K GB Resolution: 1920x1080

AquilesCanta commented 7 years ago

Note: I have also made sure that FLAG_DETECT_ACCESS_UNITS was enabled as well. Still not reproducible.

Regarding the Android version being 22 instead of 23, I am inclined to discard the possibility of a regression issue if it plays well using other apps:

It could be device's performance, but same video using same decoder (OMX.MTK.VIDEO.DECODER.AVC) in 2 other apps is played well.

I also doubt it is the lack of flags, as this does not cause dropped frames. I can only think of a device model variation from what we have (could you please send the output of adb shell getprop ro.build.fingerprint for that device?) or an APK difference. Please provide any information that might help us reproduce or understand the issue.

stari4ek commented 7 years ago

Since I don't own device I can not perform adb against it by myself. But, here is some additional info from MXPlayer's report (in initial comment):

Aplikacja: MX Player (1.8.16)
Producent: Sony
Model: BRAVIA 4K GB
Marka: Sony
Wersja: 6.0.1 (REL)
Kompilacja: Sony/BRAVIA_ATV2_EU/BRAVIA_ATV2:6.0.1/MMB29V.S50/1.6.0.06.14.1.00:user/release-keys
Jądro: Linux version 3.10.79 (root@BuildHost504) (gcc version 4.8.2 20131014 (prerelease) (Linaro GCC 4.8-2013.10) ) #1 SMP PREEMPT Mon Nov 14 15:14:14 JST 2016
CPU: 4 core(s) 0 Hz (family:1 features:2047)
Architektura procesora: 7 (os.arch: armv7l)
Funkcje procesora: swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
Zarządca platformy: mt5891
Zestaw instrukcji: armeabi-v7a armeabi
Rozdzielczość: 1920 x 1080
Dostępne miejsce na ekranie(DIP): 960 x 540 (smallest: 540)
Tablet: false
Rozmiar ekranu: Large
Gęstość: 2.0 (320)
Skala czcionki: 1.0
Główny przycisk sprzętowy: true
Dotykowy ekran: false
TV: true (uiMode:20)
Ustawienia regionalne: pl_PL

BTW, Can you reproduce issue using provided APK from my previous comment? Cause it's exact demo APK user used on it's device and got problem. There is link to branch with exact sources it was built from. I can prepare diff/patch to see differences with mainline

Any other information except Build.FINGERPRINT which can be fetched in runtime and might help?

AquilesCanta commented 7 years ago

I tried the debug APK without extensions. Didn't reproduce.

andrewlewis commented 7 years ago

This seems to be device-specific. We're looking into getting the problematic device but it may take a while.

stari4ek commented 7 years ago

just in case, this is how issue looks like:

andrewlewis commented 7 years ago

@stari4ek If possible, please could you provide a photo of the label on the back panel of the TV with readable text? Apparently the build fingerprint does not provide enough information to know exactly what the device is.

stari4ek commented 7 years ago

@andrewlewis, Here it is: https://drive.google.com/file/d/0Bww3WxdHUiM1cWl0M0lGMzJEYkU/view?usp=drivesdk

stari4ek commented 7 years ago

I'd like to update the issue. It's still valid (even with recent sony update to android 7). Here are some reports:


System: 3.10.79 (1.6.0.26.02.1.00)
Sdk: 24
Device: BRAVIA_ATV2
Product: BRAVIA_ATV2_EU
Manufacturer: Sony
Model: BRAVIA 4K GB

sony_01

System: 3.10.79 (3.865)
Sdk: 23
Device: SVP-DTV15
Product: SVP4KDTV15_EU
Manufacturer: Sony
Model: BRAVIA 4K 2015

image

stari4ek commented 7 years ago

2 Users confirmed that this issue takes place only when FLAG_DETECT_ACCESS_UNITS is enabled. Not sure if it's lack of cpu performance or device specific issue (nvidia shield has 5-10% of cpu utilization while playing samples with FLAG_DETECT_ACCESS_UNITS enabled)

andrewlewis commented 7 years ago

Detecting access units in H.264/AVC is relatively expensive because we have to unescape and parse slice headers to determine whether the NAL unit is the first VLC NAL unit of the picture.

Do you have the option of only using streams that include access unit delimiter NAL units and not using the flag?

stari4ek commented 7 years ago

I do not own or control media streams users can use. So probably the only solution is to provide control over workarounds as "extended" settings and select proper one by default.

Checked with xiaomi mibox - on test streams. FLAG_DETECT_ACCESS_UNITS adds ~10% of cpu utilization (~35-40% total) according to Android Studio's profiler. Not a big deal.

mibox has AMLogic S905X-H / Cortex A53 / 2GHz SVP4KDTV15_EU has Mediatek MT5891 / Cortex A53/ 1.1GHz.

Any chances that it's device specific bottleneck or it's just lack of single core raw cpu power?

kfrydel commented 6 years ago

I see the same issue on Mi Box + SHARP AQUOS TV. It is reproducible using ExoPlayer demo app (running on Mi Box) on following HLS asset (Sintel): https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8 You have to plug HDMI cable out from the Mi Box and then plugin it in back. The video get staled in few to dosen seconds. It is almost always reproducible when doing these steps. ExoPlayer reports status of playback as BUFFERING before video stops and droppedFrames appears as well. The video doesn't resume automatically.

I suspect that the issue is somehow related to dolby streams. I can reproduce it only when "Surround sound" is turned on ("Auto" in my case), when I change it to "Never" then I can replug HDMI cable many times and video doesn't get staled. At least I haven't been able to get it staled. I also couldn't reproduce it on assets that have only stereo streams.

If you think that this is different bug then I can create separate ticket for this. Here is bugreport that I created after reproduction: https://drive.google.com/file/d/1QIAIVpIEdU6maTsHCsZ6IgVdyTlNwUFJ/view?usp=sharing I used ExoPlayer demo app built from r2.8.2 tag. These logs were printed when video got staled:

07-24 13:56:15.747 10186  5351  5351 D EventLogger: droppedFrames [51.71, 117.78, window=0, period=0, 7]
07-24 13:56:15.748 10186  5351  5351 D EventLogger: state [51.71, 117.78, window=0, period=0, true, BUFFERING]
07-24 13:56:15.751  1041  2678  2804 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0xec36d000
ojw28 commented 4 years ago

Closing as part of a scrub of device specific issues that were filed more than 2 years ago.