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

App crashed when I use exoplayer #3071

Closed
psedoykin opened this issue Jul 16, 2017 · 8 comments
Closed

App crashed when I use exoplayer #3071

psedoykin opened this issue Jul 16, 2017 · 8 comments
Assignees

Comments

@psedoykin
Copy link

psedoykin commented Jul 16, 2017

Hello,
I use exoplayer for playing radio from some internet stream.
I have implemented that user can change radio from app. (using viewpager)
For it I use the following code:

  1. Create and init exoplayer
 private void createMediaPlayerIfNeeded() {
        Log.d(TAG, "createMediaPlayerIfNeeded");
        if (mPlayer == null) {
            Log.d(TAG, "createMediaPlayerIfNeeded: mPlayer != null");
            LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE), DEFAULT_MIN_BUFFER_MS,
                    DEFAULT_MAX_BUFFER_MS, DEFAULT_BUFFER_FOR_PLAYBACK_MS, DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS);

            DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(mContext);

            TrackSelection.Factory videoTrackSelectionFactory =
                    new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);
            TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

            mPlayer = ExoPlayerFactory.newSimpleInstance(renderersFactory,
                    trackSelector,
                    loadControl);

            mPlayer.setAudioStreamType(C.STREAM_TYPE_MUSIC);
            mPlayer.addListener(this);

            mPlayer.setAudioDebugListener(new AudioRendererEventListener() {
                @Override
                public void onAudioEnabled(DecoderCounters counters) {

                }

                @Override
                public void onAudioSessionId(int audioSessionId) {
                    if (mTypeAudio == PlaybackParams.TypeAudio.RADIO && mCallback != null) {
                        mCallback.onAudioSessionCreated(audioSessionId);
                    }
                }

                @Override
                public void onAudioDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) {

                }

                @Override
                public void onAudioInputFormatChanged(Format format) {

                }

                @Override
                public void onAudioTrackUnderrun(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs) {

                }

                @Override
                public void onAudioDisabled(DecoderCounters counters) {

                }
            });
        } else {
            mPlayer.stop();
        }
    }
  1. Start playing:
    private void play(Uri uri) {

        Log.d(TAG, "play(Uri uri)");

        tryToGetAudioFocus();

        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(mContext,
                Util.getUserAgent(mContext, "mediaPlayerSample"));

        ExtractorMediaSource mediaSource = new ExtractorMediaSource(uri,
                dataSourceFactory,
                new DefaultExtractorsFactory(),
                null,
                null);

        mPlayer.prepare(mediaSource);
        mPlayer.setPlayWhenReady(true);
    }

When I change the radio very quickly from applications, it crashes and the application falls.
I cannot find why.
Could you help me with the issue ?
How can I enble some logs for exoplayer ?
Or may be I incorrect use mediaSource for exoplayer?

Please look at some logs for the issue:

07-16 16:11:24.365 197-197/? W/ADB_SERVICES: LS(33289): bound to 'shell:cat /proc/stat' via 22
07-16 16:11:24.366 10819-10819/? W/ADB_SERVICES: adb: unable to open /proc/10819/oom_adj
07-16 16:11:24.369 197-197/? D/ADB_SERVICES:  closing because is_eof=1 r=1 s->fde.force_eof=0
07-16 16:11:24.369 197-197/? W/ADB_SERVICES: entered. LS(33289) fd=22
07-16 16:11:24.398 141-410/? D/AudioMTKStreamOut: AudioMTKStreamOut::write (-)
07-16 16:11:24.405 561-622/? D/InputReader: AP_PROF:AppLaunch_dispatchPtr:Up:29773286
07-16 16:11:24.410 10810-10810/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-16 16:11:24.410 10810-10810/? I/DEBUG: Build fingerprint: 'Huawei/H30-U10/hwH30-U10:4.2.2/HuaweiH30-U10/C900B114:user/ota-rel-keys,release-keys'
07-16 16:11:24.411 10810-10810/? I/DEBUG: pid: 9695, tid: 10809, name: Thread-4172  >>> com.psedoykin.keysound <<<
07-16 16:11:24.411 10810-10810/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
 mWifiIconId=0x7f0302c1 mBluetoothTetherIconId=0x1080561
