Open mousewu opened 4 years ago
It never happened on my sony-tv (very recent model), but indeed last week it happened 2 times and i use this app very often.... click again on video and it starts with me, so for me it's ok
After updated app 6.17589 , my TV box start to show the message as above, CPU is Hi3798CV200,. it used to be good,but some updated become worse within these 2 month version.
Dear Sir
I post my log for reference https://drive.google.com/file/d/1JHgG-HEILlWjBq2G1brec-ZGjUL3qM9N/view?usp=sharing
What a surprise When I use lite mode , it works. I wonder if it is a different setting by pro/lite mode
I think this is related to the buffer size https://github.com/yuliskov/SmartYouTubeTV/blob/main-branch/exoplayeractivity/src/main/java/com/liskovsoft/smartyoutubetv/flavors/exoplayer/player/PlayerCoreFragment.java#L364
@yuliskov added a new settings to choose buffer size, but if you select the max option that is too much for devices with lower ram size.
So try the min player buffer option and see if it helps.
@yuliskov I was getting this error when playing around with getLoadControl() when using too high values for maxBufferMs
So I advise to make this RAM base and not time, as some devices have too small RAM size and issues like this will happens because exoplayer will try to fill up the requested time and that will be on RAM, the way I do this is:
private DefaultLoadControl getLoadControl() {
int minBufferMs = 30000;//30 seconds
int maxBufferMs = 36000000;//technical infinity, recommended here a very high number, the max will be based on setTargetBufferBytes() value
int bufferForPlaybackMs = 500;//half a seconds can be lower as lowe as 250
int bufferForPlaybackAfterRebufferMs = 3000;//3 seconds
return new DefaultLoadControl.Builder()
.setAllocator(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE))
.setBufferDurationsMs(minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs)
.setTargetBufferBytes(mDeviceRam)
.createDefaultLoadControl();
}
//Get and store the ram size on app start and latter pass to getLoadControl()
int mDeviceRam = DeviceRam(context);
//If ram is too big, bigger then max int value DeviceRam will return a negative number... use 196MB as that can only happens if device has more than 17GB of RAM, so 196 is enough and safe
if (mDeviceRam < 0) mDeviceRam = 196000000;
public static int DeviceRam(Context context) {
ActivityManager actManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
if (actManager != null) {
actManager.getMemoryInfo(memInfo);
} else return 500000000;//safe value for devices with 1gb or more...
return (int) (memInfo.totalMem / 18);
}
with android:largeHeap="true"
enable in manifest one can use device ram up to memInfo.totalMem / 16
safely, anything larger may cause issues, as app crash or those reported on this issue. if you disable android:largeHeap
I recommend memInfo.totalMem / 24
.
What this will do is that the playback will start after bufferForPlaybackMs has be buffered so a very small value is best here, then it will buffer up to DeviceRam has be filled (in bytes but can be see in time in the player stats), then when the buffer gets used and is lower then minBufferMs (in time) buffer starts again up to DeviceRam so on so on.
I think this is related to the buffer size https://github.com/yuliskov/SmartYouTubeTV/blob/main-branch/exoplayeractivity/src/main/java/com/liskovsoft/smartyoutubetv/flavors/exoplayer/player/PlayerCoreFragment.java#L364
@yuliskov added a new settings to choose buffer size, but if you select the max option that is too much for devices with lower ram size.
So try the min player buffer option and see if it helps.
@yuliskov I was getting this error when playing around with getLoadControl() when using too high values for maxBufferMs
So I advise to make this RAM base and not time, as some devices have too small RAM size and issues like this will happens because exoplayer will try to fill up the requested time and that will be on RAM, the way I do this is:
private DefaultLoadControl getLoadControl() { int minBufferMs = 30000;//30 seconds int maxBufferMs = 36000000;//technical infinity, recommended here a very high number, the max will be based on setTargetBufferBytes() value int bufferForPlaybackMs = 500;//half a seconds can be lower as lowe as 250 int bufferForPlaybackAfterRebufferMs = 3000;//3 seconds return new DefaultLoadControl.Builder() .setAllocator(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE)) .setBufferDurationsMs(minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs) .setTargetBufferBytes(mDeviceRam) .createDefaultLoadControl(); }
//Get and store the ram size on app start and latter pass to getLoadControl() int mDeviceRam = DeviceRam(context); //If ram is too big, bigger then max int value DeviceRam will return a negative number... use 196MB as that can only happens if device has more than 17GB of RAM, so 196 is enough and safe if (mDeviceRam < 0) mDeviceRam = 196000000; public static int DeviceRam(Context context) { ActivityManager actManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); if (actManager != null) { actManager.getMemoryInfo(memInfo); } else return 500000000;//safe value for devices with 1gb or more... return (int) (memInfo.totalMem / 18); }
with
android:largeHeap="true"
enable in manifest one can use device ram up tomemInfo.totalMem / 16
safely, anything larger may cause issues, as app crash or those reported on this issue. if you disableandroid:largeHeap
I recommendmemInfo.totalMem / 24
.What this will do is that the playback will start after bufferForPlaybackMs has be buffered so a very small value is best here, then it will buffer up to DeviceRam has be filled (in bytes but can be see in time in the player stats), then when the buffer gets used and is lower then minBufferMs (in time) buffer starts again up to DeviceRam so on so on.
If you could solve the issue then please do try using a pull request, lately so many people even with closed issues have simply left them open so Yuriy is probably having a hard time tracking down issues, I still feel some videos are still breaking down and exiting due to this issue even after having 1 GB RAM so might be good to optimise memory handling.
I think this is related to the buffer size https://github.com/yuliskov/SmartYouTubeTV/blob/main-branch/exoplayeractivity/src/main/java/com/liskovsoft/smartyoutubetv/flavors/exoplayer/player/PlayerCoreFragment.java#L364 @yuliskov added a new settings to choose buffer size, but if you select the max option that is too much for devices with lower ram size. So try the min player buffer option and see if it helps. @yuliskov I was getting this error when playing around with getLoadControl() when using too high values for maxBufferMs So I advise to make this RAM base and not time, as some devices have too small RAM size and issues like this will happens because exoplayer will try to fill up the requested time and that will be on RAM, the way I do this is:
private DefaultLoadControl getLoadControl() { int minBufferMs = 30000;//30 seconds int maxBufferMs = 36000000;//technical infinity, recommended here a very high number, the max will be based on setTargetBufferBytes() value int bufferForPlaybackMs = 500;//half a seconds can be lower as lowe as 250 int bufferForPlaybackAfterRebufferMs = 3000;//3 seconds return new DefaultLoadControl.Builder() .setAllocator(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE)) .setBufferDurationsMs(minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs) .setTargetBufferBytes(mDeviceRam) .createDefaultLoadControl(); }
//Get and store the ram size on app start and latter pass to getLoadControl() int mDeviceRam = DeviceRam(context); //If ram is too big, bigger then max int value DeviceRam will return a negative number... use 196MB as that can only happens if device has more than 17GB of RAM, so 196 is enough and safe if (mDeviceRam < 0) mDeviceRam = 196000000; public static int DeviceRam(Context context) { ActivityManager actManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); if (actManager != null) { actManager.getMemoryInfo(memInfo); } else return 500000000;//safe value for devices with 1gb or more... return (int) (memInfo.totalMem / 18); }
with
android:largeHeap="true"
enable in manifest one can use device ram up tomemInfo.totalMem / 16
safely, anything larger may cause issues, as app crash or those reported on this issue. if you disableandroid:largeHeap
I recommendmemInfo.totalMem / 24
. What this will do is that the playback will start after bufferForPlaybackMs has be buffered so a very small value is best here, then it will buffer up to DeviceRam has be filled (in bytes but can be see in time in the player stats), then when the buffer gets used and is lower then minBufferMs (in time) buffer starts again up to DeviceRam so on so on.If you could solve the issue then please do try using a pull request, lately so many people even with closed issues have simply left them open so Yuriy is probably having a hard time tracking down issues, I still feel some videos are still breaking down and exiting due to this issue even after having 1 GB RAM so might be good to optimise memory handling.
@yuliskov already added his own version of it.
The reason it didn't solve the problem, is because the default is still time base and the new is only enable if you chosse the "max player buffer" option. With for me is wrong, because that profile that I create has nothing to do with "max", is a optimized buffer option that is the best option for any devices, meaning when you have that no other is necessary.
As I wrote before "So I advise to make this RAM base and not time", when you use "time" base buffers, devices with low amount of RAM will have this problem, because you are saying to the player "hey doesn't matter how much RAM it takes buffer this amount of the video in time" and all that buffer will go to the RAM that the system allocates for the app with is limited, once the app can't allocate more RAM issues like this start.
I also wrote "with android:largeHeap="true" enable in manifest one can use device ram up to memInfo.totalMem / 16 safely, anything larger may cause issues, as app crash or those reported on this issue. if you disable android:largeHeap I recommend memInfo.totalMem / 24."
If yours device has only 1GB of RAM and the app is allowed to buffer up to 50 seconds of video (https://exoplayer.dev/doc/reference/constant-values.html#com.google.android.exoplayer2.DefaultLoadControl.DEFAULT_MAX_BUFFER_MS) that may be too much, as in some high bitrate videos the RAM consumption will be great the 10% of yours device RAM with on my personal test is too much and causes app issues as the one from this issue.
But I'm not the owner of the project I can only adive what to do, if the owner want the default be time base even though it causes issue that is his option.
What you or anyone that has the problem can do is change the buffer option to "max player buffer" and the problem will be gone, as that option will not cause more buffer to be used, it causes the right amount to be used.
This problem happened on my TV, when I select a video to watch. It says video link is broken. But I can watch videos both on my phone and PC. Any one knows why is the problem?