Audio Android 5.0设备上的ExoPlayer未完全播放音频文件,在Android 9上正常

Audio Android 5.0设备上的ExoPlayer未完全播放音频文件,在Android 9上正常,audio,android-5.0-lollipop,exoplayer2.x,Audio,Android 5.0 Lollipop,Exoplayer2.x,我正在使用Exoplayer播放简短的mp3(语音)文件,我的代码在运行Android 9的Moto G6上运行良好,我一直在使用它开发应用程序。但是在安卓5.0上的三星S4上运行它,在每段视频结束时大约半秒不会播放 我使用的是Exoplayer,因为用户通常可以选择以慢速播放剪辑,我知道MediaPlayer不会在空闲时这样做 10-04 15:20:25.380 8358-8358/com.englishdreaming.apply D/EventLogger:decoderInitiali

我正在使用Exoplayer播放简短的mp3(语音)文件,我的代码在运行Android 9的Moto G6上运行良好,我一直在使用它开发应用程序。但是在安卓5.0上的三星S4上运行它,在每段视频结束时大约半秒不会播放

我使用的是Exoplayer,因为用户通常可以选择以慢速播放剪辑,我知道MediaPlayer不会在空闲时这样做 10-04 15:20:25.380 8358-8358/com.englishdreaming.apply D/EventLogger:decoderInitialized[0.26,0.00,window=0,period=0,audio,OMX.SEC.mp3.dec] 10-04 15:20:25.380 8358-8358/com.englishdreaming.apply D/EventLogger:decoderInputFormatChanged[0.26,0.00,window=0,period=0,audio,id=null,mimeType=audio/mpeg,channels=2,sample_rate=44100] 10-04 15:20:25.380 8358-8358/com.englishdreaming.apply D/EventLogger:加载[0.26,0.00,窗口=0,周期=0,假] 10-04 15:20:25.380 8358-8636/com.englishdreaming.apply I/ACodec:[OMX.SEC.mp3.dec]现在空闲->执行 10-04 15:20:25.380 8358-8358/com.englishdreaming.apply D/EventLogger:state[0.26,0.00,window=0,period=0,true,READY] 10-04 15:20:25.380 8358-8636/com.englishdreaming.apply I/ACodec:[OMX.SEC.mp3.dec]正在执行 10-04 15:20:25.390 8358-8358/com.englishdreaming.apply D/EventLogger:downstreamFormatChanged[0.27,0.00,window=0,period=0,id=null,mimeType=audio/mpeg,channels=2,sample_rate=44100] 10-04 15:20:25.420 8358-8625/com.englishdreaming.apply E/AudioTrack:AudioTrack::set:Exit 10-04 15:20:25.420 8358-8358/com.englishdreaming.apply D/EventLogger:audioSessionId[0.31,0.00,window=0,period=0944] 10-04 15:20:25.901 8358-8410/com.englishdreaming.apply V/FA:不活动,断开与服务的连接 10-04 15:20:25.911 8358-8358/com.englishdreaming.apply V/FA:onUnbind请求意向。操作:com.google.android.gms.measurement.START 10-04 15:20:25.911 8358-8358/com.englishdreaming.apply V/FA:本地应用测量服务正在关闭 10-04 15:20:26.481 8358-8358/com.englishdreaming.apply D/EventLogger:state[1.37,0.92,window=0,period=0,true,end] 10-04 15:20:26.481 8358-8358/com.englishdreaming.apply I/ExoPlayerImpl:Release 3dfb35fd[ExoPlayerLib/2.8.4][jflte,GT-I9505,三星,21][goog.exo.core] 10-04 15:20:26.491 8358-8636/com.englishdreaming.apply I/ACodec:[OMX.SEC.mp3.dec]正在执行->空闲 10-04 15:20:26.501 8358-8636/com.englishdreaming.apply I/ACodec:[OMX.SEC.mp3.dec]现在空闲->加载 10-04 15:20:26.501 8358-8636/com.englishdreaming.apply I/ACodec:[OMX.SEC.mp3.dec]现在已加载 10-04 15:20:26.511 8358-8636/com.englishdreaming.apply I/ACodec:[OMX.SEC.mp3.dec]现在未初始化 10-04 15:20:26.531 8358-8358/com.englishdreaming.apply D/EventLogger:decoderDisabled[1.41,0.92,window=0,period=0,audio] 10-04 15:20:26.531 8358-8358/com.englishdreaming.apply D/EventLogger:mediaPeriodReleased[1.41,0.92,window=0,period=0]
    public void initExoplayer(int position) {
        Log.d(TAG, "initExoplayer:    CALLED");
        System.out.println("   mUris.SIZE is..  " + mUris.size() + "   and POSITION is...   " + position);

        mpFinished = false;
        
        TrackSelector trackSelector = new DefaultTrackSelector();
        player = ExoPlayerFactory.newSimpleInstance(getApplicationContext(), trackSelector);
        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getApplicationContext(),
                Util.getUserAgent(getApplicationContext(), "appily"));
        Uri clickedUri = mUris.get(position);
        MediaSource audioSource = new ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(clickedUri);
        player.prepare(audioSource);

        player.addAnalyticsListener(new EventLogger(null));
        player.addListener(new Player.EventListener() {
            @Override
            public void onTimelineChanged(Timeline timeline, @Nullable Object manifest, int reason) {

            }

            @Override
            public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {

            }

            @Override
            public void onLoadingChanged(boolean isLoading) {

            }

            @Override
            public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {

                switch (playbackState) {
                    case Player.STATE_BUFFERING:
                        break;
                    case Player.STATE_ENDED:

                        mpFinished = true;

                        if (player != null) {
                            player.release();
                            player = null;
                        }
                        break;
                    case Player.STATE_IDLE:
                        break;
                    case Player.STATE_READY:
                        break;
                    default:
                        break;
                }
            }

            @Override
            public void onRepeatModeChanged(int repeatMode) {

            }

            @Override
            public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {

            }

            @Override
            public void onPlayerError(ExoPlaybackException error) {

            }

            @Override
            public void onPositionDiscontinuity(int reason) {

            }

            @Override
            public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {

            }

            @Override
            public void onSeekProcessed() {

            }
        });

        if (isSlow) {
            PlaybackParameters param = new PlaybackParameters(0.6f);
            player.setPlaybackParameters(param);
        }

        player.setPlayWhenReady(true);
    }

