betterplayer icon indicating copy to clipboard operation
betterplayer copied to clipboard

[BUG] Video is not loading from the caching in ReusableVideoListController.

Open harmeet-rgyan opened this issue 3 years ago • 1 comments

History check Please confirm that you've checked the history of the issues and you didn't find anything which may solve your issue. Yes, I have checked all open/closed issues and didn't find any issues related to my problem.

Describe the bug Every time video is fetched from the cloud even if I am skipping backwards. I can confirm that the video caching is working because app size is increasing and I can see the logs related to video caching.

To Reproduce Steps to reproduce the behaviour:

  1. Add caching to ReusableVideoListController example.
  2. Run the app and check the logs to see that video caching is completed
  3. Turn off the internet/wifi, Scroll away and scroll back to widget position or skip backwards
  4. On Error widget is going to show and you can also check the logs
  5. You can also try it with internet/wifi on and see the cloud fetch use instead of cache fetch while observing the network speed indicator

*Example code Code gist: https://gist.github.com/harmeet-rgyan/12f1aa5738a5015881657e3e116fd9e9

Expected behaviour The video should be fetched from caching while skipping backwards and scrolling back to the widget position

Screenshots None.

Flutter doctor

[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19044.1469], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.63.0)
[√] Connected device (3 available)
    ! Device 192.168.0.175:5555 is offline.

• No issues found!

C:\Users\XYZ\Desktop\Android Studio Projects\XYZ Flutter>flutter doctor -v
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19044.1469], locale en-IN)
    • Flutter version 2.8.1 at C:\Users\XYZ\FlutterSDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (6 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\XYZ\AppData\Local\Android\sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] VS Code (version 1.63.0)
    • VS Code at C:\Users\XYZ\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • POCO F1 (mobile) • c169abdf • android-arm64  • Android 11 (API 30)
    • Chrome (web)     • chrome   • web-javascript • Google Chrome 97.0.4692.99
    • Edge (web)       • edge     • web-javascript • Microsoft Edge 97.0.1072.55

• No issues found!

Better Player version

  • Version: ^0.0.81

Smartphone (please complete the following information):

  • Device: Xiaomi Poco F1
  • OS: Android 11 (Rom: Pixel Experience +)

Additional context

Flutter run logs:

