Update contrib.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __RTPSTREAMER_H__
17 #define __RTPSTREAMER_H__
20 #include <es_sock.h> //RSocketServer, RSocket
23 const TUint KRTPHeaderSize = 12;
24 const TUint KSendBucketSize = 4;//sets number of internally buffered audio frames
26 class CMMFCodec; //fwd ref
27 class CAudioBufferArray;
28 class TSBCFrameParameters;
29 class CA2dpCodecUtilities;
32 Callback class implemented by CA2dpBTHeadsetAudioInterface to get error events
33 back from CActiveRTPStreamer
35 class MRTPStreamerObserver
39 Callback when the CRtpSendPackets detects an error condition
43 @param aError standard SymbianOS error
45 void virtual RTPStreamerEvent(TInt aError) = 0;
50 RTP Streamer used by the CA2dpBTHeadsetAudioInterface.
51 This class is used by the CA2dpBTHeadsetAudioInterface in order to stream
52 buffers of audio to the headset. The CActiveRTPStreamer can buffer a number
53 of buffers internally set by the KSendBucketSize.
57 NONSHARABLE_CLASS(CActiveRTPStreamer) : public CTimer
60 static CActiveRTPStreamer* NewL(RSocket& aSock, MRTPStreamerObserver& aRTPStreamerObserver);
61 ~CActiveRTPStreamer();
64 static void RTPCallback(CActiveRTPStreamer* aStreamer, const TRtpEvent& aEvent);
65 static void RTPSendSourceCallback(CActiveRTPStreamer* aStreamer, const TRtpEvent& aEvent);
67 void SetCodec(CMMFCodec& aCodec);
68 void SetAudioConfiguration(const CA2dpAudioCodecConfiguration& aAudioCodecConfiguration);
69 void Send(const TDesC8& aData, TRequestStatus& aStatus);
72 void CancelLastSendBuffer();
73 void FlushPendingSendBuffers();
74 TUint BytesSent() const;
75 void ResetBytesSent();
77 CActiveRTPStreamer(MRTPStreamerObserver& aRTPStreamerObserver);
78 void ConstructL(RSocket& aSock);
79 void InitializeForSendL(const TDesC8& aData);
80 TUint CodecProcessPayloadL(const TDesC8& aData, TDes8& aPayload);
81 void PacketSent(TRtpEventType aEvent);
82 void RTPSessionEvent(const TRtpEvent& aEvent);
83 void CompleteSendRequestStatus(TInt aError);
89 MRTPStreamerObserver& iRTPStreamerObserver;
90 CAudioBufferArray* iAudioBufferArray; //this class is owned
91 TTimeIntervalMicroSeconds32 iRTPPacketDuration;
92 RRtpSession iRTPSession;
93 RRtpSendSource iRTPSendSource;
94 TRtpEventType iRTPEventType;
96 TRequestStatus* iSendStatus;
100 TUint iNumberOfInputBytesToMakeRTPPacket;
102 TUint iTimeStampIncrement;
104 TBuf8<4> iMediaPayloadHeader;
107 TBool iBufferParamsInitialized;
109 TInt iUnrecoverableError;
110 TUint iSendBufferSize;
112 //these classes aren't owned
114 CA2dpAudioCodecConfiguration* iA2dpAudioCodecConfiguration;