2020-10-04 15:12:30.821 11918-11918/com.englishdreaming.appily D/SpellingActivity: initExoplayer:    CALLED
2020-10-04 15:12:30.821 11918-11918/com.englishdreaming.appily I/System.out:    mUris.SIZE is..  10   and POSITION is...   0
2020-10-04 15:12:30.824 11918-11918/com.englishdreaming.appily I/ExoPlayerImpl: Init 1bfc9f [ExoPlayerLib/2.8.4] [evert_n, moto g(6) plus, motorola, 28]
2020-10-04 15:12:30.835 11918-11918/com.englishdreaming.appily D/EventLogger: state [0.00, 0.00, window=0, true, BUFFERING]
2020-10-04 15:12:30.845 11918-11918/com.englishdreaming.appily D/Constraints: getView: CALLED
2020-10-04 15:12:30.857 11918-11918/com.englishdreaming.appily I/chatty: uid=10291(com.englishdreaming.appily) identical 1 line
2020-10-04 15:12:30.875 11918-11918/com.englishdreaming.appily D/Constraints: getView: CALLED
2020-10-04 15:12:30.884 11918-13009/com.englishdreaming.appily I/MediaCodec: (0x7308701a00) init name(OMX.google.mp3.decoder)
2020-10-04 15:12:30.887 11918-13011/com.englishdreaming.appily I/OMXClient: IOmx service obtained
2020-10-04 15:12:30.889 11918-11918/com.englishdreaming.appily D/Constraints: getView: CALLED
2020-10-04 15:12:30.889 11918-13011/com.englishdreaming.appily I/MediaCodec: (0x7308701a00) Component Allocated (OMX.google.mp3.decoder)
2020-10-04 15:12:30.890 11918-13009/com.englishdreaming.appily I/MediaCodec: (0x7308701a00) configure surface(0x0) crypto(0x0) flags(0)
2020-10-04 15:12:30.890 11918-13009/com.englishdreaming.appily D/MediaCodec: (0x7308701a00) configure format: AMessage(what = 0x00000000) = {
          int32_t sample-rate = 44100
          string mime = "audio/mpeg"
          int32_t channel-count = 2
          int32_t priority = 0
          int32_t max-input-size = 4096
        }
