在android6.0上通过MediaRecorder的setOutputFile(sender.getFileDescriptor())获取视频流,结果启动录像失败,在android5.1上是可以的
错误日志:11-01 16:21:59.653: I/MediaRecorderJNI(8899): prepare: surface=0xee8cc100
11-01 16:21:59.773: E/MediaRecorder(8899): start failed: -2147483648
11-01 16:21:59.773: D/AndroidRuntime(8899): Shutting down VM
11-01 16:21:59.773: E/AndroidRuntime(8899): FATAL EXCEPTION: main
11-01 16:21:59.773: E/AndroidRuntime(8899): Process: com.example.bgrecordvideo, PID: 8899
11-01 16:21:59.773: E/AndroidRuntime(8899): java.lang.RuntimeException: Unable to start service com.example.bgrecordvideo.VideoRecorderService@4a36cc3 with Intent { flg=0x10000000 cmp=com.example.bgrecordvideo/.VideoRecorderService VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} }: java.lang.RuntimeException: start failed.
11-01 16:21:59.773: E/AndroidRuntime(8899):  at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4079)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at android.app.ActivityThread.access$2400(ActivityThread.java:221)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1897)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at android.os.Handler.dispatchMessage(Handler.java:102)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at android.os.Looper.loop(Looper.java:158)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at android.app.ActivityThread.main(ActivityThread.java:7233)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at java.lang.reflect.Method.invoke(Native Method)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
11-01 16:21:59.773: E/AndroidRuntime(8899): Caused by: java.lang.RuntimeException: start failed.
11-01 16:21:59.773: E/AndroidRuntime(8899):  at android.media.MediaRecorder._start(Native Method)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at android.media.MediaRecorder.start(MediaRecorder.java:946)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at com.example.bgrecordvideo.VideoRecorderService.initializeVideo(VideoRecorderService.java:464)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at com.example.bgrecordvideo.VideoRecorderService.onStartCommand(VideoRecorderService.java:370)
11-01 16:21:59.773: E/AndroidRuntime(8899):  at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4062)
11-01 16:21:59.773: E/AndroidRuntime(8899):  ... 8 more
11-01 16:26:59.833: I/Process(8899): Sending signal. PID: 8899 SIG: 9