2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-08-01 01:40:02 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_AUDIO_CODING_TEST_CHANNEL_H_
|
|
|
|
|
#define MODULES_AUDIO_CODING_TEST_CHANNEL_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
2024-09-13 13:46:56 +00:00
|
|
|
#include "api/neteq/neteq.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/audio_coding/include/audio_coding_module.h"
|
|
|
|
|
#include "modules/include/module_common_types.h"
|
2020-07-07 15:53:34 +02:00
|
|
|
#include "rtc_base/synchronization/mutex.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-12-16 10:09:04 +00:00
|
|
|
namespace webrtc {
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
#define MAX_NUM_PAYLOADS 50
|
|
|
|
|
#define MAX_NUM_FRAMESIZES 6
|
|
|
|
|
|
2014-02-19 20:31:17 +00:00
|
|
|
// TODO(turajs): Write constructor for this structure.
|
2013-05-03 07:34:12 +00:00
|
|
|
struct ACMTestFrameSizeStats {
|
|
|
|
|
uint16_t frameSizeSample;
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
size_t maxPayloadLen;
|
2013-05-03 07:34:12 +00:00
|
|
|
uint32_t numPackets;
|
|
|
|
|
uint64_t totalPayloadLenByte;
|
|
|
|
|
uint64_t totalEncodedSamples;
|
|
|
|
|
double rateBitPerSec;
|
|
|
|
|
double usageLenSec;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
2014-02-19 20:31:17 +00:00
|
|
|
// TODO(turajs): Write constructor for this structure.
|
2013-05-03 07:34:12 +00:00
|
|
|
struct ACMTestPayloadStats {
|
|
|
|
|
bool newPacket;
|
|
|
|
|
int16_t payloadType;
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
size_t lastPayloadLenByte;
|
2013-05-03 07:34:12 +00:00
|
|
|
uint32_t lastTimestamp;
|
|
|
|
|
ACMTestFrameSizeStats frameSizeStats[MAX_NUM_FRAMESIZES];
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
2013-05-03 07:34:12 +00:00
|
|
|
class Channel : public AudioPacketizationCallback {
|
|
|
|
|
public:
|
|
|
|
|
Channel(int16_t chID = -1);
|
2016-08-29 10:05:24 -07:00
|
|
|
~Channel() override;
|
2013-05-03 07:34:12 +00:00
|
|
|
|
2019-03-07 10:18:23 +01:00
|
|
|
int32_t SendData(AudioFrameType frameType,
|
2015-03-04 12:58:35 +00:00
|
|
|
uint8_t payloadType,
|
|
|
|
|
uint32_t timeStamp,
|
|
|
|
|
const uint8_t* payloadData,
|
2020-01-23 13:45:50 +01:00
|
|
|
size_t payloadSize,
|
|
|
|
|
int64_t absolute_capture_timestamp_ms) override;
|
2013-05-03 07:34:12 +00:00
|
|
|
|
2024-09-13 13:46:56 +00:00
|
|
|
void RegisterReceiverNetEq(NetEq* neteq);
|
2013-05-03 07:34:12 +00:00
|
|
|
|
|
|
|
|
void ResetStats();
|
|
|
|
|
|
|
|
|
|
void SetIsStereo(bool isStereo) { _isStereo = isStereo; }
|
|
|
|
|
|
|
|
|
|
uint32_t LastInTimestamp();
|
|
|
|
|
|
|
|
|
|
void SetFECTestWithPacketLoss(bool usePacketLoss) {
|
|
|
|
|
_useFECTestWithPacketLoss = usePacketLoss;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double BitRate();
|
|
|
|
|
|
2013-06-06 19:00:09 +00:00
|
|
|
void set_send_timestamp(uint32_t new_send_ts) {
|
|
|
|
|
external_send_timestamp_ = new_send_ts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_sequence_number(uint16_t new_sequence_number) {
|
|
|
|
|
external_sequence_number_ = new_sequence_number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_num_packets_to_drop(int new_num_packets_to_drop) {
|
|
|
|
|
num_packets_to_drop_ = new_num_packets_to_drop;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-03 07:34:12 +00:00
|
|
|
private:
|
2019-02-18 12:00:06 +01:00
|
|
|
void CalcStatistics(const RTPHeader& rtp_header, size_t payloadSize);
|
2013-05-03 07:34:12 +00:00
|
|
|
|
2024-09-13 13:46:56 +00:00
|
|
|
NetEq* _neteq;
|
2013-05-03 07:34:12 +00:00
|
|
|
uint16_t _seqNo;
|
|
|
|
|
// 60msec * 32 sample(max)/msec * 2 description (maybe) * 2 bytes/sample
|
|
|
|
|
uint8_t _payloadData[60 * 32 * 2 * 2];
|
|
|
|
|
|
2020-07-07 15:53:34 +02:00
|
|
|
Mutex _channelCritSect;
|
2013-05-03 07:34:12 +00:00
|
|
|
FILE* _bitStreamFile;
|
|
|
|
|
bool _saveBitStream;
|
|
|
|
|
int16_t _lastPayloadType;
|
|
|
|
|
ACMTestPayloadStats _payloadStats[MAX_NUM_PAYLOADS];
|
|
|
|
|
bool _isStereo;
|
2019-02-18 12:00:06 +01:00
|
|
|
RTPHeader _rtp_header;
|
2013-05-03 07:34:12 +00:00
|
|
|
bool _leftChannel;
|
|
|
|
|
uint32_t _lastInTimestamp;
|
2015-03-03 12:02:30 +00:00
|
|
|
bool _useLastFrameSize;
|
|
|
|
|
uint32_t _lastFrameSizeSample;
|
2013-05-03 07:34:12 +00:00
|
|
|
// FEC Test variables
|
|
|
|
|
int16_t _packetLoss;
|
|
|
|
|
bool _useFECTestWithPacketLoss;
|
|
|
|
|
uint64_t _beginTime;
|
|
|
|
|
uint64_t _totalBytes;
|
2013-06-06 19:00:09 +00:00
|
|
|
|
|
|
|
|
// External timing info, defaulted to -1. Only used if they are
|
|
|
|
|
// non-negative.
|
|
|
|
|
int64_t external_send_timestamp_;
|
|
|
|
|
int32_t external_sequence_number_;
|
|
|
|
|
int num_packets_to_drop_;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
2013-05-03 07:34:12 +00:00
|
|
|
} // namespace webrtc
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_AUDIO_CODING_TEST_CHANNEL_H_
|