2020-10-04 15:12:30.891 11918-13011/com.englishdreaming.appily I/ACodec: codec does not support config priority (err -2147483648)
2020-10-04 15:12:30.892 11918-13009/com.englishdreaming.appily I/MediaCodec: (0x7308701a00) start
2020-10-04 15:12:30.899 11918-13011/com.englishdreaming.appily I/MediaCodec: (0x7308701a00) kWhatStartCompleted
2020-10-04 15:12:30.901 11918-11918/com.englishdreaming.appily D/Constraints: getView: CALLED
2020-10-04 15:12:30.915 11918-13011/com.englishdreaming.appily D/MediaCodec: (0x7308701a00) [OMX.google.mp3.decoder] output format changed to: AMessage(what = 0x00000000) = {
          string mime = "audio/raw"
          int32_t channel-count = 2
          int32_t sample-rate = 44100
          int32_t pcm-encoding = 2
        }
2020-10-04 15:12:30.924 11918-11918/com.englishdreaming.appily D/EventLogger: timelineChanged [0.10, 0.00, window=0, periodCount=1, windowCount=1, reason=PREPARED
2020-10-04 15:12:30.924 11918-11918/com.englishdreaming.appily D/EventLogger:   period [?]
2020-10-04 15:12:30.924 11918-11918/com.englishdreaming.appily D/EventLogger:   window [?, false, false]
2020-10-04 15:12:30.924 11918-11918/com.englishdreaming.appily D/EventLogger: ]
2020-10-04 15:12:30.925 11918-11918/com.englishdreaming.appily D/EventLogger: mediaPeriodCreated [0.10, 0.00, window=0, period=0]
2020-10-04 15:12:30.927 11918-11918/com.englishdreaming.appily D/EventLogger: loading [0.10, 0.00, window=0, period=0, true]
2020-10-04 15:12:30.932 11918-11918/com.englishdreaming.appily D/EventLogger: timelineChanged [0.10, 0.00, window=0, period=0, periodCount=1, windowCount=1, reason=DYNAMIC
2020-10-04 15:12:30.932 11918-11918/com.englishdreaming.appily D/EventLogger:   period [0.76]
2020-10-04 15:12:30.932 11918-11918/com.englishdreaming.appily D/EventLogger:   window [0.76, true, false]
2020-10-04 15:12:30.932 11918-11918/com.englishdreaming.appily D/EventLogger: ]
2020-10-04 15:12:30.933 11918-11918/com.englishdreaming.appily D/EventLogger: decoderEnabled [0.10, 0.00, window=0, period=0, audio]
2020-10-04 15:12:30.934 11918-11918/com.englishdreaming.appily D/EventLogger: tracksChanged [0.11, 0.00, window=0, period=0, []]
2020-10-04 15:12:30.935 11918-11918/com.englishdreaming.appily D/EventLogger: mediaPeriodReadingStarted [0.11, 0.00, window=0, period=0]
2020-10-04 15:12:30.936 11918-11918/com.englishdreaming.appily D/EventLogger: decoderInitialized [0.11, 0.00, window=0, period=0, audio, OMX.google.mp3.decoder]
2020-10-04 15:12:30.937 11918-11918/com.englishdreaming.appily D/EventLogger: decoderInputFormatChanged [0.11, 0.00, window=0, period=0, audio, id=null, mimeType=audio/mpeg, channels=2, sample_rate=44100]
2020-10-04 15:12:30.938 11918-11918/com.englishdreaming.appily D/EventLogger: loading [0.11, 0.00, window=0, period=0, false]
2020-10-04 15:12:30.939 11918-11918/com.englishdreaming.appily D/EventLogger: state [0.11, 0.00, window=0, period=0, true, READY]
2020-10-04 15:12:30.940 11918-11918/com.englishdreaming.appily D/EventLogger: downstreamFormatChanged [0.11, 0.00, window=0, period=0, id=null, mimeType=audio/mpeg, channels=2, sample_rate=44100]
2020-10-04 15:12:30.941 11918-11918/com.englishdreaming.appily D/EventLogger: audioSessionId [0.11, 0.00, window=0, period=0, 5489]
2020-10-04 15:12:31.493 11918-13009/com.englishdreaming.appily D/AudioTrack: stop() called with 32315 frames delivered
2020-10-04 15:12:31.882 11918-11918/com.englishdreaming.appily D/EventLogger: state [1.05, 0.76, window=0, period=0, true, ENDED]
2020-10-04 15:12:31.882 11918-11918/com.englishdreaming.appily I/ExoPlayerImpl: Release 1bfc9f [ExoPlayerLib/2.8.4] [evert_n, moto g(6) plus, motorola, 28] [goog.exo.core]
2020-10-04 15:12:31.884 11918-13009/com.englishdreaming.appily I/MediaCodec: (0x7308701a00) stop
2020-10-04 15:12:31.895 11918-13009/com.englishdreaming.appily I/MediaCodec: (0x7308701a00) release
2020-10-04 15:12:31.906 11918-11918/com.englishdreaming.appily D/EventLogger: decoderDisabled [1.08, 0.76, window=0, period=0, audio]
2020-10-04 15:12:31.908 11918-11918/com.englishdreaming.appily D/EventLogger: mediaPeriodReleased [1.08, 0.76, window=0, period=0]
10-04 15:20:25.050 8358-8358/com.englishdreaming.appily D/SpellingActivity: initExoplayer:    CALLED
10-04 15:20:25.050 8358-8358/com.englishdreaming.appily I/System.out:    mUris.SIZE is..  10   and POSITION is...   0
10-04 15:20:25.070 8358-8358/com.englishdreaming.appily I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
10-04 15:20:25.080 8358-8358/com.englishdreaming.appily I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
10-04 15:20:25.080 8358-8358/com.englishdreaming.appily I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
10-04 15:20:25.090 8358-8358/com.englishdreaming.appily I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
10-04 15:20:25.090 8358-8358/com.englishdreaming.appily I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.exoplayer2.video.MediaCodecVideoRenderer$OnFrameRenderedListenerV23>
10-04 15:20:25.100 8358-8358/com.englishdreaming.appily I/ExoPlayerImpl: Init 3dfb35fd [ExoPlayerLib/2.8.4] [jflte, GT-I9505, samsung, 21]
10-04 15:20:25.120 8358-8358/com.englishdreaming.appily D/EventLogger: state [0.00, 0.00, window=0, true, BUFFERING]
10-04 15:20:25.150 8358-8358/com.englishdreaming.appily D/Constraints: getView: CALLED
10-04 15:20:25.200 8358-8358/com.englishdreaming.appily D/Constraints: getView: CALLED
10-04 15:20:25.220 8358-8358/com.englishdreaming.appily D/Constraints: getView: CALLED
10-04 15:20:25.220 8358-8358/com.englishdreaming.appily D/Constraints: getView: CALLED
10-04 15:20:25.230 8358-8358/com.englishdreaming.appily D/Constraints: getView: CALLED
10-04 15:20:25.250 8358-8625/com.englishdreaming.appily W/AudioCapabilities: Unsupported mime audio/mpeg-L1
10-04 15:20:25.250 8358-8625/com.englishdreaming.appily W/AudioCapabilities: Unsupported mime audio/mpeg-L2
10-04 15:20:25.250 8358-8625/com.englishdreaming.appily W/AudioCapabilities: Unsupported mime audio/x-ms-wma
10-04 15:20:25.260 8358-8625/com.englishdreaming.appily W/AudioCapabilities: Unsupported mime audio/x-ima
10-04 15:20:25.260 8358-8625/com.englishdreaming.appily W/AudioCapabilities: Unsupported mime audio/qcelp
10-04 15:20:25.260 8358-8625/com.englishdreaming.appily W/AudioCapabilities: Unsupported mime audio/evrc
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger: timelineChanged [0.15, 0.00, window=0, periodCount=1, windowCount=1, reason=PREPARED
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger:   period [?]
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger:   window [?, false, false]
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger: ]
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger: mediaPeriodCreated [0.15, 0.00, window=0, period=0]
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger: loading [0.15, 0.00, window=0, period=0, true]
10-04 15:20:25.270 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unsupported mime video/wvc1
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger: timelineChanged [0.16, 0.00, window=0, period=0, periodCount=1, windowCount=1, reason=DYNAMIC
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger:   period [0.91]
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger:   window [0.91, true, false]
10-04 15:20:25.270 8358-8358/com.englishdreaming.appily D/EventLogger: ]
10-04 15:20:25.280 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unsupported mime video/x-ms-wmv
10-04 15:20:25.280 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unrecognized profile/level 32768/2 for video/mp4v-es
10-04 15:20:25.280 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unsupported mime video/wvc1
10-04 15:20:25.290 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unsupported mime video/x-ms-wmv
10-04 15:20:25.290 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unsupported mime video/x-ms-wmv7
10-04 15:20:25.290 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unsupported mime video/x-ms-wmv8
10-04 15:20:25.290 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unsupported mime video/mp43
10-04 15:20:25.300 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unsupported mime video/sorenson
10-04 15:20:25.300 8358-8625/com.englishdreaming.appily W/VideoCapabilities: Unsupported mime video/mp4v-esdp
10-04 15:20:25.320 8358-8625/com.englishdreaming.appily I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
10-04 15:20:25.340 8358-8625/com.englishdreaming.appily W/AudioCapabilities: Unsupported mime audio/ac3
10-04 15:20:25.350 8358-8625/com.englishdreaming.appily I/ACodec:  [] Now uninitialized
10-04 15:20:25.350 8358-8636/com.englishdreaming.appily I/OMXClient: Using client-side OMX mux.
10-04 15:20:25.360 8358-8358/com.englishdreaming.appily D/EventLogger: decoderEnabled [0.24, 0.00, window=0, period=0, audio]
10-04 15:20:25.360 8358-8358/com.englishdreaming.appily D/EventLogger: tracksChanged [0.24, 0.00, window=0, period=0, []]
10-04 15:20:25.360 8358-8358/com.englishdreaming.appily D/EventLogger: mediaPeriodReadingStarted [0.24, 0.00, window=0, period=0]
10-04 15:20:25.360 8358-8636/com.englishdreaming.appily I/ACodec: [OMX.SEC.mp3.dec] Now Loaded
10-04 15:20:25.360 8358-8636/com.englishdreaming.appily E/ACodec: onConfigureComponent mime.c_str() = audio/mpeg
10-04 15:20:25.370 8358-8636/com.englishdreaming.appily I/ACodec: [OMX.SEC.mp3.dec] Now Loaded->Idle
10-04 15:20:25.380 8358-8358/com.englishdreaming.appily D/EventLogger: decoderInitialized [0.26, 0.00, window=0, period=0, audio, OMX.SEC.mp3.dec]
10-04 15:20:25.380 8358-8358/com.englishdreaming.appily D/EventLogger: decoderInputFormatChanged [0.26, 0.00, window=0, period=0, audio, id=null, mimeType=audio/mpeg, channels=2, sample_rate=44100]
10-04 15:20:25.380 8358-8358/com.englishdreaming.appily D/EventLogger: loading [0.26, 0.00, window=0, period=0, false]
10-04 15:20:25.380 8358-8636/com.englishdreaming.appily I/ACodec: [OMX.SEC.mp3.dec] Now Idle->Executing
10-04 15:20:25.380 8358-8358/com.englishdreaming.appily D/EventLogger: state [0.26, 0.00, window=0, period=0, true, READY]
10-04 15:20:25.380 8358-8636/com.englishdreaming.appily I/ACodec: [OMX.SEC.mp3.dec] Now Executing
10-04 15:20:25.390 8358-8358/com.englishdreaming.appily D/EventLogger: downstreamFormatChanged [0.27, 0.00, window=0, period=0, id=null, mimeType=audio/mpeg, channels=2, sample_rate=44100]
10-04 15:20:25.420 8358-8625/com.englishdreaming.appily E/AudioTrack: AudioTrack::set : Exit
10-04 15:20:25.420 8358-8358/com.englishdreaming.appily D/EventLogger: audioSessionId [0.31, 0.00, window=0, period=0, 944]
10-04 15:20:25.901 8358-8410/com.englishdreaming.appily V/FA: Inactivity, disconnecting from the service
10-04 15:20:25.911 8358-8358/com.englishdreaming.appily V/FA: onUnbind called for intent. action: com.google.android.gms.measurement.START
10-04 15:20:25.911 8358-8358/com.englishdreaming.appily V/FA: Local AppMeasurementService is shutting down
10-04 15:20:26.481 8358-8358/com.englishdreaming.appily D/EventLogger: state [1.37, 0.92, window=0, period=0, true, ENDED]
10-04 15:20:26.481 8358-8358/com.englishdreaming.appily I/ExoPlayerImpl: Release 3dfb35fd [ExoPlayerLib/2.8.4] [jflte, GT-I9505, samsung, 21] [goog.exo.core]
10-04 15:20:26.491 8358-8636/com.englishdreaming.appily I/ACodec: [OMX.SEC.mp3.dec] Now Executing->Idle
10-04 15:20:26.501 8358-8636/com.englishdreaming.appily I/ACodec: [OMX.SEC.mp3.dec] Now Idle->Loaded
10-04 15:20:26.501 8358-8636/com.englishdreaming.appily I/ACodec: [OMX.SEC.mp3.dec] Now Loaded
10-04 15:20:26.511 8358-8636/com.englishdreaming.appily I/ACodec:  [OMX.SEC.mp3.dec] Now uninitialized
10-04 15:20:26.531 8358-8358/com.englishdreaming.appily D/EventLogger: decoderDisabled [1.41, 0.92, window=0, period=0, audio]
10-04 15:20:26.531 8358-8358/com.englishdreaming.appily D/EventLogger: mediaPeriodReleased [1.41, 0.92, window=0, period=0]