Add new fmtp parameter for H.264
Bug: webrtc:11769, webrtc:8423, webrtc:11376 Change-Id: Ia8f22ff90f817ba46ca03de1e43d3088c05023cd Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178904 Commit-Queue: Eldar Rello <elrello@microsoft.com> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31878}
This commit is contained in:
@ -31,7 +31,6 @@
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/numerics/mod_ops.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace video_coding {
|
||||
@ -63,8 +62,7 @@ PacketBuffer::PacketBuffer(Clock* clock,
|
||||
first_packet_received_(false),
|
||||
is_cleared_to_first_seq_num_(false),
|
||||
buffer_(start_buffer_size),
|
||||
sps_pps_idr_is_h264_keyframe_(
|
||||
field_trial::IsEnabled("WebRTC-SpsPpsIdrIsH264Keyframe")) {
|
||||
sps_pps_idr_is_h264_keyframe_(false) {
|
||||
RTC_DCHECK_LE(start_buffer_size, max_buffer_size);
|
||||
// Buffer size must always be a power of 2.
|
||||
RTC_DCHECK((start_buffer_size & (start_buffer_size - 1)) == 0);
|
||||
@ -194,7 +192,9 @@ absl::optional<int64_t> PacketBuffer::LastReceivedKeyframePacketMs() const {
|
||||
MutexLock lock(&mutex_);
|
||||
return last_received_keyframe_packet_ms_;
|
||||
}
|
||||
|
||||
void PacketBuffer::ForceSpsPpsIdrIsH264Keyframe() {
|
||||
sps_pps_idr_is_h264_keyframe_ = true;
|
||||
}
|
||||
void PacketBuffer::ClearInternal() {
|
||||
for (auto& entry : buffer_) {
|
||||
entry = nullptr;
|
||||
|
@ -94,6 +94,7 @@ class PacketBuffer {
|
||||
RTC_LOCKS_EXCLUDED(mutex_);
|
||||
absl::optional<int64_t> LastReceivedKeyframePacketMs() const
|
||||
RTC_LOCKS_EXCLUDED(mutex_);
|
||||
void ForceSpsPpsIdrIsH264Keyframe();
|
||||
|
||||
private:
|
||||
Clock* const clock_;
|
||||
@ -147,7 +148,7 @@ class PacketBuffer {
|
||||
|
||||
// Indicates if we should require SPS, PPS, and IDR for a particular
|
||||
// RTP timestamp to treat the corresponding frame as a keyframe.
|
||||
const bool sps_pps_idr_is_h264_keyframe_;
|
||||
bool sps_pps_idr_is_h264_keyframe_;
|
||||
};
|
||||
|
||||
} // namespace video_coding
|
||||
|
@ -100,9 +100,8 @@ void PrintTo(const PacketBufferInsertResult& result, std::ostream* os) {
|
||||
|
||||
class PacketBufferTest : public ::testing::Test {
|
||||
protected:
|
||||
explicit PacketBufferTest(std::string field_trials = "")
|
||||
: scoped_field_trials_(field_trials),
|
||||
rand_(0x7732213),
|
||||
PacketBufferTest()
|
||||
: rand_(0x7732213),
|
||||
clock_(0),
|
||||
packet_buffer_(&clock_, kStartSize, kMaxSize) {}
|
||||
|
||||
@ -133,7 +132,6 @@ class PacketBufferTest : public ::testing::Test {
|
||||
packet_buffer_.InsertPacket(std::move(packet)));
|
||||
}
|
||||
|
||||
const test::ScopedFieldTrials scoped_field_trials_;
|
||||
Random rand_;
|
||||
SimulatedClock clock_;
|
||||
PacketBuffer packet_buffer_;
|
||||
@ -391,10 +389,11 @@ TEST_F(PacketBufferTest, InsertPacketAfterSequenceNumberWrapAround) {
|
||||
class PacketBufferH264Test : public PacketBufferTest {
|
||||
protected:
|
||||
explicit PacketBufferH264Test(bool sps_pps_idr_is_keyframe)
|
||||
: PacketBufferTest(sps_pps_idr_is_keyframe
|
||||
? "WebRTC-SpsPpsIdrIsH264Keyframe/Enabled/"
|
||||
: ""),
|
||||
sps_pps_idr_is_keyframe_(sps_pps_idr_is_keyframe) {}
|
||||
: PacketBufferTest(), sps_pps_idr_is_keyframe_(sps_pps_idr_is_keyframe) {
|
||||
if (sps_pps_idr_is_keyframe) {
|
||||
packet_buffer_.ForceSpsPpsIdrIsH264Keyframe();
|
||||
}
|
||||
}
|
||||
|
||||
PacketBufferInsertResult InsertH264(
|
||||
uint16_t seq_num, // packet sequence number
|
||||
|
Reference in New Issue
Block a user