07-16 16:11:24.535 764-764/? D/StatusBar.MSimNetworkController: refreshViews update icon subscription===0 mMSimPhoneSignalIconId[subscription]===2130903683 mMSimPhoneSignalTypeIconId[subscription]===0 mMSimMobileActivityIconId[subscription]===0 mMSimDataTypeIconId[subscription]===0
07-16 16:11:24.537 141-410/? D/AudioMTKStreamOut: AudioMTKStreamOut::write (-)
07-16 16:11:24.539 10810-10810/? I/DEBUG:     r0 00000000  r1 00000027  r2 deadbfff  r3 00000000
07-16 16:11:24.539 10810-10810/? I/DEBUG:     r4 00000000  r5 64f1ab34  r6 400bac14  r7 602d2730
07-16 16:11:24.539 10810-10810/? I/DEBUG:     r8 00000000  r9 00000000  sl 00000000  fp 400bac3c
07-16 16:11:24.539 10810-10810/? I/DEBUG:     ip 00000001  sp 64f1ab30  lr 4007b3d0  pc 40074c98  cpsr 60000010
07-16 16:11:24.541 10810-10810/? I/DEBUG: backtrace:
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #00  pc 00024c98  /system/lib/libc.so
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #01  pc 00019d90  /system/lib/libc.so (dlfree+3684)
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #02  pc 0000cf38  /system/lib/libc.so (free+16)
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #03  pc 000495b9  /system/lib/libmedia.so (android::sp<android::IAudioRecord>::clear()+18)
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #04  pc 00049611  /system/lib/libmedia.so (android::AudioTrack::~AudioTrack()+64)
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #05  pc 00049685  /system/lib/libmedia.so (android::AudioTrack::~AudioTrack()+4)
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #06  pc 0000efe1  /system/lib/libutils.so (android::RefBase::decStrong(void const*) const+40)
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #07  pc 00061c5b  /system/lib/libandroid_runtime.so (android::sp<android::NativeDisplayEventReceiver>::~sp()+18)
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #08  pc 00084959  /system/lib/libandroid_runtime.so
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #09  pc 0001e090  /system/lib/libdvm.so (dvmPlatformInvoke+112)
@ojw28
Copy link
Contributor

ojw28 commented Jul 17, 2017

Please provide all of the information requested in the issue template if you want us to help with this. In particular a full bugreport (details on how to capture one of these can also be found in the issue template) and information about the device on which you see the issue. It looks like it's device specific to me.

@psedoykin
Copy link
Author

psedoykin commented Jul 17, 2017

Please look at info:

Issue description

Some crash is occured when I quickly change mediaSource for exoplayer.
I cannot find why.
Looks like SimpleExoPlayer incorrect work when I stop it and change mediaSource and start again.

Reproduction steps

  1. init exoplayer
   private void createMediaPlayerIfNeeded() {
        Log.d(TAG, "createMediaPlayerIfNeeded");
        if (mPlayer == null) {
            Log.d(TAG, "createMediaPlayerIfNeeded: mPlayer != null");
            LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE), DEFAULT_MIN_BUFFER_MS,
                    DEFAULT_MAX_BUFFER_MS, DEFAULT_BUFFER_FOR_PLAYBACK_MS, DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS);

            DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(mContext);

            TrackSelection.Factory videoTrackSelectionFactory =
                    new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);
            TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

            mPlayer = ExoPlayerFactory.newSimpleInstance(renderersFactory,
                    trackSelector,
                    loadControl);

            mPlayer.setAudioStreamType(C.STREAM_TYPE_MUSIC);
            mPlayer.addListener(this);

            mPlayer.setAudioDebugListener(new AudioRendererEventListener() {
                @Override
                public void onAudioEnabled(DecoderCounters counters) {

                }

                @Override
                public void onAudioSessionId(int audioSessionId) {
                    if (mTypeAudio == PlaybackParams.TypeAudio.RADIO && mCallback != null) {
                        mCallback.onAudioSessionCreated(audioSessionId);
                    }
                }

                @Override
                public void onAudioDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) {

                }

                @Override
                public void onAudioInputFormatChanged(Format format) {

                }

                @Override
                public void onAudioTrackUnderrun(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs) {

                }

                @Override
                public void onAudioDisabled(DecoderCounters counters) {

                }
            });
        } else {
            mPlayer.stop();
        }
    }
  1. Start playing:
    private void play(Uri uri) {

        Log.d(TAG, "play(Uri uri)");

        tryToGetAudioFocus();

        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(mContext,
                Util.getUserAgent(mContext, "mediaPlayerSample"));

        ExtractorMediaSource mediaSource = new ExtractorMediaSource(uri,
                dataSourceFactory,
                new DefaultExtractorsFactory(),
                null,
                null);

        mPlayer.prepare(mediaSource);
        mPlayer.setPlayWhenReady(true);
    }
  1. Quickly change mediaSource for exoplayer

Actual result:
app is crashed

Version of ExoPlayer being used

com.google.android.exoplayer:exoplayer:r2.4.3

Device(s) and version(s) of Android being used

Android version - 4.2.2
Device - Honor 3C (H30-U10)

A full bug report captured from the device

