Eliminate use of IsZeroSize method

Check for dropped frames by instead checking the
frame_buffer pointer directly.

Also add RTC_DCHECK to verify that a webrtc::VideoFrame never
has video_frame_buffer_ set to nullptr (except by the default
constructor).

BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/1995343002
Cr-Commit-Position: refs/heads/master@{#12859}
This commit is contained in:
nisse
2016-05-23 23:35:54 -07:00
committed by Commit bot
parent 7e9274638e
commit 94cd3fa03a
2 changed files with 8 additions and 7 deletions

View File

@ -823,10 +823,6 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs(
return false;
}
}
VideoFrame decoded_frame(frame_buffer, 0, 0, webrtc::kVideoRotation_0);
decoded_frame.set_timestamp(output_timestamps_ms);
decoded_frame.set_ntp_time_ms(output_ntp_timestamps_ms);
if (frames_decoded_ < frames_decoded_logged_) {
ALOGD << "Decoder frame out # " << frames_decoded_ <<
". " << width << " x " << height <<
@ -862,9 +858,12 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs(
current_delay_time_ms_ = 0;
}
// |.IsZeroSize())| returns true when a frame has been dropped.
if (!decoded_frame.IsZeroSize()) {
// Callback - output decoded frame.
// If the frame was dropped, frame_buffer is left as nullptr.
if (frame_buffer) {
VideoFrame decoded_frame(frame_buffer, 0, 0, webrtc::kVideoRotation_0);
decoded_frame.set_timestamp(output_timestamps_ms);
decoded_frame.set_ntp_time_ms(output_ntp_timestamps_ms);
const int32_t callback_status =
callback_->Decoded(decoded_frame, decode_time_ms);
if (callback_status > 0) {

View File

@ -45,6 +45,7 @@ VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
ntp_time_ms_(0),
render_time_ms_(render_time_ms),
rotation_(rotation) {
RTC_DCHECK(buffer);
}
void VideoFrame::CreateEmptyFrame(int width,
@ -173,6 +174,7 @@ const rtc::scoped_refptr<VideoFrameBuffer>& VideoFrame::video_frame_buffer()
void VideoFrame::set_video_frame_buffer(
const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer) {
RTC_DCHECK(buffer);
video_frame_buffer_ = buffer;
}