输出是否生成AudioConverterFillComplexBuffer从AAC转换为PCM?

时间:2015-07-29 04:42:14

标签: ios iphone core-audio codec

您好我正在尝试使用AudioConverterFillComplexBuffer将AAC缓冲区转换为PCM。这是我的代码

<style>
.table { 
    width: 100%; 
    display: table; 
}
.table-cell {
    display: table-cell;
    width: 50%;
    vertical-align: top;
}

</style>
<script src="//maps.googleapis.com/maps/api/js?v=3"></script>
<div class="table">
    <div class="table-cell" id="map"></div>
    <div class="table-cell" style="height: 250px;">
        Cell 2
    </div>
</div>
<script>
// Create map
map = new google.maps.Map(document.getElementById('map'), {
    zoom: 4,
    center: new google.maps.LatLng(-30, 145.5),
    mapTypeId: google.maps.MapTypeId.ROADMAP
});
</script>

解码输出长度为零,AudioConverterFillComplexBuffer的OSStatus代码为561015652

那可能是错的......?

1 个答案:

答案 0 :(得分:1)

这是一个黑暗的镜头,你可能已经找到了解决方案,但我相信你需要改变这个      UInt32 ioOutputDataPacketSize = bufferSize;
到这个

UInt32 ioOutputDataPacketSize = bufferSize/2;

就我个人而言,我在inInputDataProc方法中执行此操作并始终发送

UInt32 ioOutputDataPacketSize = 1;  

进入AudioConverterFillComplexBuffer方法,然后像这样在inInputDataProc中设置它。

UInt32 maxPackets = audioBufferList.mBuffers[0].mDataByteSize / 2;
*ioNumberDataPackets = maxPackets;     

希望这有帮助。