Configured VCMTiming with sender defining delay times.
BUG=webrtc:7590 Review-Url: https://codereview.webrtc.org/2870823003 Cr-Commit-Position: refs/heads/master@{#18086}
This commit is contained in:
@ -46,6 +46,11 @@ class VCMEncodedFrame : protected EncodedImage {
|
|||||||
_encodedWidth = width;
|
_encodedWidth = width;
|
||||||
_encodedHeight = height;
|
_encodedHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetPlayoutDelay(PlayoutDelay playout_delay) {
|
||||||
|
playout_delay_ = playout_delay;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the encoded image
|
* Get the encoded image
|
||||||
*/
|
*/
|
||||||
|
@ -43,6 +43,7 @@ FrameBuffer::FrameBuffer(Clock* clock,
|
|||||||
jitter_estimator_(jitter_estimator),
|
jitter_estimator_(jitter_estimator),
|
||||||
timing_(timing),
|
timing_(timing),
|
||||||
inter_frame_delay_(clock_->TimeInMilliseconds()),
|
inter_frame_delay_(clock_->TimeInMilliseconds()),
|
||||||
|
last_decoded_frame_timestamp_(0),
|
||||||
last_decoded_frame_it_(frames_.end()),
|
last_decoded_frame_it_(frames_.end()),
|
||||||
last_continuous_frame_it_(frames_.end()),
|
last_continuous_frame_it_(frames_.end()),
|
||||||
num_frames_history_(0),
|
num_frames_history_(0),
|
||||||
@ -207,6 +208,16 @@ void FrameBuffer::Stop() {
|
|||||||
new_continuous_frame_event_.Set();
|
new_continuous_frame_event_.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FrameBuffer::UpdatePlayoutDelays(const FrameObject& frame) {
|
||||||
|
TRACE_EVENT0("webrtc", "FrameBuffer::UpdatePlayoutDelays");
|
||||||
|
PlayoutDelay playout_delay = frame.EncodedImage().playout_delay_;
|
||||||
|
if (playout_delay.min_ms >= 0)
|
||||||
|
timing_->set_min_playout_delay(playout_delay.min_ms);
|
||||||
|
|
||||||
|
if (playout_delay.max_ms >= 0)
|
||||||
|
timing_->set_max_playout_delay(playout_delay.max_ms);
|
||||||
|
}
|
||||||
|
|
||||||
int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
|
int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
|
||||||
TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame");
|
TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame");
|
||||||
RTC_DCHECK(frame);
|
RTC_DCHECK(frame);
|
||||||
@ -283,7 +294,7 @@ int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
|
|||||||
|
|
||||||
if (!UpdateFrameInfoWithIncomingFrame(*frame, info))
|
if (!UpdateFrameInfoWithIncomingFrame(*frame, info))
|
||||||
return last_continuous_picture_id;
|
return last_continuous_picture_id;
|
||||||
|
UpdatePlayoutDelays(*frame);
|
||||||
info->second.frame = std::move(frame);
|
info->second.frame = std::move(frame);
|
||||||
++num_frames_buffered_;
|
++num_frames_buffered_;
|
||||||
|
|
||||||
|
@ -120,6 +120,11 @@ class FrameBuffer {
|
|||||||
|
|
||||||
using FrameMap = std::map<FrameKey, FrameInfo>;
|
using FrameMap = std::map<FrameKey, FrameInfo>;
|
||||||
|
|
||||||
|
// Updates the minimal and maximal playout delays
|
||||||
|
// depending on the frame.
|
||||||
|
void UpdatePlayoutDelays(const FrameObject& frame)
|
||||||
|
EXCLUSIVE_LOCKS_REQUIRED(crit_);
|
||||||
|
|
||||||
// Update all directly dependent and indirectly dependent frames and mark
|
// Update all directly dependent and indirectly dependent frames and mark
|
||||||
// them as continuous if all their references has been fulfilled.
|
// them as continuous if all their references has been fulfilled.
|
||||||
void PropagateContinuity(FrameMap::iterator start)
|
void PropagateContinuity(FrameMap::iterator start)
|
||||||
|
@ -260,6 +260,15 @@ TEST_F(TestFrameBuffer2, OneSuperFrame) {
|
|||||||
CheckFrame(1, pid, 1);
|
CheckFrame(1, pid, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(TestFrameBuffer2, SetPlayoutDelay) {
|
||||||
|
const PlayoutDelay kPlayoutDelayMs = {123, 321};
|
||||||
|
std::unique_ptr<FrameObjectFake> test_frame(new FrameObjectFake());
|
||||||
|
test_frame->SetPlayoutDelay(kPlayoutDelayMs);
|
||||||
|
buffer_.InsertFrame(std::move(test_frame));
|
||||||
|
EXPECT_EQ(kPlayoutDelayMs.min_ms, timing_.min_playout_delay());
|
||||||
|
EXPECT_EQ(kPlayoutDelayMs.max_ms, timing_.max_playout_delay());
|
||||||
|
}
|
||||||
|
|
||||||
// Flaky test, see bugs.webrtc.org/7068.
|
// Flaky test, see bugs.webrtc.org/7068.
|
||||||
TEST_F(TestFrameBuffer2, DISABLED_OneUnorderedSuperFrame) {
|
TEST_F(TestFrameBuffer2, DISABLED_OneUnorderedSuperFrame) {
|
||||||
uint16_t pid = Rand();
|
uint16_t pid = Rand();
|
||||||
|
@ -48,6 +48,10 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
|
|||||||
_timeStamp = first_packet->timestamp;
|
_timeStamp = first_packet->timestamp;
|
||||||
ntp_time_ms_ = first_packet->ntp_time_ms_;
|
ntp_time_ms_ = first_packet->ntp_time_ms_;
|
||||||
|
|
||||||
|
// Setting frame's playout delays to the same values
|
||||||
|
// as of the first packet's.
|
||||||
|
SetPlayoutDelay(first_packet->video_header.playout_delay);
|
||||||
|
|
||||||
// Since FFmpeg use an optimized bitstream reader that reads in chunks of
|
// Since FFmpeg use an optimized bitstream reader that reads in chunks of
|
||||||
// 32/64 bits we have to add at least that much padding to the buffer
|
// 32/64 bits we have to add at least that much padding to the buffer
|
||||||
// to make sure the decoder doesn't read out of bounds.
|
// to make sure the decoder doesn't read out of bounds.
|
||||||
|
Reference in New Issue
Block a user