我正在尝试通过插入外部摄像头在我的 S5 上录制视频。当我开始录制时,它会启动,但是当我停止录制时,它会崩溃。
我无法理解为什么 Audio Flinger 会死掉。我为记录、写入外部存储、音频等设置了必要的权限,
相同的代码在我的 Moto G 上使用相同的相机也能正常工作。
我附上我的崩溃日志以供参考。我也插入了我的评论...
高度赞赏调试此问题的任何帮助。
我的设备监视器线程:
09-05 17:40:18.089: E/USBMonitor(14322): Device Found :: UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=5401,mProductId=1091,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@42d00b28]
09-05 17:40:18.089: E/USBMonitor(14322): Device Found :: UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=1133,mProductId=2093,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@42d025f0]
//I am clicking the record button
09-05 17:40:18.364: E/CameraFragment(14216): On btn click
09-05 17:40:18.364: E/CameraFragment(14216): btn disabling
09-05 17:40:18.364: E/CameraFragment(14216): onClick:record
09-05 17:40:18.369: E/CameraFragment(14216): Recording start inside
09-05 17:40:18.374: E/MediaMuxerWrapper(14216): Capture File Name :: 20150905_174018378
09-05 17:40:18.379: D/skia(14216): GFXPNG PNG bitmap created width:72 height:72 bitmap id is 290
09-05 17:40:18.379: E/CameraClient(14216): handleStartRecording:
09-05 17:40:18.379: E/CameraFragment(14216): btn enablng
09-05 17:40:18.384: E/UVCService(14322): mBasicBinder#startRecording: path = /storage/emulated/0/DCIM/VID_20150905_174018378.mp4
09-05 17:40:18.384: D/CameraThread(14322): handleStartRecording
09-05 17:40:18.394: I/MediaSurfaceEncoder(14322): MediaVideoEncoder:
09-05 17:40:18.399: E/CameraServer(14322): Muxer Prepare width = 800 Height = 600
09-05 17:40:18.399: E/MediaSurfaceEncoder(14322): prepare: resWidth = 800resHeight = 600
09-05 17:40:18.399: V/MediaSurfaceEncoder(14322): selectVideoCodec:
09-05 17:40:18.404: I/MediaSurfaceEncoder(14322): codec:OMX.Exynos.AVC.Encoder,MIME=video/avc
09-05 17:40:18.404: I/MediaSurfaceEncoder(14322): selectColorFormat:
09-05 17:40:18.404: I/OMXClient(14322): Using client-side OMX mux.
09-05 17:40:18.499: I/MediaSurfaceEncoder(14322): isRecognizedViewoFormat:colorFormat=19
09-05 17:40:18.499: I/MediaSurfaceEncoder(14322): isRecognizedViewoFormat:colorFormat=21
09-05 17:40:18.499: I/MediaSurfaceEncoder(14322): isRecognizedViewoFormat:colorFormat=2130706449
09-05 17:40:18.499: I/MediaSurfaceEncoder(14322): isRecognizedViewoFormat:colorFormat=16
09-05 17:40:18.499: I/MediaSurfaceEncoder(14322): isRecognizedViewoFormat:colorFormat=2130706451
09-05 17:40:18.499: I/MediaSurfaceEncoder(14322): isRecognizedViewoFormat:colorFormat=2130708361
09-05 17:40:18.499: I/MediaSurfaceEncoder(14322): selected codec: OMX.Exynos.AVC.Encoder
09-05 17:40:18.499: E/MediaSurfaceEncoder(14322): bitrate= 1.72[Mbps]
09-05 17:40:18.499: I/MediaSurfaceEncoder(14322): format: {frame-rate=30, bitrate=1800000, height=600, mime=video/avc, color-format=2130708361, i-frame-interval=10, width=800}
09-05 17:40:18.504: I/ACodec(14322): [] Now uninitialized
09-05 17:40:18.509: I/OMXClient(14322): Using client-side OMX mux.
09-05 17:40:18.549: I/ACodec(14322): [OMX.Exynos.AVC.Encoder] Now Loaded
09-05 17:40:18.559: I/ACodec(14322): setupVideoEncoder succeeded
09-05 17:40:18.564: I/ACodec(14322): [OMX.Exynos.AVC.Encoder] Now Loaded->Idle
09-05 17:40:18.599: I/MediaSurfaceEncoder(14322): prepare finishing
09-05 17:40:18.599: D/CameraServer(14322): onPrepared:encoder=com.labexercise.encoder.MediaSurfaceEncoder@42d07658
09-05 17:40:18.604: V/EGLBase(14322): EGLBase:
09-05 17:40:18.604: V/MediaAudioEncoder(14322): prepare:
09-05 17:40:18.604: V/EGLBase(14322): init:
09-05 17:40:18.604: V/MediaAudioEncoder(14322): selectAudioCodec:
09-05 17:40:18.614: I/MediaAudioEncoder(14322): supportedType:OMX.SEC.aac.enc,MIME=audio/mp4a-latm
09-05 17:40:18.614: I/MediaAudioEncoder(14322): selected codec: OMX.SEC.aac.enc
09-05 17:40:18.614: I/MediaAudioEncoder(14322): format: {bitrate=64000, channel-count=1, aac-profile=2, mime=audio/mp4a-latm, sample-rate=44100, channel-mask=16}
09-05 17:40:18.614: I/ACodec(14322): [] Now uninitialized
09-05 17:40:18.624: I/OMXClient(14322): Using client-side OMX mux.
09-05 17:40:18.629: D/EGLBase(14322): EGLContext created, client version 2
09-05 17:40:18.629: V/EGLBase(14322): makeDefault:
09-05 17:40:18.629: V/EGLBase(14322): createFromSurface:
09-05 17:40:18.629: V/EGLBase(14322): EglSurface:
09-05 17:40:18.629: V/EGLBase(14322): createWindowSurface:
09-05 17:40:18.634: I/ACodec(14322): [OMX.Exynos.AVC.Encoder] Now Idle->Executing
09-05 17:40:18.634: I/ACodec(14322): [OMX.Exynos.AVC.Encoder] Now Executing
09-05 17:40:18.644: I/EXYNOS_COMP_REGS(14322): Loading the library: libOMX.Exynos.AVC.Decoder.so
09-05 17:40:18.659: V/GLDrawer2D(14322): loadShader:
09-05 17:40:18.664: I/EXYNOS_COMP_REGS(14322): Loading the library: libOMX.Exynos.AVC.Encoder.so
09-05 17:40:18.689: I/EXYNOS_COMP_REGS(14322): Loading the library: libOMX.Exynos.MPEG4.Decoder.so
09-05 17:40:18.704: I/EXYNOS_COMP_REGS(14322): Loading the library: libOMX.Exynos.MPEG4.Encoder.so
09-05 17:40:18.709: I/EXYNOS_COMP_REGS(14322): Loading the library: libOMX.Exynos.VP8.Decoder.so
09-05 17:40:18.719: I/EXYNOS_COMP_REGS(14322): Loading the library: libOMX.Exynos.VP8.Encoder.so
09-05 17:40:18.834: W/linker(14322): libsxqk.so has text relocations. This is wasting memory and is a security risk. Please fix.
09-05 17:40:18.839: W/linker(14322): libarac.so has text relocations. This is wasting memory and is a security risk. Please fix.
09-05 17:40:18.859: I/ACodec(14322): [OMX.google.aac.encoder] Now Loaded
09-05 17:40:18.864: I/ACodec(14322): [OMX.google.aac.encoder] Now Loaded->Idle
09-05 17:40:18.864: I/MediaAudioEncoder(14322): prepare finishing
09-05 17:40:18.864: I/ACodec(14322): [OMX.google.aac.encoder] Now Idle->Executing
09-05 17:40:18.864: D/CameraServer(14322): onPrepared:encoder=com.labexercise.encoder.MediaAudioEncoder@42d08160
09-05 17:40:18.864: V/MediaEncoder(14322): startRecording
09-05 17:40:18.864: V/MediaEncoder(14322): startRecording
09-05 17:40:18.864: I/ACodec(14322): [OMX.google.aac.encoder] Now Executing
09-05 17:40:18.894: V/MediaEncoder(14322): INFO_OUTPUT_FORMAT_CHANGED
09-05 17:40:18.899: I/MediaMuxerWrapper(14322): addTrack:trackNum=2,trackIx=0,format={csd-1=java.nio.ByteArrayBuffer[position=0,limit=8,capacity=8], height=600, mime=video/avc,
csd-0=java.nio.ByteArrayBuffer[position=0,limit=14,capacity=14], what=1869968451, width=800}
09-05 17:40:18.899: V/MediaMuxerWrapper(14322): start:
09-05 17:40:18.904: V/MediaAudioEncoder(14322): AudioThread:start audio recording
//my usb monitor thread
09-05 17:40:22.094: E/USBMonitor(14322): Device Found :: UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=5401,mProductId=1091,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@42d28f20]
09-05 17:40:22.094: E/USBMonitor(14322): Device Found :: UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=1133,mProductId=2093,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@42d2a9e8]
//I am clicking the stop recording button
09-05 17:40:23.194: E/CameraFragment(14216): On btn click
09-05 17:40:23.194: E/CameraFragment(14216): btn disabling
09-05 17:40:23.194: E/CameraFragment(14216): onClick:record
09-05 17:40:23.194: E/CameraFragment(14216): isRecording inside
09-05 17:40:23.194: V/CameraClient(14216): handleStopRecording:
09-05 17:40:23.194: E/MediaMuxerWrapper(14216): Capture File Name :: 20150905_174023196
09-05 17:40:23.194: E/UVCService(14322): mBasicBinder#stopRecording:
09-05 17:40:23.194: D/CameraThread(14322): handleStopRecording:mMuxer=com.labexercise.encoder.MediaMuxerWrapper@42d06a18
09-05 17:40:23.194: V/MediaEncoder(14322): stopRecording
09-05 17:40:23.194: V/MediaEncoder(14322): stopRecording
09-05 17:40:23.194: D/MediaEncoder(14322): handleStopRecording
09-05 17:40:23.199: E/CameraFragment(14216): btn enablng
09-05 17:40:23.199: V/MediaEncoder(14322): INFO_OUTPUT_FORMAT_CHANGED
09-05 17:40:23.199: I/MediaMuxerWrapper(14322):
addTrack:trackNum=2,trackIx=1,format={channel-count=1, mime=audio/mp4a-latm, csd-0=java.nio.ByteArrayBuffer[position=0,limit=2,capacity=2], sample-rate=44100, what=1869968451}
09-05 17:40:23.199: V/MediaMuxerWrapper(14322): start:
09-05 17:40:23.199: V/MediaMuxerWrapper(14322): MediaMuxer started:
09-05 17:40:23.199: D/MediaEncoder(14322): drain:BUFFER_FLAG_CODEC_CONFIG
09-05 17:40:23.199: D/MediaEncoder(14322): drain:BUFFER_FLAG_CODEC_CONFIG
09-05 17:40:23.204: I/MPEG4Writer(14322): setStartTimestampUs: 2783580490
09-05 17:40:23.204: I/MPEG4Writer(14322): Earliest track starting time: 2783580490
09-05 17:40:23.264: D/MediaEncoder(14322): sending EOS to encoder
09-05 17:40:23.269: E/USBMonitor(14216): Device Found :: UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=5401,mProductId=1091,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@434ac2d8]
09-05 17:40:23.269: E/USBMonitor(14216): Device Found :: UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=1133,mProductId=2093,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@434adda0]
09-05 17:40:23.274: D/MediaEncoder(14322): handleStopRecording
09-05 17:40:23.334: D/MediaEncoder(14322): release:
09-05 17:40:23.334: V/CameraThread(14322): onStopped:encoder=com.labexercise.encoder.MediaAudioEncoder@42d08160
09-05 17:40:23.334: I/ACodec(14322): [OMX.google.aac.encoder] Now Executing->Idle
09-05 17:40:23.339: I/ACodec(14322): [OMX.google.aac.encoder] Now Idle->Loaded
09-05 17:40:23.339: I/ACodec(14322): [OMX.google.aac.encoder] Now Loaded
09-05 17:40:23.344: D/MediaEncoder(14322): sending EOS to encoder
09-05 17:40:23.349: I/ACodec(14322): [OMX.google.aac.encoder] Now uninitialized
09-05 17:40:23.364: V/MediaMuxerWrapper(14322): stop:mStatredCount=2
09-05 17:40:23.364: D/MediaEncoder(14322): Encoder thread exiting
09-05 17:40:23.414: I/MediaSurfaceEncoder(14322): release:
09-05 17:40:23.414: D/MediaEncoder(14322): release:
09-05 17:40:23.414: V/CameraThread(14322):
onStopped:encoder=com.labexercise.encoder.MediaSurfaceEncoder@42d07658
//call to update media
09-05 17:40:24.419: D/CameraThread(14322): handleUpdateMedia:path=/storage/emulated/0/DCIM/VID_20150905_174018378.mp4
09-05 17:40:24.419: I/CameraServer(14322): MediaScannerConnection#scanFile
09-05 17:40:24.434: D/MediaScannerConnection(14322): Scanning file 7klwibgf7fvntblfd7(7DCRV7MRD_)(*.(:(._*/,(*8+/85vh,
09-05 17:40:27.319: E/USBMonitor(14216): Device Found :: UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=5401,mProductId=1091,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@434b51e8]
09-05 17:40:27.319: E/USBMonitor(14216): Device Found :: UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=1133,mProductId=2093,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@434b6cb0]
09-05 17:40:28.029: W/AudioSystem(14216): AudioFlinger server died!
09-05 17:40:28.029: W/IAudioRecord(14322): start() error: Broken pipe
09-05 17:40:28.034: W/AudioSystem(14322): AudioPolicyService server died!
09-05 17:40:28.034: W/AudioRecord(14322): dead IAudioRecord, creating a new one from start()
09-05 17:40:28.034: W/EGLBase(14322): swap:err=12291
09-05 17:40:28.034: I/ACodec(14322): [OMX.Exynos.AVC.Encoder] Now Executing->Idle
09-05 17:40:28.034: W/IMediaDeathNotifier(14322): media server died
09-05 17:40:28.034: E/ACodec(14322): OMX/mediaserver died, signalling error!
09-05 17:40:28.034: I/ServiceManager(14322): Waiting for service media.audio_policy...
09-05 17:40:28.034: E/MediaCodec(14322): Codec reported an error. (omx error 0x8000100d, internalError -32)
09-05 17:40:28.039: W/EGLBase(14322): swap:err=12291
09-05 17:40:28.039: V/MediaMuxerWrapper(14322): stop:mStatredCount=1
09-05 17:40:28.039: E/EGLBase(14322): EglSurface:release:
09-05 17:40:28.039: V/EGLBase(14322): makeDefault:
09-05 17:40:28.039: D/MPEG4Writer(14322): Stopping Video track
09-05 17:40:28.039: V/EGLBase(14322): destroySurface:
09-05 17:40:28.039: E/MPEG4Writer(14322): The number of recorded samples is 0
09-05 17:40:28.039: I/MPEG4Writer(14322): Received total/0-length (3/0) buffers and encoded 3 frames. - video
09-05 17:40:28.039: D/MPEG4Writer(14322): Stopping Video track source
09-05 17:40:28.039: D/MPEG4Writer(14322): Video track stopped
09-05 17:40:28.039: D/MPEG4Writer(14322): Stopping Audio track
09-05 17:40:28.039: W/MPEG4Writer(14322): 0-duration samples found: 1
09-05 17:40:28.044: W/MPEG4Writer(14322): 0-duration samples found: 1
09-05 17:40:28.044: I/MPEG4Writer(14322): Received total/0-length (0/0) buffers and encoded 0 frames. - audio
09-05 17:40:28.044: I/MPEG4Writer(14322): Audio track drift time: 0 us
09-05 17:40:28.044: D/MPEG4Writer(14322): Stopping Audio track source
09-05 17:40:28.044: D/MPEG4Writer(14322): Audio track stopped
09-05 17:40:28.044: D/MPEG4Writer(14322): Duration from tracks range is [0, 2426] us
09-05 17:40:28.044: D/MPEG4Writer(14322): Stopping writer thread
09-05 17:40:28.044: D/MPEG4Writer(14322): 0 chunks are written in the last batch
09-05 17:40:28.044: D/MPEG4Writer(14322): Writer thread stopped
09-05 17:40:28.044: W/libEGL(14322): EGLNativeWindowType 0x7a5eaac8 disconnect failed
09-05 17:40:28.044: V/EGLBase(14322): destroySurface:finished
09-05 17:40:28.044: V/EGLBase(14322): release:
09-05 17:40:28.044: V/EGLBase(14322): destroyContext:
09-05 17:40:28.054: E/MediaEncoder(14322): failed stopping muxer
09-05 17:40:28.054: E/MediaEncoder(14322): java.lang.IllegalStateException: Failed to stop the muxer
09-05 17:40:28.054: E/MediaEncoder(14322): at android.media.MediaMuxer.nativeStop(Native Method)
09-05 17:40:28.054: E/MediaEncoder(14322): at android.media.MediaMuxer.stop(MediaMuxer.java:226)
09-05 17:40:28.054: E/MediaEncoder(14322): at com.labexercise.encoder.MediaMuxerWrapper.stop(MediaMuxerWrapper.java:151)
09-05 17:40:28.054: E/MediaEncoder(14322): at com.labexercise.encoder.MediaEncoder.release(MediaEncoder.java:227)
09-05 17:40:28.054: E/MediaEncoder(14322): at com.labexercise.encoder.MediaSurfaceEncoder.release(MediaSurfaceEncoder.java:106)
09-05 17:40:28.054: E/MediaEncoder(14322): at com.labexercise.encoder.MediaEncoder.handleStopRecording(MediaEncoder.java:200)
09-05 17:40:28.054: E/MediaEncoder(14322): at com.labexercise.encoder.MediaEncoder.access$0(MediaEncoder.java:191)
09-05 17:40:28.054: E/MediaEncoder(14322): at com.labexercise.encoder.MediaEncoder$EncoderHandler.handleMessage(MediaEncoder.java:420)
09-05 17:40:28.054: E/MediaEncoder(14322): at android.os.Handler.dispatchMessage(Handler.java:102)
09-05 17:40:28.054: E/MediaEncoder(14322): at android.os.Looper.loop(Looper.java:136)
09-05 17:40:28.054: E/MediaEncoder(14322): at com.labexercise.encoder.MediaEncoder.run(MediaEncoder.java:140)
09-05 17:40:28.054: E/MediaEncoder(14322): at java.lang.Thread.run(Thread.java:841)
09-05 17:40:28.054: D/MediaEncoder(14322): Encoder thread exiting
09-05 17:40:28.129: E/USBMonitor(14322): Device Found :: UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=5401,mProductId=1091,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@42d55208]
09-05 17:40:28.129: E/USBMonitor(14322): Device Found :: UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=1133,mProductId=2093,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@42d56cd0]
09-05 17:40:29.039: I/ServiceManager(14322): Waiting for service media.audio_policy...
09-05 17:40:29.344: E/USBMonitor(14216): Device Found :: UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=5401,mProductId=1091,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@434b9948]
09-05 17:40:29.344: E/USBMonitor(14216): Device Found :: UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=1133,mProductId=2093,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@434bb410]
09-05 17:40:30.039: W/AudioSystem(14322): AudioFlinger server died!
09-05 17:40:30.054: A/libc(14322): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 14676 (Thread-1211)
09-05 17:40:30.814: D/AbsListView(14216): unregisterIRListener() is called
09-05 17:40:31.369: E/USBMonitor(14216): Device Found :: UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=5401,mProductId=1091,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@434be110]
09-05 17:40:31.369: E/USBMonitor(14216): Device Found :: UsbDevice[mName=/dev/bus/usb/002/002,mVendorId=1133,mProductId=2093,mClass=239,mSubclass=2,mProtocol=1,mInterfaces=[Landroid.os.Parcelable;@434bfbd8]