wlanjie / trinity

android video record editor muxer sdk
Apache License 2.0
888 stars 273 forks source link

One of the major issue which need to be fixed ASAP #107

Open rocky8roy opened 3 years ago

rocky8roy commented 3 years ago

Hi, thumbnail drag issue is there in old and new library both. Anyone reading this may already have faced this issue and all are struggling to solve this as this is not device specific or anything. we know there is also memory issue which will require time to fix it but this thumbnail drag issue can be fixed by owner of this wonderful library. we know you are very busy but kindly look into this and try to fix it asap.

Uenchi commented 3 years ago

Have you used version 0.3.0?

badcodercpp commented 3 years ago

@WU1208 is it fixed in 0.3.0 ?? on which device you are running ?? it's still crash on xiaomi note-4,5 (arm64) , "av_frame_unref" is causing null dereference on some devices.

Uenchi commented 3 years ago

@badcodercpp Running in Redmi Note 8, Sometimes it turns black, but it doesn't crash. Now I don't know how to use Updateeffect,it does not work in old demo

Uenchi commented 3 years ago

@badcodercpp After multiple drags, sometime image

rocky8roy commented 3 years ago

Has anyone solved the thumbnail issue?

On Tue, Oct 13, 2020, 11:43 WU1208 notifications@github.com wrote:

@badcodercpp https://github.com/badcodercpp [image: image] https://user-images.githubusercontent.com/13074367/95822299-390a5f00-0d5e-11eb-89c1-ed5777e198a7.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wlanjie/trinity/issues/107#issuecomment-707513904, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIA5YM3WVOXIDWK54CC7SDSKPVZJANCNFSM4SLJBBNQ .

badcodercpp commented 3 years ago

yeah find av_frame_unref(frame) in queue.c, check if frame is available in FramePool or not before calling "av_frame_unref(frame)", Actually problem is that on video seek library is calling AVFrameFlush to flush the frame pool and free frame from buffer but on fast drag flush free the buffer first and then call of "av_frame_unref(frame)" fails as frame is NULL that time, add null check on frame or find frame in pool and if find is successful then call "av_frame_unref(frame)" or simply remove this "av_frame_unref(frame)" line , as this will be taken care by the FFMPEG library itself, NOTE: - DO NOT COPY frame if you are removing "av_frame_unref(frame)" line or else it will crash on memcpy.

rocky8roy commented 3 years ago

Thanks.. Will try this. Is there any sample code you have implemented which is working without any crashes?

On Wed, Oct 14, 2020, 04:50 badcoder notifications@github.com wrote:

yeah find av_frame_unref(frame) in queue.c, check if frame is available in FramePool or not before calling "av_frame_unref(frame)", Actually problem is that on video seek library is calling AVFrameFlush to flush the frame pool and free frame from buffer but on fast drag flush free the buffer first and then call of "av_frame_unref(frame)" fails as frame is NULL that time, add null check on frame or find frame in pool and if find is successful then call "av_frame_unref(frame)" or simply remove this "av_frame_unref(frame)" line , as this will be taken care by the FFMPEG library itself, NOTE: - DO NOT COPY frame if you are removing "av_frame_unref(frame)" line or else it will crash on memcpy.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wlanjie/trinity/issues/107#issuecomment-708061142, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIA5YKV5VUKY3W47SQWIRDSKTOCPANCNFSM4SLJBBNQ .

badcodercpp commented 3 years ago

yeah if you are not copying frame then replace implementation of "frame_pool_unref_frame" in queue.c with following :

void frame_pool_unref_frame(FramePool pool, AVFrame frame){ //av_frame_unref(frame); // remove this line completely memory free will be handled by libavutil pool->count--; }

Uenchi commented 3 years ago

@badcodercpp hey,you used version 0.3.0?Or 0.9.1? If you use version 0.3.0, please tell me how to use the Updateeffect correctly

badcodercpp commented 3 years ago

@WU1208 i used recent one it's 0.3.0 i guess, sure i will help you , but having very busy schedule in day time , will take a look in late evening , meanwhile drop me mail with UpdateEffect signature what you are using on badcodercpp@gmail.com. i will look into that in late evening and revert.

Uenchi commented 3 years ago

@badcodercpp Thank you, 0.3.1 fixed this problem, UpdateEffect

rocky8roy commented 3 years ago

@WU1208 @badcodercpp is there any sample working code Possible to share your sample code which is not crashing automatically? for me version 0.3.2 also not working properly if anyone of you have successfully implemented the code in any of the version then kindly share it you can also email the code on rocky8roy@gmail.com thanks