0

我有以下情况无法正常工作:

  1. 启动视频播放器(活动中带有媒体播放器的片段)
  2. 按android主页按钮。(视频暂停)
  3. 从最近的应用程序恢复活动。

预期结果:视频恢复。

实际结果:活动已关闭。

其他场景连接多个视频片段:

  1. 视频播放。
  2. 某事触发事件。
  3. 当前片段已分离,并且带有新媒体播放器实例的片段已附加。

据我了解,问题出在这三行:

04-09 12:56:47.660: E/Surface(3176): surface (identity=155) is invalid, err=-19 (No such device)
04-09 12:56:47.660: E/OMXCodec(3176): [OMX.Nvidia.h264.decode] dequeueBuffer failed w/ error 0xffffffed
04-09 12:56:47.660: E/OMXCodec(3176): [OMX.Nvidia.h264.decode] mState must be EXECUTING or RECONFIGURING while read

所以问题是:

如何处理这个问题?有什么解决办法吗?

大多数logcat日志:

04-09 12:56:47.660: E/Surface(3176): surface (identity=155) is invalid, err=-19 (No such device)
04-09 12:56:47.660: D/CallStack(3176): Surface#00  pc 00013d0c  /system/lib/libsurfaceflinger_client.so
04-09 12:56:47.660: D/CallStack(3176): Surface#01  pc 0001407c  /system/lib/libsurfaceflinger_client.so
04-09 12:56:47.660: D/CallStack(3176): Surface#02  pc 0001460e  /system/lib/libsurfaceflinger_client.so
04-09 12:56:47.660: D/CallStack(3176): Surface#03  pc 0007f628  /system/lib/libstagefright.so
04-09 12:56:47.660: D/CallStack(3176): Surface#04  pc 0007f8f4  /system/lib/libstagefright.so
04-09 12:56:47.660: D/CallStack(3176): Surface#05  pc 00019e52  
04-09 12:56:47.660: D/CallStack(3176): Surface#06  pc 0000f9c8  
04-09 12:56:47.660: D/CallStack(3176): Surface#07  pc 0000dcb0  
04-09 12:56:47.660: D/CallStack(3176): Surface#08  pc 000205d6  
04-09 12:56:47.660: D/CallStack(3176): Surface#09  pc 000206a0  
04-09 12:56:47.660: D/CallStack(3176): Surface#10  pc 00011994  /system/lib/libc.so
04-09 12:56:47.660: D/CallStack(3176): Surface#11  pc 000114e8  /system/lib/libc.so
04-09 12:56:47.660: E/OMXCodec(3176): [OMX.Nvidia.h264.decode] dequeueBuffer failed w/ error 0xffffffed
04-09 12:56:47.660: E/OMXCodec(3176): [OMX.Nvidia.h264.decode] mState must be EXECUTING or RECONFIGURING while read
04-09 12:56:47.660: V/AudioPolicyManager(240): startOutput() output 1, stream 3, session 121 mPhoneState 0
04-09 12:56:47.660: V/AudioPolicyManager(240): startOutput() mLastrefcount 0
04-09 12:56:47.660: V/AudioPolicyManager(240): getDeviceForStrategy() from cache strategy 0, device 2
04-09 12:56:47.660: V/AudioPolicyManager(240): getNewDevice() selected device 2
04-09 12:56:47.660: V/AudioPolicyManager(240): setOutputDevice() output 1 device 2 delayMs 0
04-09 12:56:47.660: V/AudioPolicyManager(240): setOutputDevice() setting same device 2 or null device for output 1
04-09 12:56:47.660: I/AudioPolicyManager(240): Speaker Volume = 0.039811 , device = 2, stream = 3, index = 7
04-09 12:56:47.660: E/AudioPolicyManager(240): speaker volume is normal
04-09 12:56:47.660: I/AudioFlinger(240): start output streamType (0, 3) for 1
04-09 12:56:47.660: D/AudioHardware(240): AudioStreamOutALSA::setParameters() start_output_streamtype=3
04-09 12:56:47.660: E/MediaPlayer(3176): error (1, -2147483648)
04-09 12:56:47.660: V/AudioPolicyManager(240): stopOutput() output 1, stream 3, session 121 mPhoneState 0
04-09 12:56:47.660: V/AudioPolicyManager(240): getNewDevice() selected device 0
04-09 12:56:47.660: V/AudioPolicyManager(240): setOutputDevice() output 1 device 0 delayMs 0
04-09 12:56:47.660: V/AudioPolicyManager(240): setOutputDevice() setting same device 0 or null device for output 1
04-09 12:56:47.660: I/AudioFlinger(240): stop output streamType (0, 3) for 1
04-09 12:56:47.660: D/AudioHardware(240): AudioStreamOutALSA::setParameters() stop_output_streamtype=3
04-09 12:56:47.710: D/WindowManager(303): Setting visibility of AppWindowToken{40aa8e28 token=ActivityRecord{40a3fa08 com.android.launcher/com.android.launcher2.Launcher}}: false
04-09 12:56:47.720: D/MediaPlayer(3176): MEDIA_SEEK_COMPLETE event
04-09 12:56:47.720: E/MediaPlayer(3176): Error (1,-2147483648,80000000)
04-09 12:56:47.720: W/VideoFragment(3176): onError called with error code: 1 / -2147483648
04-09 12:56:47.720: W/EventManager(3176): Ip adress not available =null
04-09 12:56:47.720: I/VideoFragment(3176): onCompletion called
04-09 12:56:47.720: I/VideoFragment(3176): onPause called
04-09 12:56:47.720: I/VideoFragment(3176): onStop called

