MultiCodecReceiveTest: fix for flaky test.
Bug: webrtc:10828 Change-Id: I0fb2f4cdf0481e6c0036ae4dba861c5fbd4b98e5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152160 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Commit-Queue: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29124}
This commit is contained in:
@ -60,10 +60,11 @@ class FrameObserver : public test::RtpRtcpObserver,
|
||||
public:
|
||||
FrameObserver() : test::RtpRtcpObserver(test::CallTest::kDefaultTimeoutMs) {}
|
||||
|
||||
void Reset() {
|
||||
void Reset(uint8_t expected_payload_type) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
num_sent_frames_ = 0;
|
||||
num_rendered_frames_ = 0;
|
||||
expected_payload_type_ = expected_payload_type;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -78,13 +79,13 @@ class FrameObserver : public test::RtpRtcpObserver,
|
||||
if ((length - header.headerLength) == header.paddingLength)
|
||||
return SEND_PACKET; // Skip padding, may be sent after OnFrame is called.
|
||||
|
||||
if (expected_payload_type_ &&
|
||||
header.payloadType != expected_payload_type_.value()) {
|
||||
return DROP_PACKET; // All frames sent.
|
||||
}
|
||||
|
||||
if (!last_timestamp_ || header.timestamp != *last_timestamp_) {
|
||||
// New frame.
|
||||
if (last_payload_type_) {
|
||||
bool new_payload_type = header.payloadType != *last_payload_type_;
|
||||
EXPECT_EQ(num_sent_frames_ == 0, new_payload_type)
|
||||
<< "Payload type should change after reset.";
|
||||
}
|
||||
// Sent enough frames?
|
||||
if (num_sent_frames_ >= kFramesToObserve)
|
||||
return DROP_PACKET;
|
||||
@ -94,7 +95,6 @@ class FrameObserver : public test::RtpRtcpObserver,
|
||||
}
|
||||
|
||||
last_timestamp_ = header.timestamp;
|
||||
last_payload_type_ = header.payloadType;
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ class FrameObserver : public test::RtpRtcpObserver,
|
||||
|
||||
rtc::CriticalSection crit_;
|
||||
absl::optional<uint32_t> last_timestamp_;
|
||||
absl::optional<uint8_t> last_payload_type_;
|
||||
absl::optional<uint8_t> expected_payload_type_;
|
||||
int num_sent_frames_ RTC_GUARDED_BY(crit_) = 0;
|
||||
int num_rendered_frames_ RTC_GUARDED_BY(crit_) = 0;
|
||||
std::vector<uint32_t> sent_timestamps_ RTC_GUARDED_BY(crit_);
|
||||
@ -222,7 +222,7 @@ void MultiCodecReceiveTest::RunTestWithCodecs(
|
||||
// Recreate VideoSendStream with new config (codec, temporal layers).
|
||||
task_queue_.SendTask([this, i, &configs]() {
|
||||
DestroyVideoSendStreams();
|
||||
observer_.Reset();
|
||||
observer_.Reset(PayloadNameToPayloadType(configs[i].payload_name));
|
||||
|
||||
ConfigureEncoder(configs[i]);
|
||||
CreateVideoSendStreams();
|
||||
|
Reference in New Issue
Block a user