/** Verify CMMFBuffer & CMMFDescriptorBuffer positioning
 * Use case: N/A
 * @test Req. under test REQ172.7.25
 */
TVerdict CTestStep_MMF_BASECL_U_0009::DoTestStepL( void )
	 {
	 TVerdict verdict = EPass;

	 CMMFDataBuffer* descriptorBuffer = CMMFDataBuffer::NewL(KMMFTestBufferSize); //create descriptor buffer

	 //check initial frame number is 0
	 if (descriptorBuffer->Position() != 0) verdict = EFail;
 
	 //check setting a framenumber with no data size - This should keep the position to 0
	 //because there is no buffer size as yet!
	 descriptorBuffer->SetPosition(KMMFTestPosition);
	 if (descriptorBuffer->Position() != 0) verdict = EFail;

	 //check set position 
	 descriptorBuffer->Data().SetLength((TInt)KMMFTestBufferLengthSize);
	 descriptorBuffer->SetPosition(KMMFTestPosition);
	 if (descriptorBuffer->Position() != KMMFTestPosition) verdict = EFail;

	 //try positioning beyond the datalength - should set position to the data length ie buffer size
	 descriptorBuffer->SetPosition(KMMFTestBufferLengthSize*2);
	 if (descriptorBuffer->Position() != descriptorBuffer->BufferSize()) verdict = EFail;

	 delete descriptorBuffer;

	 return verdict;
	 }
TVerdict CTestStep_MMF_BASECL_U_0002::DoTestStepL( void )
/** Verify CMMFDescriptorBuffer creation and deletion using a supplied buffer size
 * Use case: N/A
 * @test Req. under test REQ172.7.25
 */
	 {
	 TVerdict verdict = EPass;
	 CMMFDescriptorBuffer* descriptorBuffer;
	 CMMFDataBuffer* dataBuffer;

	 descriptorBuffer = CMMFDescriptorBuffer::NewL(KMMFTestBufferSize); //create descriptor buffer
	 dataBuffer = CMMFDataBuffer::NewL(KMMFTestBufferSize); //create descriptor buffer from databuffer NewL

	 //check buffer really is a CMMFDescriptorBuffer
	 if (descriptorBuffer->Type() != KUidMmfDescriptorBuffer) verdict = EFail;
	 if (dataBuffer->Type() != KUidMmfDescriptorBuffer) verdict = EFail;

	 //check max length is correct
	 if (descriptorBuffer->Data().MaxLength() != (TInt)KMMFTestBufferSize) verdict = EFail;
	 if (dataBuffer->Data().MaxLength() != (TInt)KMMFTestBufferSize) verdict = EFail;

	 //check actual length is 0
	 if (descriptorBuffer->Data().Length() != 0) verdict = EFail; //test using descriptor API
	 if (dataBuffer->Data().Length() != 0) verdict = EFail;
	 if (descriptorBuffer->BufferSize() != 0) verdict = EFail; //test using CMMFBuffer API
	 if (dataBuffer->BufferSize() != 0) verdict = EFail;

	 delete descriptorBuffer;
	 delete dataBuffer;
	 return verdict ;
	 }
// -----------------------------------------------------------------------------
// CG711PayloadFormatRead::FillSinkBuffer
// Fill SinkBuffer.
// -----------------------------------------------------------------------------
//
void CG711PayloadFormatRead::FillSinkBufferL()
{
    DP_G711_READ( "CG711PayloadFormatRead::FillSinkBuffer()" );

    CMMFDataBuffer* curFrameBuffer = NULL;
    if ( EBufferOne == iCurrentBuffer )
    {
        curFrameBuffer = iFrameBufferOne;
    }
    else
    {
        curFrameBuffer = iFrameBufferTwo;
    }

    TDes8& curFrameData( curFrameBuffer->Data() );
    curFrameData.SetLength( KVoIPHeaderLength );

    // Put next frame decoded from RTP payload to the framebuffer
    iBufferToReadExists = GetNextFrame( curFrameData );

    // G.711 Gwc expects 2 bytes for dtx-decision
    if ( iCnFrame )
    {
        DP_G711_READ( "CG711PayloadFormatRead::FillSinkBufferL add dtx-header" );

        curFrameData[0] = KVoIPCNFrame;
        curFrameData[1] = 0;
    }
    else
    {
        DP_G711_READ( "CG711PayloadFormatRead::FillSinkBufferL add voice-header" );

        curFrameData[0] = KVoIPAudioFrame;
        curFrameData[1] = 0;
    }

    curFrameBuffer->SetFrameNumber( iRecvHeader.iTimestamp + ( ( iFrameIndex - 1 )
                                    * TUint( iCInfo.iHwFrameTime * KDefaultSampleRateInkHz ) ) );

    DP_G711_READ2( "CG711PayloadFormatRead::FillSinkBuffer - FRAMENUM: %u",
                   curFrameBuffer->FrameNumber() );

    const TInt dataLen( ( iCInfo.iHwFrameTime * KBitsPerByte )
                        + KVoIPHeaderLength );
    curFrameData.SetLength( dataLen );
    curFrameBuffer->SetStatus( EFull );

    DP_G711_READ2( "CG711PayloadFormatRead: Filled framebuffer with buf. size: %d",
                   curFrameBuffer->BufferSize() );

    iStateMachine->ChangeState( EEmptyDataToSink );

    DP_G711_READ( "CG711PayloadFormatRead::FillSinkBuffer - DONE" );
}
/** Verify CMMFDataBuffer buffer length setting
 * Use case: N/A
 * @test Req. under test REQ172.7.25
 */
TVerdict CTestStep_MMF_BASECL_U_0005::DoTestStepL( void )
	 {
	 TVerdict verdict = EPass;

	 CMMFDataBuffer* descriptorBuffer = CMMFDataBuffer::NewL(KMMFTestBufferSize); //create descriptor buffer

	 descriptorBuffer->Data().SetLength(KMMFTestBufferLengthSize);
	 if (descriptorBuffer->BufferSize() != KMMFTestBufferLengthSize) verdict = EFail;

	 delete descriptorBuffer;
	 return verdict;
	 }