[android JB audioflinger] fastmixer 2 --FastMixerState & FastMixerStateQueue

  1FastMixerState is a structure,representing a single state of the fast mixer, which limits Fast Mixer containing 8 Fast Tracks at most.

        >>  第一个FastTrack[0], 是预留给normal mix thread的 . 从它的BufferProvider 可以看出: “fastTrack->mBufferProvider = new SourceAudioBufferProvider(new MonoPipeReader(monoPipe));”

        其中:

     a. SourceAudioBufferProvider, inheriting from ExtendedAudioBufferProvider, is assigned to Fast Track as its buffer provider.  There is a memory allocation (mAllocated ) to store the data read from the source

         if (buffer->frameCount > mSize) {
             free(mAllocated);
             mAllocated = malloc(buffer->frameCount << mFrameBitShift);
           mSize = buffer->frameCount;
        }   // in SourceAudioBufferProvider::getNextBuffer

     b. the mSource of SourceAudioBufferProvider is assigned with MonoPipeReader read ( MonoPipe is its member), which has a ring buffer ( mBuffer(malloc(mMaxFrames * Format_frameSize(format))),mFront is written by consumer, mRear is written by producer),

          

    c.   SourceAudioBufferProvider::getNextBufferMonoPipe  calls source (MonoPipeReader), MonoPipeReader will read data from ringbufer of MonoPipe,   MonoPipe will get the data from the normal mixer buffer in normal threadLoop_wirte, mNormalSink->write(mMixBuffer, count);

    d.  Each pipe reader contains a data source pipe, when call its read func. to get the data, it finally gets the data from the pipe.

    e.  The implement of all pops in AuidoFlinger is based on ring buffer.

    f.

     >>  其它7个fastTracks,      

                   ExtendedAudioBufferProvider *eabp = track;   //  track is in normal mixthread
                    VolumeProvider *vp = track;
                    fastTrack->mBufferProvider = eabp;

 

   >>   mFastIndex, this variant used to store the index of AudioTrack in mFastIndex[kMaxFastTracks]

 

  >>  when track is created, mFastIndex will be assigned the index in mFastIndex, and  bits[mFastIndex]of mTrackMask will be set to 1. On the contrary, when delete the track, mFastIndex will be decreased and bits[mFastIndex]of mTrackMask will be set to 0.

  2. FastMixerStateQueue is StateQueue, this queue is maintained in FastMixer , which is defined as:    typedefStateQueue<FastMixerState> FastMixerStateQueue;

 

  3. mOutputSink  is a important member of FastMixerState, FastMixer finally render mixed pcm data to audio hal through this port.

       mOutputSink = new AudioStreamOutSink(output->stream);

 

 

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值