media-kit / media-kit

A cross-platform video player & audio player for Flutter & Dart.
https://github.com/media-kit/media-kit
MIT License
916 stars 132 forks source link

[Bug Report][Android] lag #245

Closed Generalomosco closed 10 months ago

Generalomosco commented 11 months ago

Video not playing smoothly, it always print these logs when lagging...


D/AudioTrack(21828): flush(953): 0xb40000743110f400, prior state:STATE_ACTIVE
D/alomosco.myapp(21828): PlayerBase::stop() from IPlayer
D/AudioTrack(21828): stop(953): 0xb40000743110f400, prior state:STATE_ACTIVE
D/AudioTrackShared(21828): this(0xb4000074306ca1e0), mCblk(0x75901e6100), front(1808450), mIsOut 1, interrupt() FUTEX_WAKE
D/AudioTrack(21828): stop(953): 0xb40000743110f400 stop done
D/AudioTrack(21828): start(953): 0xb40000743110f400, prior state:STATE_STOPPED
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(21828): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(21828): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
I/MiMediaCodec(21828): send last fps
I/MiMediaCodec(21828): send fps to display with mLastSendedFps:30.000000 state:1 id:13
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something

D/AudioTrack(21828): start(962): 0xb4000072e2acba00, prior state:STATE_STOPPED
E/libOpenSLES(21828): Configuration error: unknown key
W/libOpenSLES(21828): Leaving AndroidConfiguration::GetConfiguration (SL_RESULT_PARAMETER_INVALID)
D/alomosco.myapp(21828): PlayerBase::stop() from IPlayer
D/AudioTrack(21828): stop(962): 0xb4000072e2acba00, prior state:STATE_ACTIVE
D/AudioTrackShared(21828): this(0xb4000072e2a42860), mCblk(0x75793b8900), front(0), mIsOut 1, interrupt() FUTEX_WAKE
D/AudioTrack(21828): stop(962): 0xb4000072e2acba00 stop done
E/gralloc4(21828): Empty SMPTE 2094-40 data
D/BufferPoolAccessor2.0(21828): bufferpool2 0xb400007430104428 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 10/11 (fetch/transfer)
D/BufferPoolAccessor2.0(21828): evictor expired: 3, evicted: 1
D/BufferPoolAccessor2.0(21828): bufferpool2 0xb4000072cd9a5828 : 10(20971520 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 6/6 (fetch/transfer)
D/BufferPoolAccessor2.0(21828): evictor expired: 1, evicted: 1
D/AudioTrack(21828): start(953): 0xb40000743110f400, prior state:STATE_STOPPED
E/gralloc4(21828): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(21828): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(21828): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(21828): Empty SMPTE 2094-40 data
D/CCodecBufferChannel(21828): elapsed: mInputMetEos 0, hasPendingOutputsInClient 0, n 17
D/PipelineWatcher(21828): [0xb4000072cd4c2268] elapsed: mFramesInPipeline 6, n 17
D/CCodecBufferChannel(21828): elapsed: mInputMetEos 0, hasPendingOutputsInClient 0, n 17
D/PipelineWatcher(21828): [0xb40000729761b568] elapsed: mFramesInPipeline 0, n 17

D/AudioTrack(25424): flush(966): 0xb4000072d8555a00, prior state:STATE_ACTIVE
D/alomosco.myapp(25424): PlayerBase::stop() from IPlayer
D/AudioTrack(25424): stop(966): 0xb4000072d8555a00, prior state:STATE_ACTIVE
D/AudioTrackShared(25424): this(0xb4000072de432ae0), mCblk(0x757da77300), front(64223), mIsOut 1, interrupt() FUTEX_WAKE
D/AudioTrack(25424): stop(966): 0xb4000072d8555a00 stop done
D/CCodecBufferChannel(25424): elapsed: mInputMetEos 0, hasPendingOutputsInClient 1, n 17
D/PipelineWatcher(25424): [0xb4000072ddaf6568] elapsed: mFramesInPipeline 0, n 17
D/BufferPoolAccessor2.0(25424): bufferpool2 0xb4000072ddabb628 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 10/12 (fetch/transfer)
D/BufferPoolAccessor2.0(25424): bufferpool2 0xb4000072d84b3028 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 7/7 (fetch/transfer)
D/BufferPoolAccessor2.0(25424): evictor expired: 2, evicted: 2
D/AudioTrack(25424): start(966): 0xb4000072d8555a00, prior state:STATE_STOPPED
E/gralloc4(25424): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
D/BufferPoolAccessor2.0(25424): bufferpool2 0xb400007409f0ec28 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 6/6 (fetch/transfer)
D/BufferPoolAccessor2.0(25424): bufferpool2 0xb4000072d8e9b428 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 6/6 (fetch/transfer)
D/BufferPoolAccessor2.0(25424): bufferpool2 0xb4000074de095c28 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 6/6 (fetch/transfer)
D/BufferPoolAccessor2.0(25424): bufferpool2 0xb4000072d84fac28 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 14/59 (fetch/transfer)
D/BufferPoolAccessor2.0(25424): bufferpool2 0xb4000072d953f428 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 6/6 (fetch/transfer)
D/BufferPoolAccessor2.0(25424): bufferpool2 0xb4000072af2eac28 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 6/6 (fetch/transfer)
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(25424): Empty SMPTE 2094-40 data
I/MiMediaCodec(25424): send fps to display with mFrameRateByTimestamp:30.000000 state:1 id:3

D/AudioTrack(25424): flush(966): 0xb4000072d8555a00, prior state:STATE_ACTIVE
D/alomosco.myapp(25424): PlayerBase::stop() from IPlayer
D/AudioTrack(25424): stop(966): 0xb4000072d8555a00, prior state:STATE_ACTIVE
D/AudioTrackShared(25424): this(0xb4000072de432ae0), mCblk(0x757da77300), front(627318), mIsOut 1, interrupt() FUTEX_WAKE
D/AudioTrack(25424): stop(966): 0xb4000072d8555a00 stop done
D/CCodecBufferChannel(25424): elapsed: mInputMetEos 0, hasPendingOutputsInClient 1, n 17
D/PipelineWatcher(25424): [0xb4000072ddaf6568] elapsed: mFramesInPipeline 0, n 17
D/AudioTrack(25424): start(966): 0xb4000072d8555a00, prior state:STATE_STOPPED
E/gralloc4(25424): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
D/BufferPoolAccessor2.0(25424): bufferpool2 0xb4000072d84fac28 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 38/277 (fetch/transfer)
E/gralloc4(25424): Empty SMPTE 2094-40 data
I/MiMediaCodec(25424): send last fps
I/MiMediaCodec(25424): send fps to display with mLastSendedFps:30.000000 state:1 id:3
E/CCodecBufferChannel(25424): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
alexmercerind commented 11 months ago

Emulator?

Generalomosco commented 11 months ago

Real device on Redmi Note 11s

alexmercerind commented 11 months ago

I happen to have a Redmi Note 10S, can't experience the same.

alexmercerind commented 11 months ago

There shouldn't be D/AudioTrack logs... we only use OpenSL ES for audio.

Can you try disabling the audio (if it fixes the lag):

player.setAudioTrack(AudioTrack.no());
alexmercerind commented 11 months ago

I may go to sleep. It's 2:00 AM here, I will appreciate quick replies (or you have to wait for 8-10 hours).

Generalomosco commented 11 months ago

Still same thing even disabling the audio

D/CCodecBufferChannel(29245): elapsed: mInputMetEos 0, hasPendingOutputsInClient 1, n 17
D/PipelineWatcher(29245): [0xb4000072d4d62868] elapsed: mFramesInPipeline 0, n 17
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/gralloc4(29245): Empty SMPTE 2094-40 data
D/BufferPoolAccessor2.0(29245): bufferpool2 0xb4000072f0bc8228 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 14/48 (fetch/transfer)
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something

D/CCodecBufferChannel(29245): elapsed: mInputMetEos 0, hasPendingOutputsInClient 1, n 17
D/PipelineWatcher(29245): [0xb4000072d4d62868] elapsed: mFramesInPipeline 0, n 17
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(29245): Empty SMPTE 2094-40 data
I/MiMediaCodec(29245): send last fps
I/MiMediaCodec(29245): send fps to display with mLastSendedFps:30.000000 state:1 id:5
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something

D/BufferPoolAccessor2.0(29245): bufferpool2 0xb4000072f0bc8228 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 24/115 (fetch/transfer)

D/CCodecBufferChannel(29245): elapsed: mInputMetEos 0, hasPendingOutputsInClient 1, n 17
D/PipelineWatcher(29245): [0xb4000072d4d62868] elapsed: mFramesInPipeline 0, n 17
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something
E/gralloc4(29245): Empty SMPTE 2094-40 data
E/gralloc4(29245): Empty SMPTE 2094-40 data
I/MiMediaCodec(29245): send last fps
I/MiMediaCodec(29245): send fps to display with mLastSendedFps:30.000000 state:1 id:5
E/CCodecBufferChannel(29245): [WA]  long time elapsed since last input queued, let's queue a specific work to HAL to notify something

D/CCodecBufferChannel(29245): elapsed: mInputMetEos 0, hasPendingOutputsInClient 1, n 17
D/PipelineWatcher(29245): [0xb4000072d4d62868] elapsed: mFramesInPipeline 0, n 17
D/BufferPoolAccessor2.0(29245): bufferpool2 0xb40000742e4af828 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 6/6 (fetch/transfer)
D/BufferPoolAccessor2.0(29245): bufferpool2 0xb40000742ea60c28 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 7/7 (fetch/transfer)
D/BufferPoolAccessor2.0(29245): bufferpool2 0xb4000074378ab228 : 8(16777216 size) total buffers - 8(16777216 size) used buffers - 0/10 (recycle/alloc) - 6/6 (fetch/transfer)
alexmercerind commented 11 months ago

How does passing enableHardwareAcceleration: false in VideoController constructor do?

alexmercerind commented 11 months ago

Also... How does mpv perform on your device?

https://play.google.com/store/apps/details?id=is.xyz.mpv

Generalomosco commented 11 months ago

Also... How does mpv perform on your device?

https://play.google.com/store/apps/details?id=is.xyz.mpv

It plays perfect with the app

Generalomosco commented 11 months ago

How does passing enableHardwareAcceleration: false in VideoController constructor do?

Still lagging but no more logs when disabled

Generalomosco commented 11 months ago

This is the video i'm testing it with https://codeuplifts.com/static/NaturePortrait.mp4 but still same with other videos with high dimensions.

With mpv app on playstore sometimes it still stop and continue once or twice, but not that worse as mine. i have fast network

alexmercerind commented 11 months ago

I'm unable to play that MRL in Google Chrome as well. The connection speed seems to be very slow, which seems like the actual issue. Be assured that the performance of package:media_kit is very good on all platforms. Although I'm not denying the presence of any problem which I'm not aware of.

alexmercerind commented 11 months ago

I fetched & downloaded the video; I can't seem to experience lag of any kind on my Redmi Note 10S with G95.

ScorpiosCrux commented 11 months ago

I am experiencing a similar issue using this link . (Downloaded and played with media_kit package)

Any ideas on what could be wrong?

Here is what the console shows:


/CCodecBuffers(32732): Increasing local buffer pool capacity from 66355200 to 132710400
D/CCodecBuffers(32732): Increasing local buffer pool capacity from 132710400 to 265420800
The Flutter DevTools debugger and profiler on H96 Max V58 is available at: http://127.0.0.1:9102?uri=http://127.0.0.1:34401/tJo2l9ZKvww=/
D/CCodecConfig(32732): c2 config diff is   c2::u32 raw.crop.height = 2160
D/CCodecConfig(32732):   c2::u32 raw.crop.left = 0
D/CCodecConfig(32732):   c2::u32 raw.crop.top = 0
D/CCodecConfig(32732):   c2::u32 raw.crop.width = 3840
W/ColorUtils(32732): expected specified color aspects (2:0:0:0)
D/CCodecBuffers(32732): [c2.rk.avc.decoder#453:Output[N]] updating image-data
D/CCodecBuffers(32732): [c2.rk.avc.decoder#453:Output[N]] updating stride = 3840, width: 3840, height: 2160
D/CCodecBuffers(32732): [c2.rk.avc.decoder#453:Output[N]] updating vstride = 2160
I/flutter (32732): gpu
I/media_kit(32732): com.alexmercerind.media_kit_video.VideoOutputManager.setSurfaceTextureSize: -5476376625224721712 3840 2160
D/CCodecBufferChannel(32732): [c2.rk.avc.decoder#453] Discard frames from previous generation.
D/CCodecBufferChannel(32732): [c2.rk.avc.decoder#453] Discard frames from previous generation.
D/CCodecBufferChannel(32732): [c2.rk.avc.decoder#453] Discard frames from previous generation.
I/CCodecConfig(32732): query failed after returning 11 values (BAD_INDEX)
W/Codec2Client(32732): query -- param skipped: index = 1342179345.
W/Codec2Client(32732): query -- param skipped: index = 2415921170.
W/Codec2Client(32732): query -- param skipped: index = 1073743886.
W/Codec2Client(32732): query -- param skipped: index = 1610614798.
I/CCodecConfig(32732): query failed after returning 11 values (BAD_INDEX)
W/Codec2Client(32732): query -- param skipped: index = 1342179345.
W/Codec2Client(32732): query -- param skipped: index = 2415921170.
W/Codec2Client(32732): query -- param skipped: index = 1073743886.
W/Codec2Client(32732): query -- param skipped: index = 1610614798.
D/CCodecBufferChannel(32732): [c2.rk.avc.decoder#453] Ignoring stale input buffer done callback: last flush index = 16, frameIndex = 16
D/BufferPoolAccessor2.0(32732): bufferpool2 0xb4000079753c60a8 : 4(25067520 size) total buffers - 4(25067520 size) used buffers - 0/4 (recycle/alloc) - 4/208 (fetch/transfer)
D/BufferPoolAccessor2.0(32732): evictor expired: 1, evicted: 1
D/BufferPoolAccessor2.0(32732): bufferpool2 0xb4000079753c60a8 : 4(25067520 size) total buffers - 4(25067520 size) used buffers - 0/4 (recycle/alloc) - 4/547 (fetch/transfer)
D/BufferPoolAccessor2.0(32732): bufferpool2 0xb4000079753c60a8 : 4(25067520 size) total buffers - 4(25067520 size) used buffers - 0/4 (recycle/alloc) - 4/882 (fetch/transfer)
D/BufferPoolAccessor2.0(32732): bufferpool2 0xb4000079753c60a8 : 4(25067520 size) total buffers - 4(25067520 size) used buffers - 0/4 (recycle/alloc) - 4/1228 (fetch/transfer)
D/BufferPoolAccessor2.0(32732): bufferpool2 0xb4000079753c60a8 : 4(25067520 size) total buffers - 4(25067520 size) used buffers - 0/4 (recycle/alloc) - 4/1570 (fetch/transfer)
D/BufferPoolAccessor2.0(32732): bufferpool2 0xb4000079753c60a8 : 4(25067520 size) total buffers - 4(25067520 size) used buffers - 0/4 (recycle/alloc) - 4/1918 (fetch/transfer)
D/BufferPoolAccessor2.0(32732): bufferpool2 0xb4000079753c60a8 : 4(25067520 size) total buffers - 4(25067520 size) used buffers - 0/4 (recycle/alloc) - 4/2264 (fetch/transfer)
alexmercerind commented 11 months ago

Hi @ScorpiosCrux, thanks for joining in.

Behavior varies on different devices at times, especially in hardware decoding.

Can you try these configurations on your device? The first one seems to be default in mpv; but I experienced crashes.

configuration: const VideoControllerConfiguration(
  vo: 'gpu',
  hwdec: 'mediacodec',
),
configuration: const VideoControllerConfiguration(
  vo: 'mediacodec_embed',
  hwdec: 'mediacodec',
),
alexmercerind commented 11 months ago

Also:

ScorpiosCrux commented 11 months ago

Hello, I have added

configuration: const VideoControllerConfiguration(
  vo: 'mediacodec_embed',
  hwdec: 'mediacodec',
),

and now the video is playing very smoothly with no more than 10% CPU usage.

Thanks for the help!

alexmercerind commented 11 months ago

--vo=mediacodec_embed is very (very-very) efficient; beats-off anything that exists for Android.

While this happens to work on your device, it may yield a crash on some (older or low-end) devices. An approach for package:media_kit can be to select configurations based on the device chipset (select the most efficient where it's safe). This process will obviously rely upon reports from the users.

ScorpiosCrux commented 11 months ago

I am back with an update.

I am testing the code on 2 devices:

  1. H96 Max v58 with: RK3588 quad-core Cortex-A76 and quad-core Cortex-A55
  2. Orange Pi 5 with: Rockchip RK3588S 8-core 64-bit processor

Two issues:

What I have tried:

  ... const VideoControllerConfiguration( vo: "gpu", hwdec: "rkmpp", width: 3840, height: 2160, enableHardwareAcceleration: true);
  ... const VideoControllerConfiguration( vo: "mediacodec_embed", hwdec: "mediacodec", width: 3840, height: 2160, enableHardwareAcceleration: true);

Any suggestions? Also, you mentioned you tested it with 8K 60 FPS, do you know what hardware you tested it on?

alexmercerind commented 11 months ago

I suppose it's not related to hardware problem (this issue is actually opened for it), then.

8K 60FPS is actually heavy for any mobile chipset.

alexmercerind commented 11 months ago

Natively, Android has that android.view.SurfaceHolder which dynamically sets the render surface size based on the "mount" size.

But, here in Flutter I manually set the render surface size using android.graphics.SurfaceTexture.setDefaultBufferSize based on video resolution.

See:

https://github.com/alexmercerind/media_kit/blob/c5455401544339da5b0013216774ea04d5ec9f45/media_kit_video/lib/src/video_controller/android_video_controller/real.dart#L112

ScorpiosCrux commented 11 months ago

You mentioned you tested 8K 60FPS on some hardware, what hardware did you use?

alexmercerind commented 11 months ago

My good ol' Redmi Note 10S with G95.

BulbulRathore commented 10 months ago

Hi @ScorpiosCrux, thanks for joining in.

Behavior varies on different devices at times, especially in hardware decoding.

Can you try these configurations on your device? The first one seems to be default in mpv; but I experienced crashes.

configuration: const VideoControllerConfiguration(
  vo: 'gpu',
  hwdec: 'mediacodec',
),
configuration: const VideoControllerConfiguration(
  vo: 'mediacodec_embed',
  hwdec: 'mediacodec',
),
BulbulRathore commented 10 months ago

Hi @ScorpiosCrux, thanks for joining in.

Behavior varies on different devices at times, especially in hardware decoding.

Can you try these configurations on your device? The first one seems to be default in mpv; but I experienced crashes.

configuration: const VideoControllerConfiguration(
  vo: 'gpu',
  hwdec: 'mediacodec',
),
configuration: const VideoControllerConfiguration(
  vo: 'mediacodec_embed',
  hwdec: 'mediacodec',
),

Is there any similar configuration for macos and windows? it's lagging in macos and windows.

alexmercerind commented 10 months ago

What's your video resolution & hardware specification?

BulbulRathore commented 10 months ago

@alexmercerind In my application I have allowed upto 5MB and the video I uploaded is 814KB and also it's lagging if I upload and play audio file (52kb) mainly it's lagging when I play 3-4 audio or video files then the application completely stuck

alexmercerind2 commented 10 months ago

Have you added media_kit_native_event_loop?

I won't be able to help out with just remarks like these. package:media_kit outperforms Google Chrome if we talk raw performance. Share logs, sample files, platform, specs or at-least the video resolution.

alexmercerind2 commented 10 months ago

Make sure you dispose Players correctly too.

BulbulRathore commented 10 months ago

I am not getting any error logs. will share sample files. disposing Player correctly but I didn't added media_kit_native_event_loop. will add this.

alexmercerind commented 10 months ago

A stable version has been rolled out. A number of major enhancements.

Please refer to the "Installation" section of the README to receive the update.

Now direct mediacodec is used on Android, which will greatly enhance the performance. The stability has also been improved.

alexmercerind commented 10 months ago

@BulbulRathore

The current video playback performance is comparable to that in Chromium/Google-Chrome on Windows. This is the performance on my 350$ laptop having entry-level Ryzen 3 2200U with integrated Radeon Vega 3 graphics. It should be better on a more capable GPU/CPU.

Check your video drivers or the presence of media_kit_native_event_loop, which adds support for more simultaneous videos.

https://user-images.githubusercontent.com/28951144/255023041-a445f9a3-f17e-47a8-b75b-38e5d3d18f87.mp4