Objective c AudioStreamBasicDescription中是否需要mBytesPerFrame?

Objective c AudioStreamBasicDescription中是否需要mBytesPerFrame?,objective-c,ios,audio,core-audio,audioqueueservices,Objective C,Ios,Audio,Core Audio,Audioqueueservices,在AudioStreamBasicDescriptionstruct中: struct AudioStreamBasicDescription { Float64 mSampleRate; UInt32 mFormatID; UInt32 mFormatFlags; UInt32 mBytesPerPacket; UInt32 mFramesPerPacket; UInt32 mBytesPerFrame; UInt32 mCh

AudioStreamBasicDescription
struct中:

struct AudioStreamBasicDescription {
    Float64 mSampleRate;
    UInt32  mFormatID;
    UInt32  mFormatFlags;
    UInt32  mBytesPerPacket;
    UInt32  mFramesPerPacket;
    UInt32  mBytesPerFrame;
    UInt32  mChannelsPerFrame;
    UInt32  mBitsPerChannel;
    UInt32  mReserved; 
};
如果我们知道nChannelsPerFrame和mBitsPerChannels,我们可以这样计算mBytesPerFrame:
mBytesPerFrame=mbitspperchannels*mchannels perframe/8
(如果我错了,请纠正我)


我相信所有这些领域的存在都是有原因的。mBytesPerFrame的功能是什么?

是的。该字段可用于帮助描述LPCM样本数据/帧的打包和对齐。这对于描述一些外部LPCM表示也是必需的


例如,您可以指定20位的样本大小,但实现可能倾向于使用3个字节或24位(每个样本忽略4位)表示/传输/存储。

类似的问题,如果我们已经有mFramesPerPacket和mBytesPerFrame,为什么我们需要mBytesPerPacket?@jAckOdE欢迎您。由于ASBD可以表示LPCM和基本VBR格式,因此存在重叠和看似冗余的字段
mBytesPerPacket
特别适用于定义基本VBR数据的抽象描述而不产生歧义。