Add shared frame id state to RtpVideoSender.
When using the generic descriptor we want all simulcast streams to share one frame id space (so that the SFU can switch stream without having to rewrite the frame id). The state also needs to be restored when the RtpVideoSender is recreated. Note that |shared_simulcast_frame_id_| is only added, but not used in this CL. Actually using it will be part of the next CL. Bug: webrtc:9361 Change-Id: I7192a06d6ae4cab118ca5996ed99a56888ad1d97 Reviewed-on: https://webrtc-review.googlesource.com/92803 Commit-Queue: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24233}
This commit is contained in:
@ -22,6 +22,7 @@ namespace webrtc {
|
||||
struct RtpPayloadState {
|
||||
int16_t picture_id = -1;
|
||||
uint8_t tl0_pic_idx = 0;
|
||||
int64_t shared_frame_id = 0;
|
||||
};
|
||||
// Settings for NACK, see RFC 4585 for details.
|
||||
struct NackConfig {
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "call/rtp_video_sender.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@ -206,6 +207,7 @@ RtpVideoSender::RtpVideoSender(
|
||||
auto it = states.find(ssrc);
|
||||
if (it != states.end()) {
|
||||
state = &it->second;
|
||||
shared_frame_id_ = std::max(shared_frame_id_, state->shared_frame_id);
|
||||
}
|
||||
params_.push_back(RtpPayloadParams(ssrc, state));
|
||||
}
|
||||
@ -541,6 +543,7 @@ std::map<uint32_t, RtpPayloadState> RtpVideoSender::GetRtpPayloadStates()
|
||||
std::map<uint32_t, RtpPayloadState> payload_states;
|
||||
for (const auto& param : params_) {
|
||||
payload_states[param.ssrc()] = param.state();
|
||||
payload_states[param.ssrc()].shared_frame_id = shared_frame_id_;
|
||||
}
|
||||
return payload_states;
|
||||
}
|
||||
|
@ -118,6 +118,11 @@ class RtpVideoSender : public RtpVideoSenderInterface {
|
||||
const RtpConfig rtp_config_;
|
||||
RtpTransportControllerSendInterface* const transport_;
|
||||
|
||||
// When using the generic descriptor we want all simulcast streams to share
|
||||
// one frame id space (so that the SFU can switch stream without having to
|
||||
// rewrite the frame id), therefore |shared_frame_id| has to live in a place
|
||||
// where we are aware of all the different streams.
|
||||
int64_t shared_frame_id_ = 0;
|
||||
std::vector<RtpPayloadParams> params_ RTC_GUARDED_BY(crit_);
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(RtpVideoSender);
|
||||
|
@ -270,12 +270,16 @@ TEST(RtpVideoSenderTest, CreateWithNoPreviousStates) {
|
||||
}
|
||||
|
||||
TEST(RtpVideoSenderTest, CreateWithPreviousStates) {
|
||||
const int64_t kState1SharedFrameId = 123;
|
||||
const int64_t kState2SharedFrameId = 234;
|
||||
RtpPayloadState state1;
|
||||
state1.picture_id = kInitialPictureId1;
|
||||
state1.tl0_pic_idx = kInitialTl0PicIdx1;
|
||||
state1.shared_frame_id = kState1SharedFrameId;
|
||||
RtpPayloadState state2;
|
||||
state2.picture_id = kInitialPictureId2;
|
||||
state2.tl0_pic_idx = kInitialTl0PicIdx2;
|
||||
state2.shared_frame_id = kState2SharedFrameId;
|
||||
std::map<uint32_t, RtpPayloadState> states = {{kSsrc1, state1},
|
||||
{kSsrc2, state2}};
|
||||
|
||||
@ -289,5 +293,7 @@ TEST(RtpVideoSenderTest, CreateWithPreviousStates) {
|
||||
EXPECT_EQ(kInitialTl0PicIdx1, initial_states[kSsrc1].tl0_pic_idx);
|
||||
EXPECT_EQ(kInitialPictureId2, initial_states[kSsrc2].picture_id);
|
||||
EXPECT_EQ(kInitialTl0PicIdx2, initial_states[kSsrc2].tl0_pic_idx);
|
||||
EXPECT_EQ(kState2SharedFrameId, initial_states[kSsrc1].shared_frame_id);
|
||||
EXPECT_EQ(kState2SharedFrameId, initial_states[kSsrc2].shared_frame_id);
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
Reference in New Issue
Block a user