现在录音出现一个问题是应用程序显示能够正常运行,录完后但是其大小显示0字节,我没有插MIC,但是我认为也应该有数据的,我是做底层驱动的,对于android的上层应用程序不清楚,这程序在手机上可以用的。我不清楚是不是因为我没有插MIC而出现的问题。
解决方案 »
- 简单的一个数据登录的例子(数据库已经存在)大家看看代码?
- 高分求助!把VideoView放在Dialog中,为什么会撑破对话框?
- 关于android TCP客户端接收乱码的困扰!
- ActivityGroup中调用子Activity的finish方法退出程序的问题
- 真机测试替换system/lib 下的so文件,重启不了
- 菜鸟android编程设计的问题求助
- Android 用户远程验证
- 在手机屏幕锁屏的情况下调用NFC服务
- 如何继承多个Activity?挺简单的,是不是我想多了
- Http连接超时无效,好多天了,要逼疯了,求人解救啊
- 请大牛进来指导下,关于webview
- 求解答,关于虚拟键盘显示的
++ MediaRecorder.AudioSource.MIC 设置输出文件的格式
MediaRecorder.OutputFormat.DEFFAULT 设置音频文件的编码
snd_pcm_capture_ioctl。我去查看了alsa_lib的源码,发现在open设备时是根据stream的值来判断的,如果是录音,stream应该是1,但是现在从内核信息输出来看,传入的stream是0。不清楚到底是什么情况导致的。请教各位大虾。
录音0字节可能是数据没有上来,这个时候你需要确定一下你的kernel是不是对的。首先你可以使用asla_aplay 来调试看看是否能够录音。 如果你不会用这个bin,那你看看代码,很简单的。 如果你还是不会用,ok,你可以在audiohardwarealsa中readi中讲buffer的数据写到文件里面,看看是否有数据!!! 然后你用audition听听(因为这里可能是pcm信号),如果有数据了,ok,说明你kernel里面的数据应该是对的,but,因为如果你上层是用AMRNB,那么你必须是用8kHZ的采样率。 你先测测看, 如果再有问题,以后继续
这是我调试的信息
Enter __snd_open minor =0x0
Enter __snd_open minor =0x10 //这个设备是对应了播放设备,如果是录音的话,这个minor应该是32
Enter snd_pcm_playback_open //这个应该是snd_pcm_capture_open,所以这下面所调用的函数都错了啊
Enter snd_pcm_open
Enter snd_pcm_open_file
Enter snd_pcm_open_substream stream is 0
Enter snd_pcm_attach_substream stream = 0
Enter snd_pcm_hw_constraints_init
Entered s3c24xx_pcm_open
Enter snd_pcm_hw_constraints_complete
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0x81204101
Enter snd_pcm_info_user device 0 subdevice 0 stream 0 card 0 dev_class 0 dev_subclass 0 subdevices_count 1 subdevices_avail 0
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0x80044100
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0x40044102
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc0844123
Enter snd_pcm_sync_ptr
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc25c4110
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc25c4110
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc25c4110
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc25c4110
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc25c4110
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc25c4110
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc25c4110
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc25c4110
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc25c4111
Entered s3c6400_ac97_hw_params substream->stream 0
Entered s3c24xx_pcm_hw_params, params = (null)
params c03e58e8, client c03e5934, channel 37
IRQ 74/AC97 PCM Stereo out: IRQF_DISABLED is not guaranteed on shared IRQs
Entered s3c24xx_pcm_hw_params, line 282
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc0844123
Enter snd_pcm_sync_ptr
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc0684113
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0x00004140
Entered s3c24xx_pcm_prepare
Entered s3c24xx_audio_buffdone
Entered s3c24xx_audio_buffdone
Entered s3c24xx_audio_buffdone
Entered s3c24xx_audio_buffdone
Entered s3c24xx_pcm_enqueue
dma_loaded: 0
dma_loaded: 1
Entered s3c6400_ac97_write: reg=0x2a, val=0x411
Entered s3c6400_ac97_irq: AC_GLBSTAT = 0x400003
Entered s3c6400_ac97_write: reg=0x2c, val=0xac44
Entered s3c6400_ac97_irq: AC_GLBSTAT = 0x400003
Entered s3c6400_ac97_hifi_prepare substream->stream = 0
Entered s3c6400_ac97_write: reg=0x26, val=0x0
Entered s3c6400_ac97_irq: AC_GLBSTAT = 0x400003
Entered s3c6400_ac97_write: reg=0xc, val=0x808
Entered s3c6400_ac97_irq: AC_GLBSTAT = 0x400003
Entered s3c6400_ac97_write: reg=0x3c, val=0xf803
Entered s3c6400_ac97_irq: AC_GLBSTAT = 0x400003
Entered s3c6400_ac97_write: reg=0x3e, val=0xb990
Entered s3c6400_ac97_irq: AC_GLBSTAT = 0x400003
Entered s3c6400_ac97_write: reg=0x2, val=0x404
Entered s3c6400_ac97_irq: AC_GLBSTAT = 0x400003
Entered s3c6400_ac97_write: reg=0x4, val=0x606
Entered s3c6400_ac97_irq: AC_GLBSTAT = 0x400003
Entered s3c6400_ac97_write: reg=0x1c, val=0x12aa
Entered s3c6400_ac97_irq: AC_GLBSTAT = 0x400003
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc0844123
Enter snd_pcm_sync_ptr
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0xc0684113
Enter snd_pcm_playback_ioctl
Enter snd_pcm_playback_ioctl1
Enter snd_pcm_common_ioctl1 cmd = 0x00004144
函数到这儿就不跑了,这个cmd所调用的函数是snd_pcm_drain,如果能够录音的话,这儿会继续打印数据的,这个录音调试信息和我播放的打印信息是一样。我查看了alsa_lib的源码,发现他open的filename绝对是pcmC0D0p而不是pcmC0D0c,这个filename的区分是根据stream来区分的,stream为0就是pcmC0D0p,1就是pcmC0D0c,现在从内核来看,他传递过来的stream是0,而不是1。这个问题很困惑。