Add default values for PlayoutDelay in RTPVideoHeader.
There have been several bugs where the members of PlayoutDelay were zero initialized when handling RTP packets without the corresponding extensions. Initializing to {-1, -1} (meaning not provided) is less brittle. Bug: None Change-Id: I196850377128d5e67a19bdaf9298403b2e9f5a6e Reviewed-on: https://webrtc-review.googlesource.com/c/111181 Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25670}
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
RTPVideoHeader::RTPVideoHeader() : playout_delay(), video_timing() {}
|
||||
RTPVideoHeader::RTPVideoHeader() : video_timing() {}
|
||||
RTPVideoHeader::RTPVideoHeader(const RTPVideoHeader& other) = default;
|
||||
RTPVideoHeader::~RTPVideoHeader() = default;
|
||||
|
||||
|
@ -59,7 +59,7 @@ struct RTPVideoHeader {
|
||||
uint8_t simulcastIdx = 0;
|
||||
VideoCodecType codec = VideoCodecType::kVideoCodecGeneric;
|
||||
|
||||
PlayoutDelay playout_delay;
|
||||
PlayoutDelay playout_delay = {-1, -1};
|
||||
VideoSendTiming video_timing;
|
||||
FrameMarking frame_marking;
|
||||
RTPVideoTypeHeader video_type_header;
|
||||
|
@ -530,8 +530,6 @@ void RtpVideoStreamReceiver::ReceivePacket(const RtpPacketReceived& packet) {
|
||||
webrtc_rtp_header.video_header().content_type = VideoContentType::UNSPECIFIED;
|
||||
webrtc_rtp_header.video_header().video_timing.flags =
|
||||
VideoSendTiming::kInvalid;
|
||||
webrtc_rtp_header.video_header().playout_delay.min_ms = -1;
|
||||
webrtc_rtp_header.video_header().playout_delay.max_ms = -1;
|
||||
webrtc_rtp_header.video_header().is_last_packet_in_frame =
|
||||
webrtc_rtp_header.header.markerBit;
|
||||
|
||||
|
@ -626,4 +626,13 @@ TEST_F(RtpVideoStreamReceiverTest, RepeatedSecondarySinkDisallowed) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialization of WebRtcRTPHeader is a bit convoluted, with some fields
|
||||
// zero-initialized. RtpVideoStreamReceiver depends on proper default values for
|
||||
// the playout delay.
|
||||
TEST(WebRtcRTPHeader, DefaultPlayoutDelayIsUnspecified) {
|
||||
WebRtcRTPHeader webrtc_rtp_header = {};
|
||||
EXPECT_EQ(webrtc_rtp_header.video_header().playout_delay.min_ms, -1);
|
||||
EXPECT_EQ(webrtc_rtp_header.video_header().playout_delay.max_ms, -1);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
Reference in New Issue
Block a user