07-16 16:11:24.365 197-197/? W/ADB_SERVICES: LS(33289): bound to 'shell:cat /proc/stat' via 22
07-16 16:11:24.366 10819-10819/? W/ADB_SERVICES: adb: unable to open /proc/10819/oom_adj
07-16 16:11:24.369 197-197/? D/ADB_SERVICES:  closing because is_eof=1 r=1 s->fde.force_eof=0
07-16 16:11:24.369 197-197/? W/ADB_SERVICES: entered. LS(33289) fd=22
07-16 16:11:24.398 141-410/? D/AudioMTKStreamOut: AudioMTKStreamOut::write (-)
07-16 16:11:24.405 561-622/? D/InputReader: AP_PROF:AppLaunch_dispatchPtr:Up:29773286
07-16 16:11:24.410 10810-10810/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-16 16:11:24.410 10810-10810/? I/DEBUG: Build fingerprint: 'Huawei/H30-U10/hwH30-U10:4.2.2/HuaweiH30-U10/C900B114:user/ota-rel-keys,release-keys'
07-16 16:11:24.411 10810-10810/? I/DEBUG: pid: 9695, tid: 10809, name: Thread-4172  >>> com.psedoykin.keysound <<<
07-16 16:11:24.411 10810-10810/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
 mWifiIconId=0x7f0302c1 mBluetoothTetherIconId=0x1080561
07-16 16:11:24.535 764-764/? D/StatusBar.MSimNetworkController: refreshViews update icon subscription===0 mMSimPhoneSignalIconId[subscription]===2130903683 mMSimPhoneSignalTypeIconId[subscription]===0 mMSimMobileActivityIconId[subscription]===0 mMSimDataTypeIconId[subscription]===0
07-16 16:11:24.537 141-410/? D/AudioMTKStreamOut: AudioMTKStreamOut::write (-)
07-16 16:11:24.539 10810-10810/? I/DEBUG:     r0 00000000  r1 00000027  r2 deadbfff  r3 00000000
07-16 16:11:24.539 10810-10810/? I/DEBUG:     r4 00000000  r5 64f1ab34  r6 400bac14  r7 602d2730
07-16 16:11:24.539 10810-10810/? I/DEBUG:     r8 00000000  r9 00000000  sl 00000000  fp 400bac3c
07-16 16:11:24.539 10810-10810/? I/DEBUG:     ip 00000001  sp 64f1ab30  lr 4007b3d0  pc 40074c98  cpsr 60000010
07-16 16:11:24.541 10810-10810/? I/DEBUG: backtrace:
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #00  pc 00024c98  /system/lib/libc.so
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #01  pc 00019d90  /system/lib/libc.so (dlfree+3684)
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #02  pc 0000cf38  /system/lib/libc.so (free+16)
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #03  pc 000495b9  /system/lib/libmedia.so (android::sp<android::IAudioRecord>::clear()+18)
07-16 16:11:24.541 10810-10810/? I/DEBUG:     #04  pc 00049611  /system/lib/libmedia.so (android::AudioTrack::~AudioTrack()+64)
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #05  pc 00049685  /system/lib/libmedia.so (android::AudioTrack::~AudioTrack()+4)
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #06  pc 0000efe1  /system/lib/libutils.so (android::RefBase::decStrong(void const*) const+40)
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #07  pc 00061c5b  /system/lib/libandroid_runtime.so (android::sp<android::NativeDisplayEventReceiver>::~sp()+18)
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #08  pc 00084959  /system/lib/libandroid_runtime.so
07-16 16:11:24.542 10810-10810/? I/DEBUG:     #09  pc 0001e090  /system/lib/libdvm.so (dvmPlatformInvoke+112)

@ojw28
Copy link
Contributor

ojw28 commented Jul 17, 2017

You have not provided a full bug report. The issue template explicitly states:

Capture a full bug report using "adb bugreport". Output from "adb logcat" or a log snippet is NOT sufficient. Please attach the captured bug report as a file.

@psedoykin
Copy link
Author

bugreport2.txt.zip

attached bugreport

@andrewlewis
Copy link
Collaborator

The attached bug report doesn't seem to include the segmentation fault above. Please could you provide a bug report taken just after reproducing the issue?

@psedoykin
Copy link
Author

The issue is very hard reproduce. I will share bug report when reproduce the issue.

@psedoykin
Copy link
Author

@andrewlewis please look at the report:
log2.txt

@andrewlewis
Copy link
Collaborator

The segmentation fault in log2.txt is in MediaCodec, so you may be able to work around this by returning false from MediaCodecUtil.isCodecUsableDecoder when the codec name is "OMX.MTK.AUDIO.DECODER.MP3", assuming the device has another working MP3 decoder. If that avoids the crashes let us know so we can submit a device-specific workaround. The other crashes pasted above are in AudioTrack not MediaCodec, so this probably won't help with those.

I don't think any of these crashes is caused by ExoPlayer, so please follow up directly with Huawei to get them to fix these device-specific issues. You could also see if any system updates are available for the device.

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

3 participants