Set RTPVideoHeader picture id in PayloadRouter if forced fallback for VP8 is enabled.
The SW and HW encoder have separate picture id sequences.
Set picture id to not cause sequence discontinuties at encoder changes.
Bug: webrtc:6634
Change-Id: Ie47168791399303d88cbec3ef6ae8ef8c16ced30
Reviewed-on: https://webrtc-review.googlesource.com/5481
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20188}
diff --git a/video/picture_id_tests.cc b/video/picture_id_tests.cc
index ba99bd3..3ebf863 100644
--- a/video/picture_id_tests.cc
+++ b/video/picture_id_tests.cc
@@ -12,9 +12,10 @@
#include "modules/rtp_rtcp/source/rtp_format.h"
#include "modules/video_coding/sequence_number_util.h"
#include "test/call_test.h"
+#include "test/field_trial.h"
namespace webrtc {
-
+namespace {
const int kFrameMaxWidth = 1280;
const int kFrameMaxHeight = 720;
const int kFrameRate = 30;
@@ -24,6 +25,10 @@
const int kEncoderBitrateBps = 100000;
const uint32_t kPictureIdWraparound = (1 << 15);
+const char kVp8ForcedFallbackEncoderEnabled[] =
+ "WebRTC-VP8-Forced-Fallback-Encoder/Enabled/";
+} // namespace
+
class PictureIdObserver : public test::RtpRtcpObserver {
public:
PictureIdObserver()
@@ -132,9 +137,10 @@
std::set<uint32_t> observed_ssrcs_ RTC_GUARDED_BY(crit_);
};
-class PictureIdTest : public test::CallTest {
+class PictureIdTest : public test::CallTest,
+ public ::testing::WithParamInterface<std::string> {
public:
- PictureIdTest() {}
+ PictureIdTest() : scoped_field_trial_(GetParam()) {}
virtual ~PictureIdTest() {
EXPECT_EQ(nullptr, video_send_stream_);
@@ -156,9 +162,15 @@
const std::vector<int>& ssrc_counts);
private:
+ test::ScopedFieldTrials scoped_field_trial_;
PictureIdObserver observer;
};
+INSTANTIATE_TEST_CASE_P(TestWithForcedFallbackEncoderEnabled,
+ PictureIdTest,
+ ::testing::Values(kVp8ForcedFallbackEncoderEnabled,
+ ""));
+
// Use a special stream factory to ensure that all simulcast streams are being
// sent.
class VideoStreamFactory
@@ -301,19 +313,19 @@
});
}
-TEST_F(PictureIdTest, PictureIdContinuousAfterReconfigureVp8) {
+TEST_P(PictureIdTest, PictureIdContinuousAfterReconfigureVp8) {
std::unique_ptr<VideoEncoder> encoder(VP8Encoder::Create());
SetupEncoder(encoder.get());
TestPictureIdContinuousAfterReconfigure({1, 3, 3, 1, 1});
}
-TEST_F(PictureIdTest, PictureIdIncreasingAfterRecreateStreamVp8) {
+TEST_P(PictureIdTest, PictureIdIncreasingAfterRecreateStreamVp8) {
std::unique_ptr<VideoEncoder> encoder(VP8Encoder::Create());
SetupEncoder(encoder.get());
TestPictureIdIncreaseAfterRecreateStreams({1, 3, 3, 1, 1});
}
-TEST_F(PictureIdTest, PictureIdIncreasingAfterStreamCountChangeVp8) {
+TEST_P(PictureIdTest, PictureIdIncreasingAfterStreamCountChangeVp8) {
std::unique_ptr<VideoEncoder> encoder(VP8Encoder::Create());
// Make sure that that the picture id is not reset if the stream count goes
// down and then up.
@@ -322,7 +334,7 @@
TestPictureIdContinuousAfterReconfigure(ssrc_counts);
}
-TEST_F(PictureIdTest,
+TEST_P(PictureIdTest,
PictureIdContinuousAfterReconfigureSimulcastEncoderAdapter) {
cricket::InternalEncoderFactory internal_encoder_factory;
SimulcastEncoderAdapter simulcast_encoder_adapter(&internal_encoder_factory);
@@ -330,7 +342,7 @@
TestPictureIdContinuousAfterReconfigure({1, 3, 3, 1, 1});
}
-TEST_F(PictureIdTest,
+TEST_P(PictureIdTest,
PictureIdIncreasingAfterRecreateStreamSimulcastEncoderAdapter) {
cricket::InternalEncoderFactory internal_encoder_factory;
SimulcastEncoderAdapter simulcast_encoder_adapter(&internal_encoder_factory);
@@ -341,7 +353,7 @@
// When using the simulcast encoder adapter, the picture id is randomly set
// when the ssrc count is reduced and then increased. This means that we are
// not spec compliant in that particular case.
-TEST_F(
+TEST_P(
PictureIdTest,
DISABLED_PictureIdIncreasingAfterStreamCountChangeSimulcastEncoderAdapter) {
cricket::InternalEncoderFactory internal_encoder_factory;