mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-14 06:10:40 +01:00

and do the resolution of rids to layers. This has no effect yet since the simulcast encoder adapter (SimulcastEncoderAdapter::Encode), the VP8 encoder (LibvpxVp8Encoder::Encode) and the OpenH264 encoder (H264EncoderImpl::Encode) all generate a key frame for all layers whenever a key frame is requested on one layer. BUG=chromium:1354101 Change-Id: I13f5f1bf136839a68942b0f6bf4f2d5890415250 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280945 Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38565}
61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
/*
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#include "video/encoder_rtcp_feedback.h"
|
|
|
|
#include <memory>
|
|
|
|
#include "test/gmock.h"
|
|
#include "test/gtest.h"
|
|
#include "video/test/mock_video_stream_encoder.h"
|
|
|
|
using ::testing::_;
|
|
|
|
namespace webrtc {
|
|
|
|
class VieKeyRequestTest : public ::testing::Test {
|
|
public:
|
|
VieKeyRequestTest()
|
|
: simulated_clock_(123456789),
|
|
encoder_(),
|
|
encoder_rtcp_feedback_(
|
|
&simulated_clock_,
|
|
std::vector<uint32_t>(1, VieKeyRequestTest::kSsrc),
|
|
&encoder_,
|
|
nullptr) {}
|
|
|
|
protected:
|
|
const uint32_t kSsrc = 1234;
|
|
|
|
SimulatedClock simulated_clock_;
|
|
::testing::StrictMock<MockVideoStreamEncoder> encoder_;
|
|
EncoderRtcpFeedback encoder_rtcp_feedback_;
|
|
};
|
|
|
|
TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) {
|
|
EXPECT_CALL(encoder_, SendKeyFrame(_)).Times(1);
|
|
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
|
|
}
|
|
|
|
TEST_F(VieKeyRequestTest, TooManyOnReceivedIntraFrameRequest) {
|
|
EXPECT_CALL(encoder_, SendKeyFrame(_)).Times(1);
|
|
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
|
|
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
|
|
simulated_clock_.AdvanceTimeMilliseconds(10);
|
|
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
|
|
|
|
EXPECT_CALL(encoder_, SendKeyFrame(_)).Times(1);
|
|
simulated_clock_.AdvanceTimeMilliseconds(300);
|
|
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
|
|
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
|
|
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
|
|
}
|
|
|
|
} // namespace webrtc
|