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:
@ -823,10 +823,6 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs(
|
|||||||
return false;
|
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_) {
|
if (frames_decoded_ < frames_decoded_logged_) {
|
||||||
ALOGD << "Decoder frame out # " << frames_decoded_ <<
|
ALOGD << "Decoder frame out # " << frames_decoded_ <<
|
||||||
". " << width << " x " << height <<
|
". " << width << " x " << height <<
|
||||||
@ -862,9 +858,12 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs(
|
|||||||
current_delay_time_ms_ = 0;
|
current_delay_time_ms_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// |.IsZeroSize())| returns true when a frame has been dropped.
|
// If the frame was dropped, frame_buffer is left as nullptr.
|
||||||
if (!decoded_frame.IsZeroSize()) {
|
if (frame_buffer) {
|
||||||
// Callback - output decoded frame.
|
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 =
|
const int32_t callback_status =
|
||||||
callback_->Decoded(decoded_frame, decode_time_ms);
|
callback_->Decoded(decoded_frame, decode_time_ms);
|
||||||
if (callback_status > 0) {
|
if (callback_status > 0) {
|
||||||
|
|||||||
@ -45,6 +45,7 @@ VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
|
|||||||
ntp_time_ms_(0),
|
ntp_time_ms_(0),
|
||||||
render_time_ms_(render_time_ms),
|
render_time_ms_(render_time_ms),
|
||||||
rotation_(rotation) {
|
rotation_(rotation) {
|
||||||
|
RTC_DCHECK(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoFrame::CreateEmptyFrame(int width,
|
void VideoFrame::CreateEmptyFrame(int width,
|
||||||
@ -173,6 +174,7 @@ const rtc::scoped_refptr<VideoFrameBuffer>& VideoFrame::video_frame_buffer()
|
|||||||
|
|
||||||
void VideoFrame::set_video_frame_buffer(
|
void VideoFrame::set_video_frame_buffer(
|
||||||
const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer) {
|
const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer) {
|
||||||
|
RTC_DCHECK(buffer);
|
||||||
video_frame_buffer_ = buffer;
|
video_frame_buffer_ = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user