Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android VideoView error (1,16) and shows black screen

I have an application with a VideoView that is playing an mp4 file from the internal storage (my packages files directory)

On some Samsung Epic Touch 4g (Galaxy SII) devices instead of the video being shown the screen is entirely black. Everything else in my application behaves and responds normally so the device is not "freezing" at all it is just showing only black on the screen instead of the video.

To start my video I am using an onPreparedListener callback to make the call to start():

mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer arg0) {
        mVideoView.start();
    }
});

and I set the video to be played with this call:

//file is the reference to my video File object. 
//I am positive that it is correct
mVideoView.setVideoPath(file.getAbsolutePath());

I have an onErrorListener set like this:

mVideoView.setOnErrorListener(new OnErrorListener(){
    @Override
    public boolean onError(MediaPlayer arg0, int arg1, int arg2) {  
        Log.i(myTag, "MP ERROR: "+ arg1 + " - " + arg2);
        /* I have also tried this here, no luck this way either
        mVideoView.setVideoPath(file.getAbsolutePath());
        return true;
        */
        return false;
    }       
});

Upon closer inspection I realized that my onErrorListener is not receiving a callback at all.

While the blackness is on the screen the Log is getting spammed with these messages over and over again:

V/PlayerDriver(2579): HandleInformationalEvent: PVMFInfoProcessingFailure
V/PlayerDriver(2579): HandleInformationalEvent: type=16 UNHANDLED
E/MFC_DEC_APP(2579): SsbSipMfcDecExe] IOCTL_MFC_DEC_EXE failed(ret : -2001)
E/PVMFOMXVideoDecNode(2579): Ln 1652 OMX_EventError nData1 -2147479541 nData2 0

and (sometimes the next to lines are iterspersed in with the spam of the above 4 lines. But other times these two get spammed by themselves after several iterations of spam of the above 4.)

W/MediaPlayer(30537): info/warning (1, 16)
I/MediaPlayer(30537): Info (1,16)

I do not believe that it is an encoding issue with my video (AVC MP4) because the exact same video works fin on some Epic Touch 4g devices(even some on the same version of the OS). And I've used the exact same video in the past on this device, these issues started happening when the device was upgraded to OS version 2.3.6.

Can anyone shed some light on the OMX/MFC errors that I am seeing? Or has anyone else had an issue with VideoView displaying only a black screen instead of the video? Finally is there some other way that I should be initiating the prepare/playback of my video file that might not result in these errors and the black screen?

EDIT: I found in this file that warning # 16 is:

/*
Notification that a processing failure occurred (not fatal error)
*/
const PVMFStatus PVMFInfoProcessingFailure = 16;

Which is supposed to be a non fatal error. Which I suppose it isn't crashing so it isn't "fatal" but whatever is going on is causing my video not to be shown properly.

EDIT 2: some more logs from the device while the video is starting. These all come before the spam of the ones above:

