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:
Johan Ahlers
2016-06-28 13:32:49 +02:00
parent 95348f7663
commit 31b2ec4e0d
4 changed files with 15 additions and 22 deletions

View File

@ -138,12 +138,12 @@ void VCMReceiver::TriggerDecoderShutdown() {
}
VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms,
int64_t* next_render_time_ms,
bool prefer_late_decoding) {
const int64_t start_time_ms = clock_->TimeInMilliseconds();
uint32_t frame_timestamp = 0;
int min_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.
VCMEncodedFrame* found_frame =
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());
const int64_t now_ms = clock_->TimeInMilliseconds();
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.
bool timing_error = false;
// 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;
} else if (std::abs(*next_render_time_ms - now_ms) > max_video_delay_ms_) {
int frame_delay = static_cast<int>(std::abs(*next_render_time_ms - now_ms));
} else if (std::abs(render_time_ms - now_ms) > max_video_delay_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 "
<< "delay bounds (" << frame_delay << " > "
<< 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);
uint16_t new_max_wait_time =
static_cast<uint16_t>(VCM_MAX(available_wait_time, 0));
uint32_t wait_time_ms = timing_->MaxWaitingTime(
*next_render_time_ms, clock_->TimeInMilliseconds());
uint32_t wait_time_ms =
timing_->MaxWaitingTime(render_time_ms, clock_->TimeInMilliseconds());
if (new_max_wait_time < wait_time_ms) {
// 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
@ -219,9 +219,9 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms,
if (frame == NULL) {
return NULL;
}
frame->SetRenderTime(*next_render_time_ms);
frame->SetRenderTime(render_time_ms);
TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->TimeStamp(), "SetRenderTS",
"render_time", *next_render_time_ms);
"render_time", frame->RenderTimeMs());
if (!frame->Complete()) {
// Update stats for incomplete frames.
bool retransmitted = false;

View File

@ -65,7 +65,6 @@ class VCMReceiver {
void UpdateRtt(int64_t rtt);
int32_t InsertPacket(const VCMPacket& packet);
VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms,
int64_t* next_render_time_ms,
bool prefer_late_decoding);
void ReleaseFrame(VCMEncodedFrame* frame);
void ReceiveStatistics(uint32_t* bitrate, uint32_t* framerate);

View File

@ -73,9 +73,7 @@ class TestVCMReceiver : public ::testing::Test {
}
bool DecodeNextFrame() {
int64_t render_time_ms = 0;
VCMEncodedFrame* frame =
receiver_.FrameForDecoding(0, &render_time_ms, false);
VCMEncodedFrame* frame = receiver_.FrameForDecoding(0, false);
if (!frame)
return false;
receiver_.ReleaseFrame(frame);
@ -409,7 +407,6 @@ TEST_F(VCMReceiverTimingTest, FrameForDecoding) {
const int kFramePeriod = 40;
int64_t arrive_timestamps[kNumFrames];
int64_t render_timestamps[kNumFrames];
int64_t next_render_time;
// Construct test samples.
// render_timestamps are the timestamps stored in the Frame;
@ -435,8 +432,7 @@ TEST_F(VCMReceiverTimingTest, FrameForDecoding) {
// build bot to kill the test.
while (num_frames_return < kNumFrames) {
int64_t start_time = clock_.TimeInMilliseconds();
VCMEncodedFrame* frame =
receiver_.FrameForDecoding(kMaxWaitTime, &next_render_time, false);
VCMEncodedFrame* frame = receiver_.FrameForDecoding(kMaxWaitTime, false);
int64_t end_time = clock_.TimeInMilliseconds();
// 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 render_timestamps[kNumFrames];
int64_t next_render_time;
int render_delay_ms;
int max_decode_ms;
@ -496,8 +491,8 @@ TEST_F(VCMReceiverTimingTest, FrameForDecodingPreferLateDecoding) {
while (num_frames_return < kNumFrames) {
int64_t start_time = clock_.TimeInMilliseconds();
VCMEncodedFrame* frame = receiver_.FrameForDecoding(
kMaxWaitTime, &next_render_time, prefer_late_decoding);
VCMEncodedFrame* frame =
receiver_.FrameForDecoding(kMaxWaitTime, prefer_late_decoding);
int64_t end_time = clock_.TimeInMilliseconds();
if (frame) {
EXPECT_EQ(frame->RenderTimeMs() - max_decode_ms - render_delay_ms,

View File

@ -244,15 +244,14 @@ void VideoReceiver::TriggerDecoderShutdown() {
// Decode next frame, blocking.
// Should be called as often as possible to get the most out of the decoder.
int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
int64_t nextRenderTimeMs;
bool prefer_late_decoding = false;
{
rtc::CritScope cs(&receive_crit_);
prefer_late_decoding = _codecDataBase.PrefersLateDecoding();
}
VCMEncodedFrame* frame = _receiver.FrameForDecoding(
maxWaitTimeMs, &nextRenderTimeMs, prefer_late_decoding);
VCMEncodedFrame* frame =
_receiver.FrameForDecoding(maxWaitTimeMs, prefer_late_decoding);
if (!frame)
return VCM_FRAME_NOT_READY;