ukasz123 / soundpool

Soundpool plugin for Flutter
88 stars 63 forks source link

soundpool.play returned streamId==0 #125

Open eximius313 opened 8 months ago

eximius313 commented 8 months ago

Once in a while it happens that play method returns 0:

I/.remote_contro( 6011): Background young concurrent copying GC freed 5440(402KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 3341KB/3657KB, paused 3.140ms total 469.332ms
D/CCodec  ( 6011): allocate(c2.android.raw.decoder)
D/CCodec  ( 6011): allocate(c2.android.raw.decoder)
I/Codec2Client( 6011): Available Codec2 services: "software"
I/CCodec  ( 6011): Created component [c2.android.raw.decoder]
I/CCodec  ( 6011): Created component [c2.android.raw.decoder]
D/CCodecConfig( 6011): read media type: audio/raw
D/CCodecConfig( 6011): read media type: audio/raw
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: algo.buffers.allocator-ids.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig( 6011): query failed after returning 8 values (BAD_INDEX)
D/CCodecConfig( 6011): c2 config diff is Dict {
D/CCodecConfig( 6011):   c2::u32 coded.bitrate.value = 64000
D/CCodecConfig( 6011):   c2::u32 input.buffers.max-size.value = 65536
D/CCodecConfig( 6011):   c2::u32 input.delay.value = 0
D/CCodecConfig( 6011):   string input.media-type.value = "audio/raw"
D/CCodecConfig( 6011):   string output.media-type.value = "audio/raw"
D/CCodecConfig( 6011):   c2::u32 raw.channel-count.value = 2
D/CCodecConfig( 6011):   c2::u32 raw.pcm-encoding.value = 0
D/CCodecConfig( 6011):   c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig( 6011): }
D/CCodec  ( 6011): [c2.android.raw.decoder] buffers are bound to CCodec for this session
D/CCodecConfig( 6011): no c2 equivalents for durationUs
D/CCodecConfig( 6011): no c2 equivalents for track-id
D/CCodecConfig( 6011): no c2 equivalents for bits-per-sample
D/CCodecConfig( 6011): no c2 equivalents for channel-mask
D/CCodecConfig( 6011): no c2 equivalents for flags
W/Codec2Client( 6011): query -- param skipped: index = 1107298332.
D/CCodec  ( 6011): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  ( 6011):   int32_t channel-count = 2
D/CCodec  ( 6011):   int32_t max-input-size = 65536
D/CCodec  ( 6011):   string mime = "audio/raw"
D/CCodec  ( 6011):   int32_t pcm-encoding = 2
D/CCodec  ( 6011):   int32_t sample-rate = 44100
D/CCodec  ( 6011): } and output: AMessage(what = 0x00000000) = {
D/CCodec  ( 6011):   int32_t channel-count = 2
D/CCodec  ( 6011):   string mime = "audio/raw"
D/CCodec  ( 6011):   int32_t pcm-encoding = 2
D/CCodec  ( 6011):   int32_t sample-rate = 44100
D/CCodec  ( 6011):   int32_t channel-mask = 0
D/CCodec  ( 6011): }
W/Codec2Client( 6011): query -- param skipped: index = 1342179345.
W/Codec2Client( 6011): query -- param skipped: index = 2415921170.
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: algo.buffers.max-count.values
E/FMQ     ( 6011): grantorIdx must be less than 3
E/FMQ     ( 6011): grantorIdx must be less than 3
D/CCodecBufferChannel( 6011): [c2.android.raw.decoder#614] Created input block pool with allocatorID 16 => poolID 17 - OK (0)
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: algo.buffers.allocator-ids.values
I/CCodecBufferChannel( 6011): [c2.android.raw.decoder#614] Created output block pool with allocatorID 16 => poolID 27 - OK
D/CCodecBufferChannel( 6011): [c2.android.raw.decoder#614] Configured output block pool ids 27 => OK
E/ion     ( 6011): ioctl c0044901 failed with code -1: Inappropriate ioctl for device
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater( 6011): extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig( 6011): query failed after returning 8 values (BAD_INDEX)
D/CCodecConfig( 6011): c2 config diff is Dict {
D/CCodecConfig( 6011):   c2::u32 coded.bitrate.value = 64000
D/CCodecConfig( 6011):   c2::u32 input.buffers.max-size.value = 65536
D/CCodecConfig( 6011):   c2::u32 input.delay.value = 0
D/CCodecConfig( 6011):   string input.media-type.value = "audio/raw"
D/CCodecConfig( 6011):   string output.media-type.value = "audio/raw"
D/CCodecConfig( 6011):   c2::u32 raw.channel-count.value = 2
D/CCodecConfig( 6011):   c2::u32 raw.pcm-encoding.value = 0
D/CCodecConfig( 6011):   c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig( 6011): }
D/CCodec  ( 6011): [c2.android.raw.decoder] buffers are bound to CCodec for this session
D/CCodecConfig( 6011): no c2 equivalents for durationUs
D/CCodecConfig( 6011): no c2 equivalents for track-id
D/CCodecConfig( 6011): no c2 equivalents for bits-per-sample
D/CCodecConfig( 6011): no c2 equivalents for channel-mask
D/CCodecConfig( 6011): no c2 equivalents for flags
W/Codec2Client( 6011): query -- param skipped: index = 1107298332.
D/CCodec  ( 6011): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  ( 6011):   int32_t channel-count = 2
D/CCodec  ( 6011):   int32_t max-input-size = 65536
D/CCodec  ( 6011):   string mime = "audio/raw"
D/CCodec  ( 6011):   int32_t pcm-encoding = 2
D/CCodec  ( 6011):   int32_t sample-rate = 44100
D/CCodec  ( 6011): } and output: AMessage(what = 0x00000000) = {
D/CCodec  ( 6011):   int32_t channel-count = 2
D/CCodec  ( 6011):   string mime = "audio/raw"
D/CCodec  ( 6011):   int32_t pcm-encoding = 2
D/CCodec  ( 6011):   int32_t sample-rate = 44100
D/CCodec  ( 6011):   int32_t channel-mask = 0
D/CCodec  ( 6011): }
W/Codec2Client( 6011): query -- param skipped: index = 1342179345.
W/Codec2Client( 6011): query -- param skipped: index = 2415921170.
E/FMQ     ( 6011): grantorIdx must be less than 3
E/FMQ     ( 6011): grantorIdx must be less than 3
D/CCodecBufferChannel( 6011): [c2.android.raw.decoder#695] Created input block pool with allocatorID 16 => poolID 18 - OK (0)
I/CCodecBufferChannel( 6011): [c2.android.raw.decoder#695] Created output block pool with allocatorID 16 => poolID 28 - OK
D/CCodecBufferChannel( 6011): [c2.android.raw.decoder#695] Configured output block pool ids 28 => OK
E/FMQ     ( 6011): grantorIdx must be less than 3
E/FMQ     ( 6011): grantorIdx must be less than 3

Of course trying to stop this streamId results with:

E/flutter ( 6011): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:soundpool/soundpool.dart': Failed assertion: line 213 pos 12: 'streamId > 0': Invalid 'streamId' parameter. Only values greater than 0 are valid.
E/flutter ( 6011): #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter ( 6011): #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter ( 6011): #2      Soundpool.stop (package:soundpool/soundpool.dart:213:12)
ukasz123 commented 8 months ago

Can you provided a at least semi-reliable way to reproduce the problem? Does it depend on sound files you use?

eximius313 commented 8 months ago

Unfortunatelly I have not figure it out yet ;( It happened twice - each time when the app was starting and sound was played right after SoudPool was created. Perhaps some kind of race condition?

novas1r1 commented 2 months ago

@eximius313 have you found a solution? I'm having the same issue and I'm sometimes able to start my sounds, but I'm not able to stop them.

eximius313 commented 2 months ago

no. I just retry on 0