media server died的解决方法

展开阅读全文

安卓录像问题。报错Media server died.

09-28

public class MainActivity extends Activity { MediaRecorder recorder= null; Button startButton = null; Button endtButton = null; SurfaceView face = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startButton=(Button) findViewById(R.id.end); endtButton= (Button) findViewById(R.id.start); face= (SurfaceView) findViewById(R.id.surfaceView); face.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); face.getHolder().setFixedSize(176, 144); face.getHolder().setKeepScreenOn(true); startButton.setOnClickListener(ButtonClickDo); endtButton.setOnClickListener(ButtonClickDo); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void startRecord() throws Throwable, IOException{ File f = new File( Environment.getExternalStorageDirectory() ,System.currentTimeMillis()+".3gp"); recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setVideoSize(320, 240); recorder.setVideoFrameRate(5); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB); recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); recorder.setOutputFile(f.getAbsolutePath()); recorder.setPreviewDisplay(face.getHolder().getSurface()); System.out.println("路径"+ f.getAbsolutePath()); recorder.prepare(); recorder.start(); } public void stopRecord(){ if(recorder!=null){ recorder.stop(); recorder.release(); recorder=null; } } private OnClickListener ButtonClickDo = new OnClickListener() { @Override public void onClick(View v) { Integer id = v.getId(); System.out.println("id为:"+ id +"结果" +(endtButton.getId()==id)); if(endtButton.getId()==id){ try { startRecord(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Throwable e) { // TODO Auto-generated catch block e.printStackTrace(); } } else{ stopRecord(); } } }; } 这段代码可以正常的录像, 发到手机内存里 。但是我把 recorder.setPreviewDisplay(face.getHolder().getSurface()); 这句话给注释掉就报 Media server died. 。拍出来的东西只有23KB 怎么拍都只有23KB 不能播放 说文件损坏, 请问是怎么回事。 我想达到 录像 但不显示录像的画面。 怎么操作 问答

安卓源码编译后 模拟器启动不起来

05-20

安卓源码中在libcore,以及frameworks , external目录下添加了一些log信息 编译后的system.img镜像, 模拟器运行不起来 log不断打印如下信息: D/AndroidRuntime( 855): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<< D/AndroidRuntime( 855): CheckJNI is ON I/SamplingProfilerIntegration( 855): Profiling disabled. I/dalvikvm( 855): threadid=1: stack overflow on call to Ljava/util/GregorianCalendar;.fullFieldsCalc:VJII I/dalvikvm( 855): method requires 100+20+28=148 bytes, fp is 0x4615f380 (128 left) I/dalvikvm( 855): expanding stack end (0x4615f300 to 0x4615f000) I/dalvikvm( 855): Shrank stack (to 0x4615f300, curFrame is 0x4615f670) D/AndroidRuntime( 855): Shutting down VM W/dalvikvm( 855): threadid=1: thread exiting with uncaught exception (group=0x409961f8) I/ServiceManager( 30): service 'media.audio_flinger' died I/ServiceManager( 30): service 'media.player' died I/ServiceManager( 30): service 'media.camera' died I/ServiceManager( 30): service 'media.audio_policy' died I/Netd ( 860): Netd 1.0 starting E/Netd ( 860): Unable to bind netlink socket: No such file or directory E/Netd ( 860): Unable to open quota2 logging socket I/ ( 859): ServiceManager: 0xf958 I/AudioFlinger( 859): Loaded primary audio interface from LEGACY Audio HW HAL (audio) I/AudioFlinger( 859): Using 'LEGACY Audio HW HAL' (audio.primary) as the primary audio interface D/AudioHardwareInterface( 859): setMode(NORMAL) I/CameraService( 859): CameraService started (pid=859) D/EmulatedCamera_QemuClient( 859): Emulated camera list: D/EmulatedCamera_FakeCamera( 859): Initialize: Fake camera is facing back V/EmulatedCamera_Factory( 859): 1 cameras are being emulated. Fake camera ID is 0 I/AudioFlinger( 859): AudioFlinger's thread 0x10f50 ready to run W/AudioFlinger( 859): Thread AudioOut_1 cannot connect to the power manager service I/AudioPolicyService( 859): Loaded audio policy from LEGACY Audio Policy HAL (audio_policy) 问答

ICamera diedMediaMetadataRetriever server died!

10-19

使用视频录像功能报错,请大神们帮忙看一下 10-19 11:44:10.875: V/Camera-JNI(24054): get_native_camera: context=0x744aaeb0, camera=0x40ddbc38 10-19 11:44:10.895: I/MediaRecorderJNI(24054): prepare: surface=0x742b8a18 (identity=156) 10-19 11:44:11.515: W/Camera(24054): ICamera died 10-19 11:44:11.515: W/MediaMetadataRetriever(24054): MediaMetadataRetriever server died! 10-19 11:44:11.515: V/Camera-JNI(24054): notify 10-19 11:44:11.515: W/Camera(24054): Camera server died! 10-19 11:44:11.515: W/IMediaDeathNotifier(24054): media server died 10-19 11:44:11.515: E/Camera(24054): Error 100 10-19 11:44:13.077: V/Camera-JNI(24054): setHasPreviewCallback: installed:0, manualBuffer:0 10-19 11:44:13.077: V/Camera-JNI(24054): get_native_camera: context=0x744aaeb0, camera=0x40ddbc38 10-19 11:44:13.077: V/Camera-JNI(24054): Clearing callback buffers, 0 remained 10-19 11:44:13.077: V/Camera-JNI(24054): stopPreview 10-19 11:44:13.077: V/Camera-JNI(24054): get_native_camera: context=0x744aaeb0, camera=0x40ddbc38 10-19 11:44:13.077: V/Camera-JNI(24054): lock 10-19 11:44:13.077: V/Camera-JNI(24054): get_native_camera: context=0x744aaeb0, camera=0x40ddbc38 10-19 11:44:13.077: V/Camera-JNI(24054): release camera 10-19 11:44:13.077: V/Camera-JNI(24054): release 10-19 11:44:13.077: V/Camera-JNI(24054): Clearing callback buffers, 0 remained 10-19 11:44:13.077: V/Camera-JNI(24054): Clearing callback buffers, 0 remained 10-19 11:44:13.077: V/Camera-JNI(24054): native_release: context=0x744aaeb0 camera=0x40ddbc38 10-19 11:44:13.077: V/Camera-JNI(24054): release 10-19 11:44:13.077: V/Camera-JNI(24054): Clearing callback buffers, 0 remained 10-19 11:44:13.077: V/Camera-JNI(24054): Clearing callback buffers, 0 remained 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览