04-09 12:56:47.720: I/VideoFragment(3176): onDestroyView called
04-09 12:56:47.720: D/MediaPlayer-JNI(3176): setVideoSurface
04-09 12:56:47.720: I/VideoFragment(3176): surfaceDestroyed called
04-09 12:56:47.720: D/MediaPlayer-JNI(3176): setVideoSurface
04-09 12:56:47.730: I/VideoFragment(3176): onDestroy called
04-09 12:56:47.740: W/TimedEventQueue(3176): Event 1550 was not found in the queue, already cancelled?
04-09 12:56:47.740: V/AudioPolicyManager(240): releaseOutput() 1
04-09 12:56:47.750: I/OMXCodec(3176): [OMX.SEC.aac.dec] stopping video source
04-09 12:56:47.750: I/OMXCodec(3176): [OMX.SEC.aac.dec] stopped in state 1
04-09 12:56:47.750: V/OMXNodeInstance(240): calling destroyComponentInstance
04-09 12:56:47.750: V/OMXNodeInstance(240): destroyComponentInstance returned err 0
04-09 12:56:47.750: V/OMXNodeInstance(240): OMXNodeInstance going away.
04-09 12:56:47.750: I/nvos_linux_stub(240): nvos: error = 9 while closing fd = 68
04-09 12:56:47.790: D/dalvikvm(351): GC_FOR_ALLOC freed 616K, 17% free 10746K/12935K, paused 62ms
04-09 12:56:47.880: D/dalvikvm(351): GC_FOR_ALLOC freed 693K, 17% free 10745K/12935K, paused 58ms
04-09 12:56:47.890: I/SurfaceFlinger(237): id=158 Removed RecentsPanel idx=6 Map Size=5
04-09 12:56:47.910: I/SurfaceFlinger(237): id=158 Removed RecentsPanel idx=-2 Map Size=5
04-09 12:56:47.910: D/TabletStatusBar(351): lights out
04-09 12:56:47.950: I/SurfaceFlinger(237): id=159 Removed SurfaceView idx=4 Map Size=4
04-09 12:56:47.950: I/SurfaceFlinger(237): id=157 Removed com.android.launcher/com.android.launcher2.Launcher idx=1 Map Size=3
04-09 12:56:47.960: I/SurfaceFlinger(237): id=157 Removed com.android.launcher/com.android.launcher2.Launcher idx=-2 Map Size=3
04-09 12:56:48.000: I/OMXCodec(3176): [OMX.Nvidia.h264.decode] stopping video source
04-09 12:56:48.000: I/OMXCodec(3176): [OMX.Nvidia.h264.decode] stopped in state 1
04-09 12:56:48.000: V/OMXNodeInstance(240): calling destroyComponentInstance
04-09 12:56:48.000: V/OMXNodeInstance(240): destroyComponentInstance returned err 0
04-09 12:56:48.000: V/OMXNodeInstance(240): OMXNodeInstance going away.
04-09 12:56:48.010: I/SurfaceFlinger(237): id=155 Removed SurfaceView idx=-2 Map Size=3
04-09 12:56:48.020: I/SurfaceFlinger(237): id=159 Removed SurfaceView idx=-2 Map Size=3
04-09 12:56:48.020: I/sfp:jni/libmedia_hc/src/NotificationQueue.cpp:34(3176): Deleting NotificationQueue...
04-09 12:56:48.020: I/sfp:jni/libmedia_hc/src/NotificationQueue.cpp:40(3176): NotificationQueue deleted


