在Android中将OGG VORBIS转换为PCM

时间:2015-08-05 13:12:31

标签: android ogg decoder vorbis

当我尝试使用ogg CSD数据配置Android-client解码器时,我遇到了以下崩溃,这是我从另一个android-server(从android-server到android-client的流媒体ogg音频)获得的。 Android服务器剥离标头并发送两个CSD数据包。第一个数据包大小为30,第二个数据包为3763.

I/SWAudioPlayer(12412): audioData.length 30
I/SWAudioPlayer(12412): audioData.length 3763
I/SWAudioPlayer(12412): Initializing Decoder
I/VideoCapabilities(12412): Unsupported profile 4 for video/mp4v-es
I/SWAudioPlayer(12412): Codec ==== codec name:OMX.google.vorbis.decoder
I/SWAudioPlayer(12412): type supported by codec:audio/vorbis
I/SWAudioPlayer(12412): is encoder:false
I/MediaCodec(12412): name=audio/vorbis isType=true encoder=false
I/MediaCodec(12412): (0xb84b1590) init name(audio/vorbis) isType(1) encoder(0)
I/OMXClient(12412): Using client-side OMX mux.
E/OMXMaster(12412): A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
I/MediaCodec(12412): (0xb84b1590) Component Allocated (OMX.google.vorbis.decoder)
I/SWAudioPlayer(12412): csdbufData 01766f72626973000000000244ac00000000000000fa000000000000b801
I/SWAudioPlayer(12412): ########initializing decoder csdbufData.length 30
I/SWAudioPlayer(12412): ########initializing decoder audioData.length 3763
I/MediaCodec(12412): (0xb84b1590) configure nativeWindow(0x0) crypto(0x0) flags(0)
I/MediaCodec(12412): (0xb84b1590) start
I/MediaCodec(12412): (0xb84b1590) input buffers allocated
I/MediaCodec(12412): (0xb84b1590) numBuffers (4)
I/MediaCodec(12412): (0xb84b1590) output buffers allocated
I/MediaCodec(12412): (0xb84b1590) numBuffers (4)
I/SWAudioPlayer(12412): decoder ready: true
F/SoftVorbis(12412): frameworks/av/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp:276 CHECK_EQ( 0,_vorbis_unpack_books(mVi, &bits)) failed: 0 vs. -133
--------- beginning of crash
F/libc    (12412): Fatal signal 6 (SIGABRT), code -6 in tid 13179 (.vorbis.decoder)
I/SWAudioPlayer(12412): audioData.length 27
I/SWAudioPlayer(12412): decoder output buffer not available
I/SWAudioPlayer(12412): input buffer data queued
I/SWAudioPlayer(12412): audioData.length 156
I/SWAudioPlayer(12412): decoder output buffer not available
I/SWAudioPlayer(12412): input buffer data queued
I/DEBUG   (  411): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  411): Build fingerprint: 'motorola/otus_reteu_ds/otus_ds:5.0.2/LXC22.99-13/11:user/release-keys'
I/DEBUG   (  411): Revision: 'p300'
I/DEBUG   (  411): ABI: 'arm'
I/DEBUG   (  411): pid: 12412, tid: 13179, name: .vorbis.decoder  >>> com.testogg.swclient <<<
I/DEBUG   (  411): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
I/DEBUG   (  411): Abort message: 'frameworks/av/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp:276 CHECK_EQ( 0,_vorbis_unpack_books(mVi, &bits)) failed: 0 vs. -133'
I/DEBUG   (  411):     r0 00000000  r1 0000337b  r2 00000006  r3 00000000
I/DEBUG   (  411):     r4 9a9e2dd8  r5 00000006  r6 00000016  r7 0000010c
I/DEBUG   (  411):     r8 b84cbe28  r9 9a9e2c3c  sl 00000001  fp 9a9e2c78
I/DEBUG   (  411):     ip 0000337b  sp 9a9e27a8  lr b6f2c691  pc b6f52844  cpsr 600f0010
I/DEBUG   (  411): 
I/DEBUG   (  411): backtrace:
I/DEBUG   (  411):     #00 pc 0003c844  /system/lib/libc.so (tgkill+12)
I/DEBUG   (  411):     #01 pc 0001668d  /system/lib/libc.so (pthread_kill+52)
I/DEBUG   (  411):     #02 pc 0001729f  /system/lib/libc.so (raise+10)
I/DEBUG   (  411):     #03 pc 00013ad9  /system/lib/libc.so (__libc_android_abort+36)
I/DEBUG   (  411):     #04 pc 00012264  /system/lib/libc.so (abort+4)
I/DEBUG   (  411):     #05 pc 000026c1  /system/lib/liblog.so (__android_log_assert+88)
I/DEBUG   (  411):     #06 pc 00002d6d  /system/lib/libstagefright_soft_vorbisdec.so (android::SoftVorbis::onQueueFilled(unsigned int)+244)
I/DEBUG   (  411):     #07 pc 00014e5d  /system/lib/libstagefright_omx.so (android::SimpleSoftOMXComponent::onMessageReceived(android::sp<android::AMessage> const&)+220)
I/DEBUG   (  411):     #08 pc 00014fa3  /system/lib/libstagefright_omx.so
I/DEBUG   (  411):     #09 pc 0000b3eb  /system/lib/libstagefright_foundation.so (android::ALooperRoster::deliverMessage(android::sp<android::AMessage> const&)+166)
I/DEBUG   (  411):     #10 pc 0000ad6d  /system/lib/libstagefright_foundation.so (android::ALooper::loop()+220)
I/DEBUG   (  411):     #11 pc 000104fd  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+112)
I/DEBUG   (  411):     #12 pc 000100d3  /system/lib/libutils.so
I/DEBUG   (  411):     #13 pc 00015e7b  /system/lib/libc.so (__pthread_start(void*)+30)
I/DEBUG   (  411):     #14 pc 00013e37  /system/lib/libc.so (__start_thread+6)
I/DEBUG   (  411): 
I/DEBUG   (  411): Tombstone written to: /data/tombstones/tombstone_03
I/Choreographer(12412): Skipped 50 frames!  The application may be doing too much work on its main thread.
W/ActivityManager(  918):   Force finishing activity com.testogg.swclient/.DisplayActivity
W/ContextImpl( 1579): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1455 android.content.ContextWrapper.sendBroadcast:376 com.motorola.motocare.util.TriggerHelper$TriggerBuilder.send:76 com.motorola.motocare.internal.frameworkevents.PauseResumeTrigger.handleFrameworkEvent:53 com.motorola.motocare.internal.frameworkevents.FwEventMonitor$FrameworkListener.processFrameworkEvent:114 
I/SFPerfTracer(  244):      triggers: (rate: 5:1941) (compose: 0:10) (post: 0:1) (render: 0:40) (1088:64435 frames) (1089:109643)
D/SFPerfTracer(  244):        layers: (2:10) (FocusedStackFrame (0xb87910c0): 0:384)* (DimLayer (0xb87264b8): 0:941)* (DimLayer (0xb8727e20): 0:123)* (StatusBar (0xb87cb7a0): 6:13837)* (com.android.systemui.ImageWallpaper (0xb87d35d8): 0:372)* (NavigationBar (0xb87ce800): 0:1866) 

Docoder初始化代码。

private boolean initializeDecoder(int rate, int channels, byte[] audioData) {
    inputEOS = false;
    MediaCodecInfo mCodecInfo = getCodecInfo(mimeType);
    try {
        decoder = MediaCodec.createDecoderByType(mimeType);
        if(mCodecInfo != null) {
            MediaFormat format = MediaFormat.createAudioFormat(mimeType, rate, channels);

            csdbuf0 = ByteBuffer.wrap(csdbufData);
            csdbuf1 = ByteBuffer.wrap(audioData);
            format.setByteBuffer("csd-0", csdbuf0);
            format.setByteBuffer("csd-1", csdbuf1);

            decoder.configure(format, null, null, 0);
            decoder.start();

            codecInputBuffers = decoder.getInputBuffers();
            codecOutputBuffers = decoder.getOutputBuffers();

            return true;
        }
    } catch(IOException e){
        Log.e(TAG,"Exception in Decoder Creation "+e);
    }
    return false;
}

我想将ogg转换为pcm。 如何解决这个问题?

0 个答案:

没有答案