D/PowerManagerService(2677): acquireWakeLock flags=0xa tag=KEEP_SCREEN_ON_FLAG uid=1000 pid=2677   myUID=1000 myPID=2677 myTID=23672
I/ALSAModule(2579): Initialized ALSA PLAYBACK device hifi
W/AudioFlinger(2579): write blocked for 99 msecs, 318 delayed writes, thread 0x61a00
I/libfimc(2677): bool SecFimc::create(SecFimc::FIMC_DEV, fimc_overlay_mode, unsigned int):: Fimc reserved memory =0x57da0000
E/Surface(6585): Surface::init token -2 identity 3401
E/action=%s(2677): com.android.music.musicservicecommand
D/AudioService(2677): musicservicecommand
E/MediaPlayer-JNI(6585): setDataSource: outside path in JNI is ?x@
I/WindowManager(2677):   CREATE SURFACE Surface(name=SurfaceView, identity=3401, mNativeSurface=0) IN SESSION android.view.SurfaceSession@40825e90: pid=6585 format=4 flags=0x200 / Window{40bbc478 SurfaceView paused=false}
D/MediaPlayerService(2579): getPlayerType. Ln=935
D/MediaPlayerService(2579): createPlayer. type=1
D/MediaPlayerService(2579):  create PVPlayer
V/PlayerDriver(2579): PVSuspensionState struct constructor
V/PVPlayer(2579): PVPlayer constructor
V/PVPlayer(2579): construct PlayerDriver
V/PlayerDriver(2579): constructor
V/PlayerDriver(2579): OpenCore hardware module not found
V/PlayerDriver(2579): start player thread
V/PlayerDriver(2579): startPlayerThread
V/PlayerDriver(2579): InitializeForThread
V/PlayerDriver(2579): OMX_MasterInit
V/PlayerDriver(2579): OsclScheduler::Init
V/PlayerDriver(2579): CreatePlayer
D/(2579): SISO TEST registering PVMFRecognizerPluginFactory
D/(2579): SISO TEST registering PVMFRecognizerPluginFactory success
V/PlayerDriver(2579): AddToScheduler
V/PlayerDriver(2579): PendForExec
V/PlayerDriver(2579): OsclActiveScheduler::Current
V/PlayerDriver(2579): StartScheduler
V/PVPlayer(2579): send PLAYER_SETUP
V/PlayerDriver(2579): Send player code: 2
V/PlayerDriver(2579): CommandCompleted
V/PlayerDriver(2579): Completed command PLAYER_SETUP status=PVMFSuccess
V/PVPlayer(2579): setVideoSurface(0x46b0d0)
V/PVPlayer(2579): setVideoSurface(0x2d8cd0)
V/PVPlayer(2579): prepareAsync
D/ViewRoot(3990): handleAppVisibility:TN_USA_U1_SPR
V/PlayerDriver(2579): Send player code: 3
V/PlayerDriver(2579): handleSetDataSource
V/PlayerDriver(2579): handleSetDataSource- scanning for extension
V/PlayerDriver(2579): CommandCompleted
V/PlayerDriver(2579): Completed command PLAYER_SET_DATA_SOURCE status=PVMFSuccess
V/PVPlayer(2579): run_init s=0, cancelled=0
V/PlayerDriver(2579): Send player code: 6
V/PlayerDriver(2579): release string is 2.3.6 len 5
V/PlayerDriver(2579): HandleInformationalEvent: PVMFInfoDurationAvailable
V/PlayerDriver(2579): .... with duration = 168483 ms
V/PlayerDriver(2579): CommandCompleted
V/PlayerDriver(2579): Completed command PLAYER_INIT status=PVMFSuccess
V/PlayerDriver(2579): dongju PlayerCommand::PLAYER_INIT enter
V/PlayerDriver(2579): File EXT is : .mp4
E/PlayerDriver(2579): PlayerDriver::it is a not Protected file
V/PlayerDriver(2579): PlayerCommand::PLAYER_INIT exit
V/PVPlayer(2579): run_set_video_surface s=0, cancelled=0
V/PlayerDriver(2579): Send player code: 4
W/PlayerDriver(2579): Using generic video MIO
V/PlayerDriver(2579): CommandCompleted
V/PlayerDriver(2579): Completed command PLAYER_SET_VIDEO_SURFACE status=PVMFSuccess
V/PVPlayer(2579): run_set_audio_output s=0, cancelled=0
V/PlayerDriver(2579): Send player code: 5
V/PlayerDriver(2579): Create realtime output
V/PlayerDriver(2579): CommandCompleted
V/PlayerDriver(2579): Completed command PLAYER_SET_AUDIO_SINK status=PVMFSuccess
V/PVPlayer(2579): run_prepare s=0, cancelled=0
V/PlayerDriver(2579): Send player code: 7
V/PlayerDriver(2579): disable natpkt - 0
I/MFC_DEC_APP(2579): [SsbSipMfcDecOpen] MFC Library Ver 1.00
I/MFC_DEC_APP(2579): [SsbSipMfcDecOpen] handle(61) 
V/PlayerDriver(2579): HandleInformationalEvent: UNKNOWN PVMFStatus
V/PlayerDriver(2579): HandleInformationalEvent: type=44 UNHANDLED
W/MediaPlayer(6585): info/warning (1, 44)
I/MediaPlayer(6585): Info (1,44)
V/PlayerDriver(2579): CommandCompleted
V/PlayerDriver(2579): Completed command PLAYER_PREPARE status=PVMFSuccess
V/PlayerDriver(2579): PLAYER_PREPARE complete mDownloadContextData=0x0, mDataReadyReceived=0
D/MediaPlayer(6585): getMetadata
V/PVPlayer(2579): setLooping(0)
V/PVPlayer(2579): check_for_live_streaming s=0, cancelled=0
V/PlayerDriver(2579): Send player code: 12
V/PVPlayer(2579): setLooping(0)
V/PlayerDriver(2579): Send player code: 12
E/PVPlayer(2579): isDrmfile playing 0
E/PVPlayer(2579): OPLBlocked = 0
E/MediaPlayerService(2579): MediaPlayerService::mIsAnyDrmVideoPlaying : 0
E/MediaPlayerService(2579): MediaPlayerService::mpCheckOPLBlocked : 0
V/PVPlayer(2579): start
E/AudioPolicyManager(2579): getParamFromPolicy
D/AudioPolicyManager(2579): mCurDevice is 2
V/AudioPolicyManager(2579): getDeviceForStrategy() strategy 0, device 2
V/AudioPolicyManager(2579): getNewDevice() selected device 2
I/FmRadioController(2677): Jni player_SetVolume :7 
I/FmRadioController(2677): ---Jni player_SetVolume---
V/PlayerDriver(2579): Send player code: 8
V/PlayerDriver(2579): dongju handleStart
E/PlayerDriver(2579): PlayerDriver::handleTvOut state=[1]
E/PlayerDriver(2579): PlayerDriver::it is not a DRM file.So don't suspend TVOUT
V/PlayerDriver(2579): CommandCompleted
V/PlayerDriver(2579): Completed command PLAYER_START status=PVMFSuccess
like image 773
FoamyGuy Avatar asked Jul 17 '12 22:07

FoamyGuy


1 Answers

I once had a similar problem, and I got over it by reloading the activity when I got an error on my callback. At first it worked, but later on it kept failing, which caused an infinite restart-loop of the activity. Then I just decided to put a picture instead of the video in such cases (it really wasn't THAT important).

It's worth the try I guess...If you don't get any callback to your onErrorListener, just run it 5 seconds after the activity is alive, to test if it solves your problem.

Here's the code that I wrote to reload an activity:

public void reload(String boolExtra) {
    Intent intent = getIntent();
    overridePendingTransition(0, 0);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    finish();

    overridePendingTransition(0, 0);
    startActivity(intent);
}

Another approach I can suggest - play with the codecs. I know it runs well on other devices, but you can never know if the codec for this specific device, that comes with this specific Android version, has a bug. Try changing its dimensions too.

Best of luck :)

like image 107
Udinic Avatar answered Sep 27 '22 20:09

Udinic