I420VideoFrame.CreateFrame: Removed unnecessary buffer size arguments.
R=magjed@webrtc.org, tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/45629004 Cr-Commit-Position: refs/heads/master@{#8732} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8732 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
2dc5fa69b2
commit
93d9d6503e
@ -581,9 +581,8 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs(
|
||||
// Create yuv420 frame.
|
||||
if (color_format == COLOR_FormatYUV420Planar) {
|
||||
decoded_image_.CreateFrame(
|
||||
stride * slice_height, payload,
|
||||
(stride * slice_height) / 4, payload + (stride * slice_height),
|
||||
(stride * slice_height) / 4,
|
||||
payload,
|
||||
payload + (stride * slice_height),
|
||||
payload + (5 * stride * slice_height / 4),
|
||||
width, height,
|
||||
stride, stride / 2, stride / 2);
|
||||
|
@ -80,21 +80,20 @@ int I420VideoFrame::CreateEmptyFrame(int width, int height,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int I420VideoFrame::CreateFrame(int size_y, const uint8_t* buffer_y,
|
||||
int size_u, const uint8_t* buffer_u,
|
||||
int size_v, const uint8_t* buffer_v,
|
||||
int I420VideoFrame::CreateFrame(const uint8_t* buffer_y,
|
||||
const uint8_t* buffer_u,
|
||||
const uint8_t* buffer_v,
|
||||
int width, int height,
|
||||
int stride_y, int stride_u, int stride_v) {
|
||||
return CreateFrame(size_y, buffer_y, size_u, buffer_u, size_v, buffer_v,
|
||||
int stride_y,
|
||||
int stride_u,
|
||||
int stride_v) {
|
||||
return CreateFrame(buffer_y, buffer_u, buffer_v,
|
||||
width, height, stride_y, stride_u, stride_v,
|
||||
kVideoRotation_0);
|
||||
}
|
||||
|
||||
int I420VideoFrame::CreateFrame(int size_y,
|
||||
const uint8_t* buffer_y,
|
||||
int size_u,
|
||||
int I420VideoFrame::CreateFrame(const uint8_t* buffer_y,
|
||||
const uint8_t* buffer_u,
|
||||
int size_v,
|
||||
const uint8_t* buffer_v,
|
||||
int width,
|
||||
int height,
|
||||
@ -106,9 +105,6 @@ int I420VideoFrame::CreateFrame(int size_y,
|
||||
const int expected_size_y = height * stride_y;
|
||||
const int expected_size_u = half_height * stride_u;
|
||||
const int expected_size_v = half_height * stride_v;
|
||||
CHECK_GE(size_y, expected_size_y);
|
||||
CHECK_GE(size_u, expected_size_u);
|
||||
CHECK_GE(size_v, expected_size_v);
|
||||
if (CreateEmptyFrame(width, height, stride_y, stride_u, stride_v) < 0)
|
||||
return -1;
|
||||
memcpy(buffer(kYPlane), buffer_y, expected_size_y);
|
||||
@ -123,9 +119,9 @@ int I420VideoFrame::CopyFrame(const I420VideoFrame& videoFrame) {
|
||||
video_frame_buffer_ = videoFrame.video_frame_buffer();
|
||||
} else {
|
||||
int ret = CreateFrame(
|
||||
videoFrame.allocated_size(kYPlane), videoFrame.buffer(kYPlane),
|
||||
videoFrame.allocated_size(kUPlane), videoFrame.buffer(kUPlane),
|
||||
videoFrame.allocated_size(kVPlane), videoFrame.buffer(kVPlane),
|
||||
videoFrame.buffer(kYPlane),
|
||||
videoFrame.buffer(kUPlane),
|
||||
videoFrame.buffer(kVPlane),
|
||||
videoFrame.width(), videoFrame.height(), videoFrame.stride(kYPlane),
|
||||
videoFrame.stride(kUPlane), videoFrame.stride(kVPlane));
|
||||
if (ret < 0)
|
||||
|
@ -112,8 +112,8 @@ TEST(TestI420VideoFrame, CopyFrame) {
|
||||
memset(buffer_v, 4, kSizeV);
|
||||
I420VideoFrame big_frame;
|
||||
EXPECT_EQ(0,
|
||||
big_frame.CreateFrame(kSizeY, buffer_y, kSizeU, buffer_u, kSizeV,
|
||||
buffer_v, width + 5, height + 5, stride_y + 5,
|
||||
big_frame.CreateFrame(buffer_y, buffer_u, buffer_v,
|
||||
width + 5, height + 5, stride_y + 5,
|
||||
stride_u, stride_v, kRotation));
|
||||
// Frame of smaller dimensions.
|
||||
EXPECT_EQ(0, small_frame.CopyFrame(big_frame));
|
||||
@ -157,8 +157,7 @@ TEST(TestI420VideoFrame, CloneFrame) {
|
||||
memset(buffer_y, 16, kSizeY);
|
||||
memset(buffer_u, 8, kSizeU);
|
||||
memset(buffer_v, 4, kSizeV);
|
||||
frame1.CreateFrame(
|
||||
kSizeY, buffer_y, kSizeU, buffer_u, kSizeV, buffer_v, 20, 20, 20, 10, 10);
|
||||
frame1.CreateFrame(buffer_y, buffer_u, buffer_v, 20, 20, 20, 10, 10);
|
||||
frame1.set_timestamp(1);
|
||||
frame1.set_ntp_time_ms(2);
|
||||
frame1.set_render_time_ms(3);
|
||||
@ -184,9 +183,7 @@ TEST(TestI420VideoFrame, CopyBuffer) {
|
||||
memset(buffer_y, 16, kSizeY);
|
||||
memset(buffer_u, 8, kSizeUv);
|
||||
memset(buffer_v, 4, kSizeUv);
|
||||
frame2.CreateFrame(kSizeY, buffer_y,
|
||||
kSizeUv, buffer_u,
|
||||
kSizeUv, buffer_v,
|
||||
frame2.CreateFrame(buffer_y, buffer_u, buffer_v,
|
||||
width, height, stride_y, stride_uv, stride_uv);
|
||||
// Expect exactly the same pixel data.
|
||||
EXPECT_TRUE(EqualPlane(buffer_y, frame2.buffer(kYPlane), stride_y, 15, 15));
|
||||
@ -236,9 +233,7 @@ TEST(TestI420VideoFrame, FrameSwap) {
|
||||
memset(buffer_y1, 2, kSizeY1);
|
||||
memset(buffer_u1, 4, kSizeU1);
|
||||
memset(buffer_v1, 8, kSizeV1);
|
||||
frame1.CreateFrame(kSizeY1, buffer_y1,
|
||||
kSizeU1, buffer_u1,
|
||||
kSizeV1, buffer_v1,
|
||||
frame1.CreateFrame(buffer_y1, buffer_u1, buffer_v1,
|
||||
width1, height1, stride_y1, stride_u1, stride_v1);
|
||||
// Initialize frame2 values.
|
||||
EXPECT_EQ(0, frame2.CreateEmptyFrame(width2, height2,
|
||||
@ -253,9 +248,7 @@ TEST(TestI420VideoFrame, FrameSwap) {
|
||||
memset(buffer_y2, 0, kSizeY2);
|
||||
memset(buffer_u2, 1, kSizeU2);
|
||||
memset(buffer_v2, 2, kSizeV2);
|
||||
frame2.CreateFrame(kSizeY2, buffer_y2,
|
||||
kSizeU2, buffer_u2,
|
||||
kSizeV2, buffer_v2,
|
||||
frame2.CreateFrame(buffer_y2, buffer_u2, buffer_v2,
|
||||
width2, height2, stride_y2, stride_u2, stride_v2);
|
||||
// Copy frames for subsequent comparison.
|
||||
I420VideoFrame frame1_copy, frame2_copy;
|
||||
|
@ -110,9 +110,9 @@ void TestLibYuv::SetUp() {
|
||||
|
||||
EXPECT_EQ(frame_length_,
|
||||
fread(orig_buffer_.get(), 1, frame_length_, source_file_));
|
||||
EXPECT_EQ(0, orig_frame_.CreateFrame(size_y_, orig_buffer_.get(),
|
||||
size_uv_, orig_buffer_.get() + size_y_,
|
||||
size_uv_, orig_buffer_.get() +
|
||||
EXPECT_EQ(0, orig_frame_.CreateFrame(orig_buffer_.get(),
|
||||
orig_buffer_.get() + size_y_,
|
||||
orig_buffer_.get() +
|
||||
size_y_ + size_uv_,
|
||||
width_, height_,
|
||||
width_, (width_ + 1) / 2,
|
||||
@ -197,9 +197,9 @@ TEST_F(TestLibYuv, ConvertTest) {
|
||||
rtc::scoped_ptr<uint8_t[]> res_i420_buffer(new uint8_t[frame_length_]);
|
||||
I420VideoFrame yv12_frame;
|
||||
EXPECT_EQ(0, ConvertFromI420(orig_frame_, kYV12, 0, outYV120Buffer.get()));
|
||||
yv12_frame.CreateFrame(size_y_, outYV120Buffer.get(),
|
||||
size_uv_, outYV120Buffer.get() + size_y_,
|
||||
size_uv_, outYV120Buffer.get() + size_y_ + size_uv_,
|
||||
yv12_frame.CreateFrame(outYV120Buffer.get(),
|
||||
outYV120Buffer.get() + size_y_,
|
||||
outYV120Buffer.get() + size_y_ + size_uv_,
|
||||
width_, height_,
|
||||
width_, (width_ + 1) / 2, (width_ + 1) / 2);
|
||||
EXPECT_EQ(0, ConvertFromYV12(yv12_frame, kI420, 0, res_i420_buffer.get()));
|
||||
|
@ -101,9 +101,9 @@ TEST_F(TestScaler, ScaleSendingBufferTooSmall) {
|
||||
I420VideoFrame test_frame2;
|
||||
rtc::scoped_ptr<uint8_t[]> orig_buffer(new uint8_t[frame_length_]);
|
||||
EXPECT_GT(fread(orig_buffer.get(), 1, frame_length_, source_file_), 0U);
|
||||
test_frame_.CreateFrame(size_y_, orig_buffer.get(),
|
||||
size_uv_, orig_buffer.get() + size_y_,
|
||||
size_uv_, orig_buffer.get() + size_y_ + size_uv_,
|
||||
test_frame_.CreateFrame(orig_buffer.get(),
|
||||
orig_buffer.get() + size_y_,
|
||||
orig_buffer.get() + size_y_ + size_uv_,
|
||||
width_, height_,
|
||||
width_, half_width_, half_width_);
|
||||
EXPECT_EQ(0, test_scaler_.Scale(test_frame_, &test_frame2));
|
||||
@ -353,9 +353,9 @@ void TestScaler::ScaleSequence(ScaleMethod method,
|
||||
src_required_size)
|
||||
break;
|
||||
|
||||
input_frame.CreateFrame(size_y, frame_buffer.get(),
|
||||
size_uv, frame_buffer.get() + size_y,
|
||||
size_uv, frame_buffer.get() + size_y + size_uv,
|
||||
input_frame.CreateFrame(frame_buffer.get(),
|
||||
frame_buffer.get() + size_y,
|
||||
frame_buffer.get() + size_y + size_uv,
|
||||
src_width, src_height,
|
||||
src_width, (src_width + 1) / 2,
|
||||
(src_width + 1) / 2);
|
||||
|
@ -185,9 +185,9 @@ bool VideoProcessorImpl::ProcessFrame(int frame_number) {
|
||||
int half_width = (config_.codec_settings->width + 1) / 2;
|
||||
int half_height = (config_.codec_settings->height + 1) / 2;
|
||||
int size_uv = half_width * half_height;
|
||||
source_frame_.CreateFrame(size_y, source_buffer_,
|
||||
size_uv, source_buffer_ + size_y,
|
||||
size_uv, source_buffer_ + size_y + size_uv,
|
||||
source_frame_.CreateFrame(source_buffer_,
|
||||
source_buffer_ + size_y,
|
||||
source_buffer_ + size_y + size_uv,
|
||||
config_.codec_settings->width,
|
||||
config_.codec_settings->height,
|
||||
config_.codec_settings->width,
|
||||
|
@ -1333,13 +1333,10 @@ int VP8DecoderImpl::ReturnFrame(const vpx_image_t* img,
|
||||
last_frame_width_ = img->d_w;
|
||||
last_frame_height_ = img->d_h;
|
||||
// Allocate memory for decoded image.
|
||||
int size_y = img->stride[VPX_PLANE_Y] * img->d_h;
|
||||
int size_u = img->stride[VPX_PLANE_U] * (img->d_h + 1) / 2;
|
||||
int size_v = img->stride[VPX_PLANE_V] * (img->d_h + 1) / 2;
|
||||
// TODO(mikhal): This does a copy - need to SwapBuffers.
|
||||
decoded_image_.CreateFrame(size_y, img->planes[VPX_PLANE_Y],
|
||||
size_u, img->planes[VPX_PLANE_U],
|
||||
size_v, img->planes[VPX_PLANE_V],
|
||||
decoded_image_.CreateFrame(img->planes[VPX_PLANE_Y],
|
||||
img->planes[VPX_PLANE_U],
|
||||
img->planes[VPX_PLANE_V],
|
||||
img->d_w, img->d_h,
|
||||
img->stride[VPX_PLANE_Y],
|
||||
img->stride[VPX_PLANE_U],
|
||||
|
@ -472,13 +472,9 @@ int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img, uint32_t timestamp) {
|
||||
// Decoder OK and NULL image => No show frame.
|
||||
return WEBRTC_VIDEO_CODEC_NO_OUTPUT;
|
||||
}
|
||||
int half_height = (img->d_h + 1) / 2;
|
||||
int size_y = img->stride[VPX_PLANE_Y] * img->d_h;
|
||||
int size_u = img->stride[VPX_PLANE_U] * half_height;
|
||||
int size_v = img->stride[VPX_PLANE_V] * half_height;
|
||||
decoded_image_.CreateFrame(size_y, img->planes[VPX_PLANE_Y],
|
||||
size_u, img->planes[VPX_PLANE_U],
|
||||
size_v, img->planes[VPX_PLANE_V],
|
||||
decoded_image_.CreateFrame(img->planes[VPX_PLANE_Y],
|
||||
img->planes[VPX_PLANE_U],
|
||||
img->planes[VPX_PLANE_V],
|
||||
img->d_w, img->d_h,
|
||||
img->stride[VPX_PLANE_Y],
|
||||
img->stride[VPX_PLANE_U],
|
||||
|
@ -120,9 +120,9 @@ CodecDataBaseTest::Perform(CmdArgs& args)
|
||||
int half_height = (_height + 1) / 2;
|
||||
int size_y = _width * _height;
|
||||
int size_uv = half_width * half_height;
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (uint32_t)(9e4 / _frameRate);
|
||||
@ -333,9 +333,9 @@ CodecDataBaseTest::Perform(CmdArgs& args)
|
||||
{
|
||||
frameCnt++;
|
||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (uint32_t)(9e4 / _frameRate);
|
||||
|
@ -149,9 +149,9 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
int half_height = (_height + 1) / 2;
|
||||
int size_y = _width * _height;
|
||||
int size_uv = half_width * half_height;
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
sourceFrame.set_timestamp(_timeStamp++);
|
||||
@ -197,9 +197,9 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
for (i = 0; i < _frameRate; i++)
|
||||
{
|
||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
@ -322,9 +322,9 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
_lengthSourceFrame)
|
||||
{
|
||||
_frameCnt++;
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, (_width + 1) / 2,
|
||||
(_width + 1) / 2);
|
||||
@ -387,9 +387,9 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
{
|
||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
|
||||
_frameCnt++;
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
@ -441,9 +441,9 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
rewind(_sourceFile);
|
||||
while (fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) ==
|
||||
_lengthSourceFrame) {
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
|
@ -319,9 +319,9 @@ MediaOptTest::Perform()
|
||||
{
|
||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
|
||||
_frameCnt++;
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
|
||||
|
@ -63,9 +63,9 @@ MainSenderThread(void* obj)
|
||||
int half_width = (width + 1) / 2;
|
||||
int half_height = (height + 1) / 2;
|
||||
int size_uv = half_width * half_height;
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
width, height,
|
||||
width, half_width, half_width);
|
||||
state->_timestamp += (uint32_t)(9e4 / frameRate);
|
||||
|
@ -286,9 +286,9 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0 ||
|
||||
feof(_sourceFile));
|
||||
_frameCnt++;
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_width, _height,
|
||||
_width, half_width, half_width);
|
||||
_timeStamp +=
|
||||
|
@ -265,9 +265,9 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
_frameCnt++;
|
||||
int size_y = _nativeWidth * _nativeHeight;
|
||||
int size_uv = ((_nativeWidth + 1) / 2) * ((_nativeHeight + 1) / 2);
|
||||
sourceFrame.CreateFrame(size_y, tmpBuffer,
|
||||
size_uv, tmpBuffer + size_y,
|
||||
size_uv, tmpBuffer + size_y + size_uv,
|
||||
sourceFrame.CreateFrame(tmpBuffer,
|
||||
tmpBuffer + size_y,
|
||||
tmpBuffer + size_y + size_uv,
|
||||
_nativeWidth, _nativeHeight,
|
||||
_nativeWidth, (_nativeWidth + 1) / 2,
|
||||
(_nativeWidth + 1) / 2);
|
||||
|
@ -1090,14 +1090,10 @@ void ExpectEqualFramesVector(const std::vector<I420VideoFrame*>& frames1,
|
||||
I420VideoFrame* CreateI420VideoFrame(int width, int height, uint8_t data) {
|
||||
I420VideoFrame* frame = new I420VideoFrame();
|
||||
const int kSizeY = width * height * 2;
|
||||
const int kSizeUV = width * height;
|
||||
rtc::scoped_ptr<uint8_t[]> buffer(new uint8_t[kSizeY]);
|
||||
memset(buffer.get(), data, kSizeY);
|
||||
frame->CreateFrame(kSizeY,
|
||||
frame->CreateFrame(buffer.get(),
|
||||
buffer.get(),
|
||||
kSizeUV,
|
||||
buffer.get(),
|
||||
kSizeUV,
|
||||
buffer.get(),
|
||||
width,
|
||||
height,
|
||||
|
@ -310,22 +310,16 @@ int ViECapturer::IncomingFrameI420(const ViEVideoFrameI420& video_frame,
|
||||
return -1;
|
||||
}
|
||||
|
||||
int size_y = video_frame.height * video_frame.y_pitch;
|
||||
int size_u = video_frame.u_pitch * ((video_frame.height + 1) / 2);
|
||||
int size_v = video_frame.v_pitch * ((video_frame.height + 1) / 2);
|
||||
CriticalSectionScoped cs(incoming_frame_cs_.get());
|
||||
int ret = incoming_frame_.CreateFrame(size_y,
|
||||
video_frame.y_plane,
|
||||
size_u,
|
||||
video_frame.u_plane,
|
||||
size_v,
|
||||
video_frame.v_plane,
|
||||
video_frame.width,
|
||||
video_frame.height,
|
||||
video_frame.y_pitch,
|
||||
video_frame.u_pitch,
|
||||
video_frame.v_pitch,
|
||||
video_frame.rotation);
|
||||
int ret = incoming_frame_.CreateFrame(video_frame.y_plane,
|
||||
video_frame.u_plane,
|
||||
video_frame.v_plane,
|
||||
video_frame.width,
|
||||
video_frame.height,
|
||||
video_frame.y_pitch,
|
||||
video_frame.u_pitch,
|
||||
video_frame.v_pitch,
|
||||
video_frame.rotation);
|
||||
|
||||
if (ret < 0) {
|
||||
LOG_F(LS_ERROR) << "Could not create I420Frame.";
|
||||
|
@ -274,11 +274,10 @@ I420VideoFrame* CreateI420VideoFrame(uint8_t data) {
|
||||
const int width = 36;
|
||||
const int height = 24;
|
||||
const int kSizeY = width * height * 2;
|
||||
const int kSizeUV = width * height;
|
||||
uint8_t buffer[kSizeY];
|
||||
memset(buffer, data, kSizeY);
|
||||
frame->CreateFrame(
|
||||
kSizeY, buffer, kSizeUV, buffer, kSizeUV, buffer, width, height, width,
|
||||
buffer, buffer, buffer, width, height, width,
|
||||
width / 2, width / 2);
|
||||
frame->set_timestamp(data);
|
||||
frame->set_ntp_time_ms(data);
|
||||
|
@ -46,12 +46,8 @@ class I420VideoFrame {
|
||||
// CreateFrame: Sets the frame's members and buffers. If required size is
|
||||
// bigger than allocated one, new buffers of adequate size will be allocated.
|
||||
// Return value: 0 on success, -1 on error.
|
||||
// TODO(magjed): Remove unnecessary buffer size arguments.
|
||||
int CreateFrame(int size_y,
|
||||
const uint8_t* buffer_y,
|
||||
int size_u,
|
||||
int CreateFrame(const uint8_t* buffer_y,
|
||||
const uint8_t* buffer_u,
|
||||
int size_v,
|
||||
const uint8_t* buffer_v,
|
||||
int width,
|
||||
int height,
|
||||
@ -60,11 +56,8 @@ class I420VideoFrame {
|
||||
int stride_v);
|
||||
|
||||
// TODO(guoweis): remove the previous CreateFrame when chromium has this code.
|
||||
int CreateFrame(int size_y,
|
||||
const uint8_t* buffer_y,
|
||||
int size_u,
|
||||
int CreateFrame(const uint8_t* buffer_y,
|
||||
const uint8_t* buffer_u,
|
||||
int size_v,
|
||||
const uint8_t* buffer_v,
|
||||
int width,
|
||||
int height,
|
||||
|
Loading…
x
Reference in New Issue
Block a user