niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef TEST_STEREO_H |
| 12 | #define TEST_STEREO_H |
| 13 | |
| 14 | #include "ACMTest.h" |
| 15 | #include "Channel.h" |
| 16 | #include "PCMFile.h" |
| 17 | |
| 18 | class TestPackStereo : public AudioPacketizationCallback |
| 19 | { |
| 20 | public: |
| 21 | TestPackStereo(); |
| 22 | ~TestPackStereo(); |
| 23 | |
| 24 | void RegisterReceiverACM(AudioCodingModule* acm); |
| 25 | |
| 26 | virtual WebRtc_Word32 SendData(const FrameType frameType, |
| 27 | const WebRtc_UWord8 payloadType, |
| 28 | const WebRtc_UWord32 timeStamp, |
| 29 | const WebRtc_UWord8* payloadData, |
| 30 | const WebRtc_UWord16 payloadSize, |
| 31 | const RTPFragmentationHeader* fragmentation); |
| 32 | |
| 33 | WebRtc_UWord16 GetPayloadSize(); |
| 34 | WebRtc_UWord32 GetTimeStampDiff(); |
| 35 | void ResetPayloadSize(); |
| 36 | void SetCodecType(int codecType); |
| 37 | |
| 38 | |
| 39 | private: |
| 40 | AudioCodingModule* _receiverACM; |
| 41 | WebRtc_Word16 _seqNo; |
| 42 | WebRtc_UWord8 _payloadData[60 * 32 * 2 * 2]; |
| 43 | WebRtc_UWord32 _timeStampDiff; |
| 44 | WebRtc_UWord32 _lastInTimestamp; |
| 45 | WebRtc_UWord64 _totalBytes; |
| 46 | WebRtc_UWord16 _payloadSize; |
| 47 | WebRtc_UWord16 _noChannels; |
| 48 | int _codecType; |
| 49 | }; |
| 50 | |
| 51 | class TestStereo : public ACMTest |
| 52 | { |
| 53 | public: |
| 54 | TestStereo(int testMode); |
| 55 | ~TestStereo(); |
| 56 | |
| 57 | void Perform(); |
| 58 | private: |
| 59 | // The default value of '-1' indicates that the registration is based only on codec name |
| 60 | // and a sampling frequncy matching is not required. This is useful for codecs which support |
| 61 | // several sampling frequency. |
| 62 | WebRtc_Word16 RegisterSendCodec(char side, |
| 63 | char* codecName, |
| 64 | WebRtc_Word32 sampFreqHz, |
| 65 | int rate, |
| 66 | int packSize); |
| 67 | |
| 68 | void Run(TestPackStereo* channel); |
| 69 | void OpenOutFile(WebRtc_Word16 testNumber); |
| 70 | void DisplaySendReceiveCodec(); |
| 71 | |
| 72 | WebRtc_Word32 SendData( |
| 73 | const FrameType frameType, |
| 74 | const WebRtc_UWord8 payloadType, |
| 75 | const WebRtc_UWord32 timeStamp, |
| 76 | const WebRtc_UWord8* payloadData, |
| 77 | const WebRtc_UWord16 payloadSize, |
| 78 | const RTPFragmentationHeader* fragmentation); |
| 79 | |
| 80 | int _testMode; |
| 81 | |
| 82 | AudioCodingModule* _acmA; |
| 83 | AudioCodingModule* _acmB; |
| 84 | |
| 85 | TestPackStereo* _channelA2B; |
| 86 | |
| 87 | PCMFile _inFileA; |
| 88 | PCMFile _outFileB; |
| 89 | PCMFile _inFileStereo; |
| 90 | WebRtc_Word16 _testCntr; |
| 91 | WebRtc_UWord16 _packSizeSamp; |
| 92 | WebRtc_UWord16 _packSizeBytes; |
| 93 | int _counter; |
| 94 | int _codecType; |
| 95 | }; |
| 96 | |
| 97 | |
| 98 | #endif |
| 99 | |