Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes generate TransactionTooLargeException #94

Closed
1 task
XuQK opened this issue Jun 23, 2022 · 5 comments
Closed
1 task

Sometimes generate TransactionTooLargeException #94

XuQK opened this issue Jun 23, 2022 · 5 comments
Assignees

Comments

@XuQK
Copy link

XuQK commented Jun 23, 2022

Media3 Version

1.0.0-beta01

Devices that reproduce the issue

Samsung galaxy note 10 5G running Android 11

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

Just call MediaController.setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs)

Expected result

normal set

Actual result

2022-06-23 15:29:51.717 24213-24213/
 W/MSImplBase: Exception in ControllerInfo {pkg=, uid=10526})
      android.os.TransactionTooLargeException: data parcel size 443252 bytes
        at android.os.BinderProxy.transactNative(Native Method)
        at android.os.BinderProxy.transact(BinderProxy.java:605)
        at androidx.media3.session.IMediaController$Stub$Proxy.onPlayerInfoChanged(IMediaController.java:491)
        at androidx.media3.session.MediaSessionStub$Controller2Cb.onPlayerInfoChanged(MediaSessionStub.java:1723)
        at androidx.media3.session.MediaSessionImpl.dispatchOnPlayerInfoChanged(MediaSessionImpl.java:400)
        at androidx.media3.session.MediaSessionImpl.access$600(MediaSessionImpl.java:79)
        at androidx.media3.session.MediaSessionImpl$PlayerInfoChangedHandler.handleMessage(MediaSessionImpl.java:1193)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:246)
        at android.app.ActivityThread.main(ActivityThread.java:8653)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Media

Not applicable

Bug Report

@marcbaechinger
Copy link
Contributor

Can you shed some light on what you are doing when this happens? How many media items are you setting? What properties of the media items/metadata do you set?

@XuQK
Copy link
Author

XuQK commented Jun 23, 2022

I just call controller.setMediaItems(listOf(MediaItem()), 0, 0) in controller futures listener in Activity, the media item only 1, I get MediaItem through this:

MediaItem.Builder()
        .setRequestMetadata(
            MediaItem.RequestMetadata.Builder()
                .setMediaUri("file absolute path")
                .build()
        )
        .build()

In AudioService, onAddMediaItems callback, I quety info from MediaStore, and gererate a new MediaItem:

metadataBuilder.run {
    setTitle(cursor.getString(columnIndexOfTitle))
    setDurationStr(cursor.getLong(columnIndexOfDuration).formatToVideoDuration())
    setArtist(cursor.getString(columnIndexOfArtist))
    setFolderType(MediaMetadata.FOLDER_TYPE_NONE)
    setIsPlayable(true)
}
list.add(
    MediaItem.Builder()
        .setRequestMetadata(
            MediaItem.RequestMetadata.Builder().setMediaUri(Uri.parse(path)).build()
        )
        .setMediaMetadata(metadataBuilder.build())
        .setMediaId(id)
        .setUri(path)
        .build()
)

When I meet the Exception above, the mediaController's listener in Activity do this:
onMediaItemTransition normal call.
onIsPlayingChanged not call.

this audio file attached:
大島ミチル - Patema Inverse.mp3.zip

@XuQK
Copy link
Author

XuQK commented Jun 30, 2022

I found something new.
when this happens, controller.isConnected is true, but controller.isPlaying is false, actually the song is playing, and controller.currentPosition is continued to increase.
The player service is Running another process, not default process.

@XuQK
Copy link
Author

XuQK commented Jul 4, 2022

I may have found the reason, maybe the notification bitmap from SimpleBitmapLoader is too big.
I added a sampling process at the end of SimpleBitmapLoader.decode(bitmap: Bitmap) method, the error I described above has never appeared so far.

But it there are still problem if PlaybackService running in another process.

@marcbaechinger
Copy link
Contributor

I'm not aware that the bitmap loaded by the SimpleBitmapLoader is put into the metadata by the library. I would avoid doing that as an app given the problem above.

We have #168 that is about providing a high-res bitmap for the notification. After this is fixed, there should be no need to put binary data into the metadata which seems to avoid the problems described here. I'm closing this as a duplicate of #168.

@androidx androidx locked and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants