Changed argument occurences of const I420VideoFrame* to const I420VideoFrame& and non-const I420VideoFrame& to I420VideoFrame*.
R=magjed@webrtc.org, tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/40299004 Cr-Commit-Position: refs/heads/master@{#8731} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8731 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -215,7 +215,7 @@ int I420Decoder::Decode(const EncodedImage& inputImage, bool /*missingFrames*/,
|
||||
}
|
||||
_decodedImage.set_timestamp(inputImage._timeStamp);
|
||||
|
||||
_decodeCompleteCallback->Decoded(_decodedImage);
|
||||
_decodeCompleteCallback->Decoded(&_decodedImage);
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ class MockVideoEncoder : public VideoEncoder {
|
||||
class MockDecodedImageCallback : public DecodedImageCallback {
|
||||
public:
|
||||
MOCK_METHOD1(Decoded,
|
||||
int32_t(I420VideoFrame& decodedImage));
|
||||
int32_t(I420VideoFrame* decodedImage));
|
||||
MOCK_METHOD1(ReceivedDecodedReferenceFrame,
|
||||
int32_t(const uint64_t pictureId));
|
||||
MOCK_METHOD1(ReceivedDecodedFrame,
|
||||
|
||||
@ -413,8 +413,8 @@ VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::Encoded(
|
||||
}
|
||||
int32_t
|
||||
VideoProcessorImpl::VideoProcessorDecodeCompleteCallback::Decoded(
|
||||
I420VideoFrame& image) {
|
||||
video_processor_->FrameDecoded(image); // forward to parent class
|
||||
I420VideoFrame* image) {
|
||||
video_processor_->FrameDecoded(*image); // forward to parent class
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -241,7 +241,7 @@ class VideoProcessorImpl : public VideoProcessor {
|
||||
explicit VideoProcessorDecodeCompleteCallback(VideoProcessorImpl* vp)
|
||||
: video_processor_(vp) {
|
||||
}
|
||||
int32_t Decoded(webrtc::I420VideoFrame& image) override;
|
||||
int32_t Decoded(webrtc::I420VideoFrame* image) override;
|
||||
|
||||
private:
|
||||
VideoProcessorImpl* video_processor_;
|
||||
|
||||
@ -124,16 +124,16 @@ class Vp8TestDecodedImageCallback : public DecodedImageCallback {
|
||||
Vp8TestDecodedImageCallback()
|
||||
: decoded_frames_(0) {
|
||||
}
|
||||
virtual int32_t Decoded(I420VideoFrame& decoded_image) {
|
||||
last_decoded_frame_.CopyFrame(decoded_image);
|
||||
for (int i = 0; i < decoded_image.width(); ++i) {
|
||||
EXPECT_NEAR(kColorY, decoded_image.buffer(kYPlane)[i], 1);
|
||||
virtual int32_t Decoded(I420VideoFrame* decoded_image) {
|
||||
last_decoded_frame_.CopyFrame(*decoded_image);
|
||||
for (int i = 0; i < decoded_image->width(); ++i) {
|
||||
EXPECT_NEAR(kColorY, decoded_image->buffer(kYPlane)[i], 1);
|
||||
}
|
||||
|
||||
// TODO(mikhal): Verify the difference between U,V and the original.
|
||||
for (int i = 0; i < ((decoded_image.width() + 1) / 2); ++i) {
|
||||
EXPECT_NEAR(kColorU, decoded_image.buffer(kUPlane)[i], 4);
|
||||
EXPECT_NEAR(kColorV, decoded_image.buffer(kVPlane)[i], 4);
|
||||
for (int i = 0; i < ((decoded_image->width() + 1) / 2); ++i) {
|
||||
EXPECT_NEAR(kColorU, decoded_image->buffer(kUPlane)[i], 4);
|
||||
EXPECT_NEAR(kColorV, decoded_image->buffer(kVPlane)[i], 4);
|
||||
}
|
||||
decoded_frames_++;
|
||||
return 0;
|
||||
|
||||
@ -78,7 +78,7 @@ class Vp8UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback {
|
||||
public:
|
||||
explicit Vp8UnitTestDecodeCompleteCallback(I420VideoFrame* frame)
|
||||
: decoded_frame_(frame), decode_complete(false) {}
|
||||
int Decoded(webrtc::I420VideoFrame& frame);
|
||||
int Decoded(webrtc::I420VideoFrame* frame);
|
||||
bool DecodeComplete();
|
||||
|
||||
private:
|
||||
@ -94,8 +94,8 @@ bool Vp8UnitTestDecodeCompleteCallback::DecodeComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int Vp8UnitTestDecodeCompleteCallback::Decoded(I420VideoFrame& image) {
|
||||
decoded_frame_->CopyFrame(image);
|
||||
int Vp8UnitTestDecodeCompleteCallback::Decoded(I420VideoFrame* image) {
|
||||
decoded_frame_->CopyFrame(*image);
|
||||
decode_complete = true;
|
||||
return 0;
|
||||
}
|
||||
@ -227,7 +227,7 @@ TEST_F(TestVp8Impl, DISABLED_ON_ANDROID(AlignedStrideEncodeDecode)) {
|
||||
decoder_->Decode(encoded_frame_, false, NULL));
|
||||
EXPECT_GT(WaitForDecodedFrame(), 0u);
|
||||
// Compute PSNR on all planes (faster than SSIM).
|
||||
EXPECT_GT(I420PSNR(&input_frame_, &decoded_frame_), 36);
|
||||
EXPECT_GT(I420PSNR(input_frame_, decoded_frame_), 36);
|
||||
EXPECT_EQ(kTestTimestamp, decoded_frame_.timestamp());
|
||||
EXPECT_EQ(kTestNtpTimeMs, decoded_frame_.ntp_time_ms());
|
||||
}
|
||||
@ -249,7 +249,7 @@ TEST_F(TestVp8Impl, DISABLED_ON_ANDROID(DecodeWithACompleteKeyFrame)) {
|
||||
encoded_frame_._frameType = kKeyFrame;
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame_, false, NULL));
|
||||
EXPECT_GT(I420PSNR(&input_frame_, &decoded_frame_), 36);
|
||||
EXPECT_GT(I420PSNR(input_frame_, decoded_frame_), 36);
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, TestReset) {
|
||||
|
||||
@ -1346,7 +1346,7 @@ int VP8DecoderImpl::ReturnFrame(const vpx_image_t* img,
|
||||
img->stride[VPX_PLANE_V]);
|
||||
decoded_image_.set_timestamp(timestamp);
|
||||
decoded_image_.set_ntp_time_ms(ntp_time_ms);
|
||||
int ret = decode_complete_callback_->Decoded(decoded_image_);
|
||||
int ret = decode_complete_callback_->Decoded(&decoded_image_);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@ -68,15 +68,15 @@ class Vp8SequenceCoderDecodeCallback : public webrtc::DecodedImageCallback {
|
||||
public:
|
||||
explicit Vp8SequenceCoderDecodeCallback(FILE* decoded_file)
|
||||
: decoded_file_(decoded_file) {}
|
||||
int Decoded(webrtc::I420VideoFrame& frame);
|
||||
int Decoded(webrtc::I420VideoFrame* frame);
|
||||
bool DecodeComplete();
|
||||
|
||||
private:
|
||||
FILE* decoded_file_;
|
||||
};
|
||||
|
||||
int Vp8SequenceCoderDecodeCallback::Decoded(webrtc::I420VideoFrame& image) {
|
||||
EXPECT_EQ(0, webrtc::PrintI420VideoFrame(image, decoded_file_));
|
||||
int Vp8SequenceCoderDecodeCallback::Decoded(webrtc::I420VideoFrame* image) {
|
||||
EXPECT_EQ(0, webrtc::PrintI420VideoFrame(*image, decoded_file_));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -484,7 +484,7 @@ int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img, uint32_t timestamp) {
|
||||
img->stride[VPX_PLANE_U],
|
||||
img->stride[VPX_PLANE_V]);
|
||||
decoded_image_.set_timestamp(timestamp);
|
||||
int ret = decode_complete_callback_->Decoded(decoded_image_);
|
||||
int ret = decode_complete_callback_->Decoded(&decoded_image_);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
|
||||
@ -81,7 +81,7 @@ class VCMPacketizationCallback {
|
||||
// Callback class used for passing decoded frames which are ready to be rendered.
|
||||
class VCMReceiveCallback {
|
||||
public:
|
||||
virtual int32_t FrameToRender(I420VideoFrame& videoFrame) = 0;
|
||||
virtual int32_t FrameToRender(I420VideoFrame* videoFrame) = 0;
|
||||
virtual int32_t ReceivedDecodedReferenceFrame(
|
||||
const uint64_t pictureId) {
|
||||
return -1;
|
||||
|
||||
@ -46,7 +46,7 @@ VCMReceiveCallback* VCMDecodedFrameCallback::UserReceiveCallback()
|
||||
return _receiveCallback;
|
||||
}
|
||||
|
||||
int32_t VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage)
|
||||
int32_t VCMDecodedFrameCallback::Decoded(I420VideoFrame* decodedImage)
|
||||
{
|
||||
// TODO(holmer): We should improve this so that we can handle multiple
|
||||
// callbacks from one call to Decode().
|
||||
@ -55,7 +55,7 @@ int32_t VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage)
|
||||
{
|
||||
CriticalSectionScoped cs(_critSect);
|
||||
frameInfo = static_cast<VCMFrameInformation*>(
|
||||
_timestampMap.Pop(decodedImage.timestamp()));
|
||||
_timestampMap.Pop(decodedImage->timestamp()));
|
||||
callback = _receiveCallback;
|
||||
}
|
||||
|
||||
@ -66,14 +66,14 @@ int32_t VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage)
|
||||
}
|
||||
|
||||
_timing.StopDecodeTimer(
|
||||
decodedImage.timestamp(),
|
||||
decodedImage->timestamp(),
|
||||
frameInfo->decodeStartTimeMs,
|
||||
_clock->TimeInMilliseconds(),
|
||||
frameInfo->renderTimeMs);
|
||||
|
||||
if (callback != NULL)
|
||||
{
|
||||
decodedImage.set_render_time_ms(frameInfo->renderTimeMs);
|
||||
decodedImage->set_render_time_ms(frameInfo->renderTimeMs);
|
||||
callback->FrameToRender(decodedImage);
|
||||
}
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
|
||||
@ -39,7 +39,7 @@ public:
|
||||
void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback);
|
||||
VCMReceiveCallback* UserReceiveCallback();
|
||||
|
||||
virtual int32_t Decoded(I420VideoFrame& decodedImage);
|
||||
virtual int32_t Decoded(I420VideoFrame* decodedImage);
|
||||
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId);
|
||||
virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId);
|
||||
|
||||
|
||||
@ -147,13 +147,13 @@ VCMNTDecodeCompleteCallback::~VCMNTDecodeCompleteCallback()
|
||||
fclose(_decodedFile);
|
||||
}
|
||||
int32_t
|
||||
VCMNTDecodeCompleteCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame)
|
||||
VCMNTDecodeCompleteCallback::FrameToRender(webrtc::I420VideoFrame* videoFrame)
|
||||
{
|
||||
if (videoFrame.width() != _currentWidth ||
|
||||
videoFrame.height() != _currentHeight)
|
||||
if (videoFrame->width() != _currentWidth ||
|
||||
videoFrame->height() != _currentHeight)
|
||||
{
|
||||
_currentWidth = videoFrame.width();
|
||||
_currentHeight = videoFrame.height();
|
||||
_currentWidth = videoFrame->width();
|
||||
_currentHeight = videoFrame->height();
|
||||
if (_decodedFile != NULL)
|
||||
{
|
||||
fclose(_decodedFile);
|
||||
@ -161,11 +161,11 @@ VCMNTDecodeCompleteCallback::FrameToRender(webrtc::I420VideoFrame& videoFrame)
|
||||
}
|
||||
_decodedFile = fopen(_outname.c_str(), "wb");
|
||||
}
|
||||
if (PrintI420VideoFrame(videoFrame, _decodedFile) < 0) {
|
||||
if (PrintI420VideoFrame(*videoFrame, _decodedFile) < 0) {
|
||||
return -1;
|
||||
}
|
||||
_decodedBytes += webrtc::CalcBufferSize(webrtc::kI420, videoFrame.width(),
|
||||
videoFrame.height());
|
||||
_decodedBytes += webrtc::CalcBufferSize(webrtc::kI420, videoFrame->width(),
|
||||
videoFrame->height());
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback);
|
||||
|
||||
// will write decoded frame into file
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame) override;
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame* videoFrame) override;
|
||||
|
||||
size_t DecodedBytes();
|
||||
private:
|
||||
|
||||
@ -237,7 +237,7 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
_vcm->EnableFrameDropper(false);
|
||||
|
||||
I420VideoFrame sourceFrame;
|
||||
I420VideoFrame *decimatedFrame = NULL;
|
||||
I420VideoFrame* decimatedFrame = NULL;
|
||||
uint8_t* tmpBuffer = new uint8_t[_lengthSourceFrame];
|
||||
double startTime = clock()/(double)CLOCKS_PER_SEC;
|
||||
_vcm->SetChannelParameters(static_cast<uint32_t>(1000 * _bitRate), 0, 0);
|
||||
@ -483,18 +483,18 @@ VCMQMDecodeCompleteCallback::~VCMQMDecodeCompleteCallback()
|
||||
}
|
||||
|
||||
int32_t
|
||||
VCMQMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
VCMQMDecodeCompleteCallback::FrameToRender(I420VideoFrame* videoFrame)
|
||||
{
|
||||
++frames_cnt_since_drop_;
|
||||
|
||||
// When receiving the first coded frame the last_frame variable is not set
|
||||
if (last_frame_.IsZeroSize()) {
|
||||
last_frame_.CopyFrame(videoFrame);
|
||||
last_frame_.CopyFrame(*videoFrame);
|
||||
}
|
||||
|
||||
// Check if there were frames skipped.
|
||||
int num_frames_skipped = static_cast<int>( 0.5f +
|
||||
(videoFrame.timestamp() - (last_frame_.timestamp() + (9e4 / frame_rate_))) /
|
||||
(videoFrame->timestamp() - (last_frame_.timestamp() + (9e4 / frame_rate_))) /
|
||||
(9e4 / frame_rate_));
|
||||
|
||||
// If so...put the last frames into the encoded stream to make up for the
|
||||
@ -510,9 +510,9 @@ VCMQMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
DataLog::InsertCell(
|
||||
feature_table_name_,"num frames since drop",frames_cnt_since_drop_);
|
||||
|
||||
if (_origWidth == videoFrame.width() && _origHeight == videoFrame.height())
|
||||
if (_origWidth == videoFrame->width() && _origHeight == videoFrame->height())
|
||||
{
|
||||
if (PrintI420VideoFrame(videoFrame, _decodedFile) < 0) {
|
||||
if (PrintI420VideoFrame(*videoFrame, _decodedFile) < 0) {
|
||||
return -1;
|
||||
}
|
||||
_frameCnt++;
|
||||
@ -531,9 +531,9 @@ VCMQMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
return -1;
|
||||
}
|
||||
|
||||
_decodedBytes += CalcBufferSize(kI420, videoFrame.width(),
|
||||
videoFrame.height());
|
||||
videoFrame.SwapFrame(&last_frame_);
|
||||
_decodedBytes += CalcBufferSize(kI420, videoFrame->width(),
|
||||
videoFrame->height());
|
||||
videoFrame->SwapFrame(&last_frame_);
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ public:
|
||||
virtual ~VCMQMDecodeCompleteCallback();
|
||||
void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback);
|
||||
// will write decoded frame into file
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame);
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame* videoFrame);
|
||||
size_t DecodedBytes();
|
||||
void SetOriginalFrameDimensions(int32_t width, int32_t height);
|
||||
int32_t buildInterpolator();
|
||||
|
||||
@ -185,13 +185,13 @@ VCMRTPEncodeCompleteCallback::EncodeComplete()
|
||||
// Decoded Frame Callback Implementation
|
||||
|
||||
int32_t
|
||||
VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame& videoFrame)
|
||||
VCMDecodeCompleteCallback::FrameToRender(I420VideoFrame* videoFrame)
|
||||
{
|
||||
if (PrintI420VideoFrame(videoFrame, _decodedFile) < 0) {
|
||||
if (PrintI420VideoFrame(*videoFrame, _decodedFile) < 0) {
|
||||
return -1;
|
||||
}
|
||||
_decodedBytes += CalcBufferSize(kI420, videoFrame.width(),
|
||||
videoFrame.height());
|
||||
_decodedBytes += CalcBufferSize(kI420, videoFrame->width(),
|
||||
videoFrame->height());
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ public:
|
||||
_decodedFile(decodedFile), _decodedBytes(0) {}
|
||||
virtual ~VCMDecodeCompleteCallback() {}
|
||||
// Write decoded frame into file
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame) override;
|
||||
int32_t FrameToRender(webrtc::I420VideoFrame* videoFrame) override;
|
||||
size_t DecodedBytes();
|
||||
private:
|
||||
FILE* _decodedFile;
|
||||
|
||||
@ -113,7 +113,7 @@ FileOutputFrameReceiver::~FileOutputFrameReceiver() {
|
||||
}
|
||||
|
||||
int32_t FileOutputFrameReceiver::FrameToRender(
|
||||
webrtc::I420VideoFrame& video_frame) {
|
||||
webrtc::I420VideoFrame* video_frame) {
|
||||
if (timing_file_ == NULL) {
|
||||
std::string basename;
|
||||
std::string extension;
|
||||
@ -123,14 +123,14 @@ int32_t FileOutputFrameReceiver::FrameToRender(
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (out_file_ == NULL || video_frame.width() != width_ ||
|
||||
video_frame.height() != height_) {
|
||||
if (out_file_ == NULL || video_frame->width() != width_ ||
|
||||
video_frame->height() != height_) {
|
||||
if (out_file_) {
|
||||
fclose(out_file_);
|
||||
}
|
||||
printf("New size: %dx%d\n", video_frame.width(), video_frame.height());
|
||||
width_ = video_frame.width();
|
||||
height_ = video_frame.height();
|
||||
printf("New size: %dx%d\n", video_frame->width(), video_frame->height());
|
||||
width_ = video_frame->width();
|
||||
height_ = video_frame->height();
|
||||
std::string filename_with_width_height = AppendWidthHeightCount(
|
||||
out_filename_, width_, height_, count_);
|
||||
++count_;
|
||||
@ -139,9 +139,9 @@ int32_t FileOutputFrameReceiver::FrameToRender(
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
fprintf(timing_file_, "%u, %u\n", video_frame.timestamp(),
|
||||
webrtc::MaskWord64ToUWord32(video_frame.render_time_ms()));
|
||||
if (PrintI420VideoFrame(video_frame, out_file_) < 0) {
|
||||
fprintf(timing_file_, "%u, %u\n", video_frame->timestamp(),
|
||||
webrtc::MaskWord64ToUWord32(video_frame->render_time_ms()));
|
||||
if (PrintI420VideoFrame(*video_frame, out_file_) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -87,7 +87,7 @@ class FileOutputFrameReceiver : public webrtc::VCMReceiveCallback {
|
||||
virtual ~FileOutputFrameReceiver();
|
||||
|
||||
// VCMReceiveCallback
|
||||
virtual int32_t FrameToRender(webrtc::I420VideoFrame& video_frame);
|
||||
virtual int32_t FrameToRender(webrtc::I420VideoFrame* video_frame);
|
||||
|
||||
private:
|
||||
std::string out_filename_;
|
||||
|
||||
Reference in New Issue
Block a user