Performing hot restart...
Syncing files to device POCO F1...
W/Choreographer( 3878): Frame time is 0.208297 ms in the future!  Check that graphics HAL is generating vsync timestamps using the correct timebase.
Restarted application in 5,113ms.
W/FA      ( 3878): Cannot log screen view event when the app is in the background.
W/FA      ( 3878): Ignoring call to log screen view event with duplicate parameters.
I/flutter ( 3878): getBetterPlayerController: adding player to list
I/ExoPlayerImpl( 3878): Release 8a77fa8 [ExoPlayerLib/2.15.1] [beryllium, POCO F1, Xiaomi, 30] [goog.exo.core]
D/CCodecBuffers( 3878): [c2.android.aac.decoder#550:1D-Output.Impl[N]] Client returned a buffer it does not own according to our record: 0
I/CCodecConfig( 3878): query failed after returning 19 values (BAD_INDEX)
D/CCodecConfig( 3878): c2 config diff is   c2::i32 coding.drc.compression-mode.value = 3
W/Codec2Client( 3878): query -- param skipped: index = 1342179345.
W/Codec2Client( 3878): query -- param skipped: index = 2415921170.
W/Codec2Client( 3878): query -- param skipped: index = 1610614798.
D/SurfaceUtils( 3878): connecting to surface 0x7e7a4bd290, reason connectToSurface
I/MediaCodec( 3878): [OMX.qcom.video.decoder.avc] setting surface generation to 3971074
D/SurfaceUtils( 3878): disconnecting from surface 0x7e7a4bd290, reason connectToSurface(reconnect)
D/SurfaceUtils( 3878): connecting to surface 0x7e7a4bd290, reason connectToSurface(reconnect)
D/SurfaceUtils( 3878): set up nativeWindow 0x7e7a4bd290 for 320x240, color 0x7fa30c06, rotation 0, usage 0x20002900
D/SurfaceUtils( 3878): disconnecting from surface 0x7e7a4c7ce0, reason disconnectFromSurface
E/Surface ( 3878): freeAllBuffers: 12 buffers were freed while being dequeued!
D/CCodecBufferChannel( 3878): [c2.android.aac.decoder#550] MediaCodec discarded an unknown buffer
I/chatty  ( 3878): uid=10417(xyz.com) identical 2 lines
D/CCodecBufferChannel( 3878): [c2.android.aac.decoder#550] MediaCodec discarded an unknown buffer
I/hw-BpHwBinder( 3878): onLastStrongRef automatically unlinking death recipients
D/BufferPoolAccessor2.0( 3878): bufferpool2 0x7dda503008 : 0(0 size) total buffers - 0(0 size) used buffers - 1/6 (recycle/alloc) - 6/1847 (fetch/transfer)
D/BufferPoolAccessor2.0( 3878): Destruction - bufferpool2 0x7dda503008 cached: 0/0M, 0/0% in use; allocs: 6, 17% recycled; transfers: 1847, 100% unfetched
I/ExoPlayerImpl( 3878): Init 1adb0f5 [ExoPlayerLib/2.15.1] [beryllium, POCO F1, Xiaomi, 30]
D/SurfaceUtils( 3878): disconnecting from surface 0x7e7a4bd290, reason disconnectFromSurface
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 0%
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 10%
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 20%
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 30%
I/flutter ( 3878): VisibilityDetector
I/flutter ( 3878): onVisibilityChanged: 1.0
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 40%
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 50%
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 60%
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 70%
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 80%
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 90%
D/CacheWorker( 3878): Completed pre cache of https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4: 100%
I/WM-WorkerWrapper( 3878): Worker result SUCCESS for Work [ id=2145ae82-242b-4a7f-a590-5e8efe956158, tags={ com.jhomlala.better_player.CacheWorker, https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4 } ]
I/OMXClient( 3878): IOmx service obtained
D/SurfaceUtils( 3878): connecting to surface 0x7e7a4c9ef0, reason connectToSurface
I/MediaCodec( 3878): [OMX.qcom.video.decoder.avc] setting surface generation to 3971075
D/SurfaceUtils( 3878): disconnecting from surface 0x7e7a4c9ef0, reason connectToSurface(reconnect)
D/SurfaceUtils( 3878): connecting to surface 0x7e7a4c9ef0, reason connectToSurface(reconnect)
D/SurfaceUtils( 3878): set up nativeWindow 0x7e7a4c9ef0 for 320x240, color 0x7fa30c06, rotation 0, usage 0x20002900
D/CCodec  ( 3878): allocate(c2.android.aac.decoder)
I/CCodec  ( 3878): Created component [c2.android.aac.decoder]
D/CCodecConfig( 3878): read media type: audio/mp4a-latm
D/ReflectedParamUpdater( 3878): extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater( 3878): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater( 3878): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater( 3878): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater( 3878): extent() != 1 for single value type: algo.buffers.allocator-ids.values
D/ReflectedParamUpdater( 3878): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater( 3878): extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig( 3878): query failed after returning 19 values (BAD_INDEX)
D/CCodecConfig( 3878): c2 config diff is Dict {
D/CCodecConfig( 3878):   c2::u32 coded.aac-packaging.value = 0
D/CCodecConfig( 3878):   c2::u32 coded.bitrate.value = 64000
D/CCodecConfig( 3878):   c2::u32 coded.pl.level = 0
D/CCodecConfig( 3878):   c2::u32 coded.pl.profile = 8192
D/CCodecConfig( 3878):   c2::i32 coding.drc.album-mode.value = 0
D/CCodecConfig( 3878):   c2::float coding.drc.attenuation-factor.value = 1
D/CCodecConfig( 3878):   c2::float coding.drc.boost-factor.value = 1
D/CCodecConfig( 3878):   c2::i32 coding.drc.compression-mode.value = 3
D/CCodecConfig( 3878):   c2::i32 coding.drc.effect-type.value = 3
D/CCodecConfig( 3878):   c2::float coding.drc.encoded-level.value = 0.25
D/CCodecConfig( 3878):   c2::float coding.drc.reference-level.value = -16
D/CCodecConfig( 3878):   c2::u32 input.buffers.max-size.value = 8192
D/CCodecConfig( 3878):   c2::u32 input.delay.value = 0
D/CCodecConfig( 3878):   string input.media-type.value = "audio/mp4a-latm"
D/CCodecConfig( 3878):   c2::u32 output.delay.value = 2
D/CCodecConfig( 3878):   c2::float output.drc.output-loudness.value = 0.25
D/CCodecConfig( 3878):   string output.media-type.value = "audio/raw"
D/CCodecConfig( 3878):   c2::u32 raw.channel-count.value = 1
D/CCodecConfig( 3878):   c2::u32 raw.max-channel-count.value = 8
D/CCodecConfig( 3878):   c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig( 3878): }
D/CCodec  ( 3878): [c2.android.aac.decoder] buffers are bound to CCodec for this session
D/CCodecConfig( 3878): no c2 equivalents for flags
D/CCodecConfig( 3878): config failed => CORRUPTED
D/CCodecConfig( 3878): c2 config diff is   c2::u32 raw.channel-count.value = 6
D/CCodecConfig( 3878):   c2::u32 raw.sample-rate.value = 48000
W/Codec2Client( 3878): query -- param skipped: index = 1107298332.
D/CCodec  ( 3878): client requested max input size 1489, which is smaller than what component recommended (8192); overriding with component recommendation.
W/CCodec  ( 3878): This behavior is subject to change. It is recommended that app developers double check whether the requested max input size is in reasonable range.
D/CCodec  ( 3878): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  ( 3878):   int32_t aac-drc-album-mode = 0
D/CCodec  ( 3878):   int32_t aac-drc-boost-level = 127
D/CCodec  ( 3878):   int32_t aac-drc-cut-level = 127
D/CCodec  ( 3878):   int32_t aac-drc-effect-type = 3
D/CCodec  ( 3878):   int32_t aac-drc-heavy-compression = 3
D/CCodec  ( 3878):   int32_t aac-encoded-target-level = -1
D/CCodec  ( 3878):   int32_t aac-max-output-channel_count = 8
D/CCodec  ( 3878):   int32_t aac-target-ref-level = 64
D/CCodec  ( 3878):   int32_t channel-count = 6
D/CCodec  ( 3878):   int32_t level = 0
D/CCodec  ( 3878):   int32_t max-input-size = 8192
D/CCodec  ( 3878):   string mime = "audio/mp4a-latm"
D/CCodec  ( 3878):   int32_t profile = 2
D/CCodec  ( 3878):   int32_t sample-rate = 48000
D/CCodec  ( 3878): } and output: AMessage(what = 0x00000000) = {
D/CCodec  ( 3878):   int32_t aac-drc-album-mode = 0
D/CCodec  ( 3878):   int32_t aac-drc-boost-level = 127
D/CCodec  ( 3878):   int32_t aac-drc-cut-level = 127
D/CCodec  ( 3878):   int32_t aac-drc-effect-type = 3
D/CCodec  ( 3878):   int32_t aac-drc-heavy-compression = 3
D/CCodec  ( 3878):   int32_t aac-drc-output-loudness = -1
D/CCodec  ( 3878):   int32_t aac-encoded-target-level = -1
D/CCodec  ( 3878):   int32_t aac-max-output-channel_count = 8
D/CCodec  ( 3878):   int32_t aac-target-ref-level = 64
D/CCodec  ( 3878):   int32_t channel-count = 6
D/CCodec  ( 3878):   string mime = "audio/raw"
D/CCodec  ( 3878):   int32_t sample-rate = 48000
D/CCodec  ( 3878): }
W/Codec2Client( 3878): query -- param skipped: index = 1342179345.
W/Codec2Client( 3878): query -- param skipped: index = 2415921170.
W/Codec2Client( 3878): query -- param skipped: index = 1610614798.
E/FMQ     ( 3878): grantorIdx must be less than 3
E/FMQ     ( 3878): grantorIdx must be less than 3
D/CCodecBufferChannel( 3878): [c2.android.aac.decoder#759] Created input block pool with allocatorID 16 => poolID 18 - OK (0)
I/CCodecBufferChannel( 3878): [c2.android.aac.decoder#759] Created output block pool with allocatorID 16 => poolID 703 - OK
D/CCodecBufferChannel( 3878): [c2.android.aac.decoder#759] Configured output block pool ids 703 => OK
E/FMQ     ( 3878): grantorIdx must be less than 3
E/FMQ     ( 3878): grantorIdx must be less than 3
D/CCodecConfig( 3878): c2 config diff is   c2::i32 coding.drc.compression-mode.value = 1
D/CCodecBuffers( 3878): [c2.android.aac.decoder#759:Output[N]] popFromStashAndRegister: output format changed to AMessage(what = 0x00000000) = {
D/CCodecBuffers( 3878):   int32_t aac-drc-album-mode = 0
D/CCodecBuffers( 3878):   int32_t aac-drc-boost-level = 127
D/CCodecBuffers( 3878):   int32_t aac-drc-cut-level = 127
D/CCodecBuffers( 3878):   int32_t aac-drc-effect-type = 3
D/CCodecBuffers( 3878):   int32_t aac-drc-heavy-compression = 1
D/CCodecBuffers( 3878):   int32_t aac-drc-output-loudness = -1
D/CCodecBuffers( 3878):   int32_t aac-encoded-target-level = -1
D/CCodecBuffers( 3878):   int32_t aac-max-output-channel_count = 8
D/CCodecBuffers( 3878):   int32_t aac-target-ref-level = 64
D/CCodecBuffers( 3878):   int32_t channel-count = 6
D/CCodecBuffers( 3878):   string mime = "audio/raw"
D/CCodecBuffers( 3878):   int32_t sample-rate = 48000
D/CCodecBuffers( 3878): }
D/BufferPoolAccessor2.0( 3878): evictor expired: 1, evicted: 0
D/BufferPoolAccessor2.0( 3878): bufferpool2 0x7dda4d50a8 : 5(40960 size) total buffers - 4(32768 size) used buffers - 1/6 (recycle/alloc) - 5/21 (fetch/transfer)
D/BufferPoolAccessor2.0( 3878): evictor expired: 1, evicted: 1

harmeet-rgyan avatar Jan 25 '22 05:01 harmeet-rgyan

Any updates on this? thx

jtkeyva avatar May 20 '22 20:05 jtkeyva