04-09 12:56:48.030: W/MediaPlayer(3176): mediaplayer went away with unhandled events
04-09 12:56:48.060: D/WindowManager(303): Desired input method target: Window{40b0e508 com.android.internal.service.wallpaper.ImageWallpaper paused=false}
04-09 12:56:48.060: D/WindowManager(303): Current focus: null
04-09 12:56:48.060: D/WindowManager(303): Last focus: null
04-09 12:56:48.060: D/WindowManager(303): IM target client: android.view.inputmethod.InputMethodManager$1@40ac2368
04-09 12:56:48.060: D/WindowManager(303): IM target client binder: android.view.inputmethod.InputMethodManager$1@40ac2368
04-09 12:56:48.060: D/WindowManager(303): Requesting client binder: android.os.BinderProxy@4171d420
04-09 12:56:48.060: D/WindowManager(303): Desired input method target: Window{40b0e508 com.android.internal.service.wallpaper.ImageWallpaper paused=false}
04-09 12:56:48.060: D/WindowManager(303): Current focus: null
04-09 12:56:48.060: D/WindowManager(303): Last focus: null
04-09 12:56:48.060: D/WindowManager(303): IM target client: android.view.inputmethod.InputMethodManager$1@40ac2368
04-09 12:56:48.060: D/WindowManager(303): IM target client binder: android.view.inputmethod.InputMethodManager$1@40ac2368
04-09 12:56:48.060: D/WindowManager(303): Requesting client binder: android.os.BinderProxy@4171d420
04-09 12:56:48.060: D/InputManagerService(303): startInputLocked: cs=ClientState{4167c8c8 uid 10091 pid 3176}, cs.pid=3176, Binding.getCallingPid()=303
04-09 12:56:48.060: I/WindowManager(303): Placing input method @1
04-09 12:56:48.060: W/InputManagerService(303): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@4171d438 (uid=10091 pid=3176)
04-09 12:56:48.060: I/WindowManager(303): Placing input method @1
04-09 12:56:48.060: W/InputManagerService(303): Client not active, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40904cb0

