Remove unused output parameter in VCMReceiver::FrameForDecoding().
BUG= R=pbos@webrtc.org Review URL: https://codereview.webrtc.org/2104863002 . Cr-Commit-Position: refs/heads/master@{#13310}
This commit is contained in:
@ -138,12 +138,12 @@ void VCMReceiver::TriggerDecoderShutdown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms,
|
VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms,
|
||||||
int64_t* next_render_time_ms,
|
|
||||||
bool prefer_late_decoding) {
|
bool prefer_late_decoding) {
|
||||||
const int64_t start_time_ms = clock_->TimeInMilliseconds();
|
const int64_t start_time_ms = clock_->TimeInMilliseconds();
|
||||||
uint32_t frame_timestamp = 0;
|
uint32_t frame_timestamp = 0;
|
||||||
int min_playout_delay_ms = -1;
|
int min_playout_delay_ms = -1;
|
||||||
int max_playout_delay_ms = -1;
|
int max_playout_delay_ms = -1;
|
||||||
|
int64_t render_time_ms = 0;
|
||||||
// Exhaust wait time to get a complete frame for decoding.
|
// Exhaust wait time to get a complete frame for decoding.
|
||||||
VCMEncodedFrame* found_frame =
|
VCMEncodedFrame* found_frame =
|
||||||
jitter_buffer_.NextCompleteFrame(max_wait_time_ms);
|
jitter_buffer_.NextCompleteFrame(max_wait_time_ms);
|
||||||
@ -167,14 +167,14 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms,
|
|||||||
timing_->SetJitterDelay(jitter_buffer_.EstimatedJitterMs());
|
timing_->SetJitterDelay(jitter_buffer_.EstimatedJitterMs());
|
||||||
const int64_t now_ms = clock_->TimeInMilliseconds();
|
const int64_t now_ms = clock_->TimeInMilliseconds();
|
||||||
timing_->UpdateCurrentDelay(frame_timestamp);
|
timing_->UpdateCurrentDelay(frame_timestamp);
|
||||||
*next_render_time_ms = timing_->RenderTimeMs(frame_timestamp, now_ms);
|
render_time_ms = timing_->RenderTimeMs(frame_timestamp, now_ms);
|
||||||
// Check render timing.
|
// Check render timing.
|
||||||
bool timing_error = false;
|
bool timing_error = false;
|
||||||
// Assume that render timing errors are due to changes in the video stream.
|
// Assume that render timing errors are due to changes in the video stream.
|
||||||
if (*next_render_time_ms < 0) {
|
if (render_time_ms < 0) {
|
||||||
timing_error = true;
|
timing_error = true;
|
||||||
} else if (std::abs(*next_render_time_ms - now_ms) > max_video_delay_ms_) {
|
} else if (std::abs(render_time_ms - now_ms) > max_video_delay_ms_) {
|
||||||
int frame_delay = static_cast<int>(std::abs(*next_render_time_ms - now_ms));
|
int frame_delay = static_cast<int>(std::abs(render_time_ms - now_ms));
|
||||||
LOG(LS_WARNING) << "A frame about to be decoded is out of the configured "
|
LOG(LS_WARNING) << "A frame about to be decoded is out of the configured "
|
||||||
<< "delay bounds (" << frame_delay << " > "
|
<< "delay bounds (" << frame_delay << " > "
|
||||||
<< max_video_delay_ms_
|
<< max_video_delay_ms_
|
||||||
@ -201,8 +201,8 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms,
|
|||||||
static_cast<int32_t>(clock_->TimeInMilliseconds() - start_time_ms);
|
static_cast<int32_t>(clock_->TimeInMilliseconds() - start_time_ms);
|
||||||
uint16_t new_max_wait_time =
|
uint16_t new_max_wait_time =
|
||||||
static_cast<uint16_t>(VCM_MAX(available_wait_time, 0));
|
static_cast<uint16_t>(VCM_MAX(available_wait_time, 0));
|
||||||
uint32_t wait_time_ms = timing_->MaxWaitingTime(
|
uint32_t wait_time_ms =
|
||||||
*next_render_time_ms, clock_->TimeInMilliseconds());
|
timing_->MaxWaitingTime(render_time_ms, clock_->TimeInMilliseconds());
|
||||||
if (new_max_wait_time < wait_time_ms) {
|
if (new_max_wait_time < wait_time_ms) {
|
||||||
// We're not allowed to wait until the frame is supposed to be rendered,
|
// We're not allowed to wait until the frame is supposed to be rendered,
|
||||||
// waiting as long as we're allowed to avoid busy looping, and then return
|
// waiting as long as we're allowed to avoid busy looping, and then return
|
||||||
@ -219,9 +219,9 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms,
|
|||||||
if (frame == NULL) {
|
if (frame == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
frame->SetRenderTime(*next_render_time_ms);
|
frame->SetRenderTime(render_time_ms);
|
||||||
TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->TimeStamp(), "SetRenderTS",
|
TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->TimeStamp(), "SetRenderTS",
|
||||||
"render_time", *next_render_time_ms);
|
"render_time", frame->RenderTimeMs());
|
||||||
if (!frame->Complete()) {
|
if (!frame->Complete()) {
|
||||||
// Update stats for incomplete frames.
|
// Update stats for incomplete frames.
|
||||||
bool retransmitted = false;
|
bool retransmitted = false;
|
||||||
|
|||||||
@ -65,7 +65,6 @@ class VCMReceiver {
|
|||||||
void UpdateRtt(int64_t rtt);
|
void UpdateRtt(int64_t rtt);
|
||||||
int32_t InsertPacket(const VCMPacket& packet);
|
int32_t InsertPacket(const VCMPacket& packet);
|
||||||
VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms,
|
VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms,
|
||||||
int64_t* next_render_time_ms,
|
|
||||||
bool prefer_late_decoding);
|
bool prefer_late_decoding);
|
||||||
void ReleaseFrame(VCMEncodedFrame* frame);
|
void ReleaseFrame(VCMEncodedFrame* frame);
|
||||||
void ReceiveStatistics(uint32_t* bitrate, uint32_t* framerate);
|
void ReceiveStatistics(uint32_t* bitrate, uint32_t* framerate);
|
||||||
|
|||||||
@ -73,9 +73,7 @@ class TestVCMReceiver : public ::testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DecodeNextFrame() {
|
bool DecodeNextFrame() {
|
||||||
int64_t render_time_ms = 0;
|
VCMEncodedFrame* frame = receiver_.FrameForDecoding(0, false);
|
||||||
VCMEncodedFrame* frame =
|
|
||||||
receiver_.FrameForDecoding(0, &render_time_ms, false);
|
|
||||||
if (!frame)
|
if (!frame)
|
||||||
return false;
|
return false;
|
||||||
receiver_.ReleaseFrame(frame);
|
receiver_.ReleaseFrame(frame);
|
||||||
@ -409,7 +407,6 @@ TEST_F(VCMReceiverTimingTest, FrameForDecoding) {
|
|||||||
const int kFramePeriod = 40;
|
const int kFramePeriod = 40;
|
||||||
int64_t arrive_timestamps[kNumFrames];
|
int64_t arrive_timestamps[kNumFrames];
|
||||||
int64_t render_timestamps[kNumFrames];
|
int64_t render_timestamps[kNumFrames];
|
||||||
int64_t next_render_time;
|
|
||||||
|
|
||||||
// Construct test samples.
|
// Construct test samples.
|
||||||
// render_timestamps are the timestamps stored in the Frame;
|
// render_timestamps are the timestamps stored in the Frame;
|
||||||
@ -435,8 +432,7 @@ TEST_F(VCMReceiverTimingTest, FrameForDecoding) {
|
|||||||
// build bot to kill the test.
|
// build bot to kill the test.
|
||||||
while (num_frames_return < kNumFrames) {
|
while (num_frames_return < kNumFrames) {
|
||||||
int64_t start_time = clock_.TimeInMilliseconds();
|
int64_t start_time = clock_.TimeInMilliseconds();
|
||||||
VCMEncodedFrame* frame =
|
VCMEncodedFrame* frame = receiver_.FrameForDecoding(kMaxWaitTime, false);
|
||||||
receiver_.FrameForDecoding(kMaxWaitTime, &next_render_time, false);
|
|
||||||
int64_t end_time = clock_.TimeInMilliseconds();
|
int64_t end_time = clock_.TimeInMilliseconds();
|
||||||
|
|
||||||
// In any case the FrameForDecoding should not wait longer than
|
// In any case the FrameForDecoding should not wait longer than
|
||||||
@ -467,7 +463,6 @@ TEST_F(VCMReceiverTimingTest, FrameForDecodingPreferLateDecoding) {
|
|||||||
|
|
||||||
int64_t arrive_timestamps[kNumFrames];
|
int64_t arrive_timestamps[kNumFrames];
|
||||||
int64_t render_timestamps[kNumFrames];
|
int64_t render_timestamps[kNumFrames];
|
||||||
int64_t next_render_time;
|
|
||||||
|
|
||||||
int render_delay_ms;
|
int render_delay_ms;
|
||||||
int max_decode_ms;
|
int max_decode_ms;
|
||||||
@ -496,8 +491,8 @@ TEST_F(VCMReceiverTimingTest, FrameForDecodingPreferLateDecoding) {
|
|||||||
while (num_frames_return < kNumFrames) {
|
while (num_frames_return < kNumFrames) {
|
||||||
int64_t start_time = clock_.TimeInMilliseconds();
|
int64_t start_time = clock_.TimeInMilliseconds();
|
||||||
|
|
||||||
VCMEncodedFrame* frame = receiver_.FrameForDecoding(
|
VCMEncodedFrame* frame =
|
||||||
kMaxWaitTime, &next_render_time, prefer_late_decoding);
|
receiver_.FrameForDecoding(kMaxWaitTime, prefer_late_decoding);
|
||||||
int64_t end_time = clock_.TimeInMilliseconds();
|
int64_t end_time = clock_.TimeInMilliseconds();
|
||||||
if (frame) {
|
if (frame) {
|
||||||
EXPECT_EQ(frame->RenderTimeMs() - max_decode_ms - render_delay_ms,
|
EXPECT_EQ(frame->RenderTimeMs() - max_decode_ms - render_delay_ms,
|
||||||
|
|||||||
@ -244,15 +244,14 @@ void VideoReceiver::TriggerDecoderShutdown() {
|
|||||||
// Decode next frame, blocking.
|
// Decode next frame, blocking.
|
||||||
// Should be called as often as possible to get the most out of the decoder.
|
// Should be called as often as possible to get the most out of the decoder.
|
||||||
int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
|
int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
|
||||||
int64_t nextRenderTimeMs;
|
|
||||||
bool prefer_late_decoding = false;
|
bool prefer_late_decoding = false;
|
||||||
{
|
{
|
||||||
rtc::CritScope cs(&receive_crit_);
|
rtc::CritScope cs(&receive_crit_);
|
||||||
prefer_late_decoding = _codecDataBase.PrefersLateDecoding();
|
prefer_late_decoding = _codecDataBase.PrefersLateDecoding();
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMEncodedFrame* frame = _receiver.FrameForDecoding(
|
VCMEncodedFrame* frame =
|
||||||
maxWaitTimeMs, &nextRenderTimeMs, prefer_late_decoding);
|
_receiver.FrameForDecoding(maxWaitTimeMs, prefer_late_decoding);
|
||||||
|
|
||||||
if (!frame)
|
if (!frame)
|
||||||
return VCM_FRAME_NOT_READY;
|
return VCM_FRAME_NOT_READY;
|
||||||
|
|||||||
Reference in New Issue
Block a user