Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(951)

Side by Side Diff: webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h

Issue 1525573002: rtp_rtcp/test/BWEStandAlone deleted as obsolete (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTLOADGENERATOR_H_
12 #define WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTLOADGENERATOR_H_
13
14 #include <stdlib.h>
15
16 #include "webrtc/base/platform_thread.h"
17 #include "webrtc/modules/include/module_common_types.h"
18 #include "webrtc/typedefs.h"
19
20 class TestSenderReceiver;
21 namespace webrtc {
22 class CriticalSectionWrapper;
23 class EventWrapper;
24 }
25
26 class TestLoadGenerator
27 {
28 public:
29 TestLoadGenerator (TestSenderReceiver *sender, int32_t rtpSampleRate = 90000 );
30 virtual ~TestLoadGenerator ();
31
32 int32_t SetBitrate (int32_t newBitrateKbps);
33 virtual int32_t Start (const char *threadName = NULL);
34 virtual int32_t Stop ();
35 virtual bool GeneratorLoop () = 0;
36
37 protected:
38 virtual int generatePayload ( uint32_t timestamp ) = 0;
39 int generatePayload ();
40 int sendPayload (const uint32_t timeStamp,
41 const uint8_t* payloadData,
42 const size_t payloadSize,
43 const webrtc::FrameType frameType = webrtc::kVideoFrameDelta);
44
45 webrtc::CriticalSectionWrapper* _critSect;
46 webrtc::EventWrapper *_eventPtr;
47 // TODO(pbos): Replace without pointer usage.
48 rtc::scoped_ptr<rtc::PlatformThread> _genThread;
49 int32_t _bitrateKbps;
50 TestSenderReceiver *_sender;
51 bool _running;
52 int32_t _rtpSampleRate;
53 };
54
55
56 class CBRGenerator : public TestLoadGenerator
57 {
58 public:
59 CBRGenerator (TestSenderReceiver *sender,
60 size_t payloadSizeBytes,
61 int32_t bitrateKbps,
62 int32_t rtpSampleRate = 90000);
63 virtual ~CBRGenerator ();
64
65 virtual int32_t Start () {return (TestLoadGenerator::Start("CBRGenerator")); };
66
67 virtual bool GeneratorLoop ();
68
69 protected:
70 virtual int generatePayload ( uint32_t timestamp );
71
72 size_t _payloadSizeBytes;
73 uint8_t *_payload;
74 };
75
76
77 class CBRFixFRGenerator : public TestLoadGenerator // constant bitrate and fixed frame rate
78 {
79 public:
80 CBRFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps, int32_t rtpSampleRate = 90000,
81 int32_t frameRateFps = 30, double spread = 0.0);
82 virtual ~CBRFixFRGenerator ();
83
84 virtual int32_t Start () {return (TestLoadGenerator::Start("CBRFixFRGenerato r"));};
85
86 virtual bool GeneratorLoop ();
87
88 protected:
89 virtual size_t nextPayloadSize ();
90 virtual int generatePayload ( uint32_t timestamp );
91
92 size_t _payloadSizeBytes;
93 uint8_t *_payload;
94 size_t _payloadAllocLen;
95 int32_t _frameRateFps;
96 double _spreadFactor;
97 };
98
99 class PeriodicKeyFixFRGenerator : public CBRFixFRGenerator // constant bitrate a nd fixed frame rate with periodically large frames
100 {
101 public:
102 PeriodicKeyFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps, int32_t rtpSampleRate = 90000,
103 int32_t frameRateFps = 30, double spread = 0.0, double keyFactor = 4.0, uint32_t keyPeriod = 300);
104 virtual ~PeriodicKeyFixFRGenerator () {}
105
106 protected:
107 virtual size_t nextPayloadSize ();
108
109 double _keyFactor;
110 uint32_t _keyPeriod;
111 uint32_t _frameCount;
112 };
113
114 // Probably better to inherit CBRFixFRGenerator from CBRVarFRGenerator, but sinc e
115 // the fix FR version already existed this was easier.
116 class CBRVarFRGenerator : public CBRFixFRGenerator // constant bitrate and varia ble frame rate
117 {
118 public:
119 CBRVarFRGenerator(TestSenderReceiver *sender, int32_t bitrateKbps, const uin t8_t* frameRates,
120 uint16_t numFrameRates, int32_t rtpSampleRate = 90000, double avgFrPerio dMs = 5.0,
121 double frSpreadFactor = 0.05, double spreadFactor = 0.0);
122
123 ~CBRVarFRGenerator();
124
125 protected:
126 virtual void ChangeFrameRate();
127 virtual size_t nextPayloadSize ();
128
129 double _avgFrPeriodMs;
130 double _frSpreadFactor;
131 uint8_t* _frameRates;
132 uint16_t _numFrameRates;
133 int64_t _frChangeTimeMs;
134 };
135
136 class CBRFrameDropGenerator : public CBRFixFRGenerator // constant bitrate and v ariable frame rate
137 {
138 public:
139 CBRFrameDropGenerator(TestSenderReceiver *sender, int32_t bitrateKbps,
140 int32_t rtpSampleRate = 90000, double spreadFactor = 0.0);
141
142 ~CBRFrameDropGenerator();
143
144 protected:
145 virtual size_t nextPayloadSize();
146
147 double _accBits;
148 };
149
150 #endif // WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTLOADGENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698