Reland of Delete VideoFrame default constructor, and IsZeroSize method. (patchset #1 id:1 of https://codereview.webrtc.org/2574123002/ )
Reason for revert: Fixing perf tests. Original issue's description: > Revert of Delete VideoFrame default constructor, and IsZeroSize method. (patchset #5 id:80001 of https://codereview.webrtc.org/2541863002/ ) > > Reason for revert: > Crashes perf tests, e.g., > > ./out/Debug/webrtc_perf_tests --gtest_filter='FullStackTest.ScreenshareSlidesVP8_2TL_VeryLossyNet' > > dies with an assert related to rtc::Optional. > > Original issue's description: > > Delete VideoFrame default constructor, and IsZeroSize method. > > > > This ensures that the video_frame_buffer method never can return a > > null pointer. > > > > BUG=webrtc:6591 > > > > Committed: https://crrev.com/bfcf561923a42005e4c7d66d8e72e5932155f997 > > Cr-Commit-Position: refs/heads/master@{#15574} > > TBR=magjed@webrtc.org,stefan@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6591 > > Committed: https://crrev.com/0989fbcad2ca4eb5805a77e8ebfefd3af06ade23 > Cr-Commit-Position: refs/heads/master@{#15597} TBR=magjed@webrtc.org,stefan@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6591 Review-Url: https://codereview.webrtc.org/2574183002 Cr-Commit-Position: refs/heads/master@{#15633}
This commit is contained in:
@ -308,10 +308,6 @@ int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame,
|
||||
ReportError();
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
}
|
||||
if (input_frame.IsZeroSize()) {
|
||||
ReportError();
|
||||
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
||||
}
|
||||
if (!encoded_image_callback_) {
|
||||
LOG(LS_WARNING) << "InitEncode() has been called, but a callback function "
|
||||
<< "has not been set with RegisterEncodeCompleteCallback()";
|
||||
|
||||
@ -131,7 +131,6 @@ class I420Decoder : public VideoDecoder {
|
||||
uint16_t* width,
|
||||
uint16_t* height);
|
||||
|
||||
VideoFrame _decodedImage;
|
||||
int _width;
|
||||
int _height;
|
||||
bool _inited;
|
||||
|
||||
@ -204,7 +204,6 @@ class VideoProcessorImpl : public VideoProcessor {
|
||||
// Keep track of the last successful frame, since we need to write that
|
||||
// when decoding fails:
|
||||
uint8_t* last_successful_frame_buffer_;
|
||||
webrtc::VideoFrame source_frame_;
|
||||
// To keep track of if we have excluded the first key frame from packet loss:
|
||||
bool first_key_frame_has_been_excluded_;
|
||||
// To tell the decoder previous frame have been dropped due to packet loss:
|
||||
|
||||
@ -300,7 +300,6 @@ int SimulcastEncoderAdapter::Encode(
|
||||
// TODO(perkj): ensure that works going forward, and figure out how this
|
||||
// affects webrtc:5683.
|
||||
if ((dst_width == src_width && dst_height == src_height) ||
|
||||
input_image.IsZeroSize() ||
|
||||
input_image.video_frame_buffer()->native_handle()) {
|
||||
int ret = streaminfos_[stream_idx].encoder->Encode(
|
||||
input_image, codec_specific_info, &stream_frame_types);
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/optional.h"
|
||||
#include "webrtc/base/timeutils.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
@ -88,7 +89,7 @@ bool Vp8UnitTestEncodeCompleteCallback::EncodeComplete() {
|
||||
|
||||
class Vp8UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback {
|
||||
public:
|
||||
explicit Vp8UnitTestDecodeCompleteCallback(VideoFrame* frame)
|
||||
explicit Vp8UnitTestDecodeCompleteCallback(rtc::Optional<VideoFrame>* frame)
|
||||
: decoded_frame_(frame), decode_complete(false) {}
|
||||
int32_t Decoded(VideoFrame& frame) override;
|
||||
int32_t Decoded(VideoFrame& frame, int64_t decode_time_ms) override {
|
||||
@ -98,7 +99,7 @@ class Vp8UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback {
|
||||
bool DecodeComplete();
|
||||
|
||||
private:
|
||||
VideoFrame* decoded_frame_;
|
||||
rtc::Optional<VideoFrame>* decoded_frame_;
|
||||
bool decode_complete;
|
||||
};
|
||||
|
||||
@ -111,7 +112,7 @@ bool Vp8UnitTestDecodeCompleteCallback::DecodeComplete() {
|
||||
}
|
||||
|
||||
int Vp8UnitTestDecodeCompleteCallback::Decoded(VideoFrame& image) {
|
||||
*decoded_frame_ = image;
|
||||
*decoded_frame_ = rtc::Optional<VideoFrame>(image);
|
||||
decode_complete = true;
|
||||
return 0;
|
||||
}
|
||||
@ -184,8 +185,8 @@ class TestVp8Impl : public ::testing::Test {
|
||||
int64_t startTime = rtc::TimeMillis();
|
||||
while (rtc::TimeMillis() - startTime < kMaxWaitDecTimeMs) {
|
||||
if (decode_complete_callback_->DecodeComplete()) {
|
||||
return CalcBufferSize(kI420, decoded_frame_.width(),
|
||||
decoded_frame_.height());
|
||||
return CalcBufferSize(kI420, decoded_frame_->width(),
|
||||
decoded_frame_->height());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -202,7 +203,7 @@ class TestVp8Impl : public ::testing::Test {
|
||||
std::unique_ptr<VideoEncoder> encoder_;
|
||||
std::unique_ptr<VideoDecoder> decoder_;
|
||||
EncodedImage encoded_frame_;
|
||||
VideoFrame decoded_frame_;
|
||||
rtc::Optional<VideoFrame> decoded_frame_;
|
||||
VideoCodec codec_inst_;
|
||||
TemporalLayersFactory tl_factory_;
|
||||
};
|
||||
@ -252,10 +253,11 @@ TEST_F(TestVp8Impl, MAYBE_AlignedStrideEncodeDecode) {
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame_, false, NULL));
|
||||
EXPECT_GT(WaitForDecodedFrame(), 0u);
|
||||
ASSERT_TRUE(decoded_frame_);
|
||||
// Compute PSNR on all planes (faster than SSIM).
|
||||
EXPECT_GT(I420PSNR(input_frame_.get(), &decoded_frame_), 36);
|
||||
EXPECT_EQ(kTestTimestamp, decoded_frame_.timestamp());
|
||||
EXPECT_EQ(kTestNtpTimeMs, decoded_frame_.ntp_time_ms());
|
||||
EXPECT_GT(I420PSNR(input_frame_.get(), &*decoded_frame_), 36);
|
||||
EXPECT_EQ(kTestTimestamp, decoded_frame_->timestamp());
|
||||
EXPECT_EQ(kTestNtpTimeMs, decoded_frame_->ntp_time_ms());
|
||||
}
|
||||
|
||||
#if defined(WEBRTC_ANDROID)
|
||||
@ -280,7 +282,8 @@ TEST_F(TestVp8Impl, MAYBE_DecodeWithACompleteKeyFrame) {
|
||||
encoded_frame_._frameType = kVideoFrameKey;
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame_, false, NULL));
|
||||
EXPECT_GT(I420PSNR(input_frame_.get(), &decoded_frame_), 36);
|
||||
ASSERT_TRUE(decoded_frame_);
|
||||
EXPECT_GT(I420PSNR(input_frame_.get(), &*decoded_frame_), 36);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -660,8 +660,6 @@ int VP8EncoderImpl::Encode(const VideoFrame& frame,
|
||||
|
||||
if (!inited_)
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
if (frame.IsZeroSize())
|
||||
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
||||
if (encoded_complete_callback_ == NULL)
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
|
||||
|
||||
@ -486,9 +486,6 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image,
|
||||
if (!inited_) {
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
}
|
||||
if (input_image.IsZeroSize()) {
|
||||
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
||||
}
|
||||
if (encoded_complete_callback_ == NULL) {
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user