04-09 12:56:48.140: D/WindowManager(303): IM target client: com.android.internal.view.IInputMethodClient$Stub$Proxy@4171d438
04-09 12:56:48.140: D/WindowManager(303): IM target client binder: android.os.BinderProxy@4171d420
04-09 12:56:48.140: D/WindowManager(303): Requesting client binder: android.os.BinderProxy@4171d420
04-09 12:56:48.140: D/CLIPBOARD(381): Hide Clipboard dialog at Starting input: finished by someone else... !
04-09 12:56:48.140: D/CLIPBOARD(303): Hide Clipboard dialog inside hideSoftInput() !
04-09 12:56:48.140: D/InputManagerService(303): startInputLocked: cs=ClientState{4167c8c8 uid 10091 pid 3176}, cs.pid=3176, Binding.getCallingPid()=303
04-09 12:56:48.140: I/WindowManager(303): Placing input method @6
04-09 12:56:48.280: D/dalvikvm(3176): GC_CONCURRENT freed 2003K, 29% free 21660K/30087K, paused 2ms+9ms
04-09 12:56:50.260: D/HierarchicalStateMachine(303): handleMessage: E msg.what=65619
04-09 12:56:50.260: D/HierarchicalStateMachine(303): processMsg: ConnectedState
04-09 12:56:50.260: D/WifiStateMachine(303): ConnectedState{ what=65619 when=-5ms arg1=3 }
04-09 12:56:50.260: D/HierarchicalStateMachine(303): handleMessage: X
04-09 12:56:50.610: V/AudioHardware(240): AudioStreamOutALSA::standby
04-09 12:56:50.610: D/AudioHardware(240): AudioHardware pcm playback is going to standby.
04-09 12:56:50.610: V/AudioHardware(240): closeMixer_l() mMixerOpenCnt: 1
04-09 12:56:50.610: I/alsa_mixer(240): mixer_close
04-09 12:56:50.610: V/AudioHardware(240): closeMixer_l mMixerOpenCnt = 0 end
04-09 12:56:50.610: I/AudioHardware(240): closePcmOut_l() mPcmOpenCnt: 1
04-09 12:56:50.610: V/alsa_pcm(240): pcm_close
04-09 12:56:50.610: V/alsa_pcm(240): real pcm_close
04-09 12:56:50.610: V/AudioHardware(240): closePcmOut_l end
04-09 12:56:53.140: W/PowerManagerService(303): Timer 0x3->0x3|0x1
04-09 12:56:53.270: D/HierarchicalStateMachine(303): handleMessage: E msg.what=65619
04-09 12:56:53.270: D/HierarchicalStateMachine(303): processMsg: ConnectedState
04-09 12:56:53.270: D/WifiStateMachine(303): ConnectedState{ what=65619 when=-4ms arg1=3 }
04-09 12:56:53.280: D/HierarchicalStateMachine(303): handleMessage: X
04-09 12:56:56.280: D/HierarchicalStateMachine(303): handleMessage: E msg.what=65619
04-09 12:56:56.280: D/HierarchicalStateMachine(303): processMsg: ConnectedState
04-09 12:56:56.280: D/WifiStateMachine(303): ConnectedState{ what=65619 when=-3ms arg1=3 }
04-09 12:56:56.300: D/HierarchicalStateMachine(303): handleMessage: X
04-09 12:56:58.340: D/dalvikvm(500): GC_EXPLICIT freed 5373K, 43% free 8596K/15047K, paused 4ms+6ms
04-09 12:56:59.310: D/HierarchicalStateMachine(303): handleMessage: E msg.what=65619
04-09 12:56:59.310: D/HierarchicalStateMachine(303): processMsg: ConnectedState
04-09 12:56:59.310: D/WifiStateMachine(303): ConnectedState{ what=65619 when=-6ms arg1=3 }
04-09 12:56:59.320: D/HierarchicalStateMachine(303): handleMessage: X
04-09 12:57:00.000: I/ActivityManager(303): No longer want com.google.android.voicesearch (pid 2951): hidden #26
04-09 12:57:00.010: D/KeyguardUpdateMonitor(303): received broadcast android.intent.action.TIME_TICK
04-09 12:57:00.010: D/KeyguardUpdateMonitor(303): handleTimeUpdate
04-09 12:57:00.010: I/StatusBar.Clock(351): onReceive:android.intent.action.TIME_TICK
04-09 12:57:00.020: E/AwesomePlayer(240): calling reset
04-09 12:57:00.020: D/AwesomePlayer(240): reset_l
04-09 12:57:00.020: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.020: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.020: D/AwesomePlayer(240): stop AudioSource since AudioPlayer not exist
04-09 12:57:00.020: D/AwesomePlayer(240): reset done
04-09 12:57:00.020: E/AwesomePlayer(240): calling reset
04-09 12:57:00.020: D/AwesomePlayer(240): reset_l
04-09 12:57:00.020: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.020: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.020: D/AwesomePlayer(240): reset done
04-09 12:57:00.020: E/AwesomePlayer(240): calling ~AwesomePlayer
04-09 12:57:00.020: E/AwesomePlayer(240): calling reset
04-09 12:57:00.020: D/AwesomePlayer(240): reset_l
04-09 12:57:00.020: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.020: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.020: D/AwesomePlayer(240): reset done
04-09 12:57:00.020: E/AwesomePlayer(240): calling reset
04-09 12:57:00.020: D/AwesomePlayer(240): reset_l
04-09 12:57:00.020: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.020: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.020: D/AwesomePlayer(240): stop AudioSource since AudioPlayer not exist
04-09 12:57:00.020: D/AwesomePlayer(240): reset done
04-09 12:57:00.020: E/AwesomePlayer(240): calling reset
04-09 12:57:00.020: D/AwesomePlayer(240): reset_l
04-09 12:57:00.020: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.020: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.020: D/AwesomePlayer(240): reset done
04-09 12:57:00.020: E/AwesomePlayer(240): calling ~AwesomePlayer
04-09 12:57:00.020: E/AwesomePlayer(240): calling reset
04-09 12:57:00.020: D/AwesomePlayer(240): reset_l
04-09 12:57:00.020: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.020: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.020: D/AwesomePlayer(240): reset done
04-09 12:57:00.020: E/AwesomePlayer(240): calling reset
04-09 12:57:00.020: D/AwesomePlayer(240): reset_l
04-09 12:57:00.020: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.020: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.020: D/AwesomePlayer(240): stop AudioSource since AudioPlayer not exist
04-09 12:57:00.020: D/AwesomePlayer(240): reset done
04-09 12:57:00.020: E/AwesomePlayer(240): calling reset
04-09 12:57:00.020: D/AwesomePlayer(240): reset_l
04-09 12:57:00.020: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.020: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.020: D/AwesomePlayer(240): reset done
04-09 12:57:00.020: E/AwesomePlayer(240): calling ~AwesomePlayer
04-09 12:57:00.020: E/TODmobile(577): onReceive action=android.intent.action.TIME_TICK
04-09 12:57:00.020: I/StatusBar.Clock(351): onReceive:android.intent.action.TIME_TICK
04-09 12:57:00.030: E/TODmobile(577): hour : 12    minute : 57
04-09 12:57:00.030: E/DigitalClockWidget(577): updateWidgets
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): stop AudioSource since AudioPlayer not exist
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
04-09 12:57:00.030: E/AwesomePlayer(240): calling ~AwesomePlayer
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): stop AudioSource since AudioPlayer not exist
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
04-09 12:57:00.030: E/AwesomePlayer(240): calling ~AwesomePlayer
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): stop AudioSource since AudioPlayer not exist
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
04-09 12:57:00.030: E/AwesomePlayer(240): calling ~AwesomePlayer
04-09 12:57:00.030: E/AwesomePlayer(240): calling reset
04-09 12:57:00.030: D/AwesomePlayer(240): reset_l
04-09 12:57:00.030: I/AwesomePlayer(240): cancel player events
04-09 12:57:00.030: D/AwesomePlayer(240): cancelPlayerEvents (keepBufferingGoing=0)
04-09 12:57:00.030: D/AwesomePlayer(240): reset done
4

1 回答 1

0

当 Activity 退出时,您应该关闭您的 mediaPlayer。导航回活动后,在创建表面时重置表面。

于 2013-04-09T10:25:42.517 回答