2015-06-05 11:08:03 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef TEST_FAKE_TEXTURE_FRAME_H_
|
|
|
|
|
#define TEST_FAKE_TEXTURE_FRAME_H_
|
2015-06-05 11:08:03 +02:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/video/i420_buffer.h"
|
|
|
|
|
#include "api/video/video_frame.h"
|
|
|
|
|
#include "common_video/include/video_frame_buffer.h"
|
|
|
|
|
#include "rtc_base/checks.h"
|
2015-06-05 11:08:03 +02:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
2017-06-07 11:32:50 +02:00
|
|
|
class FakeNativeBuffer : public VideoFrameBuffer {
|
2016-01-04 22:36:38 +01:00
|
|
|
public:
|
2017-06-07 11:32:50 +02:00
|
|
|
static VideoFrame CreateFrame(int width,
|
2016-01-04 22:36:38 +01:00
|
|
|
int height,
|
|
|
|
|
uint32_t timestamp,
|
|
|
|
|
int64_t render_time_ms,
|
|
|
|
|
VideoRotation rotation);
|
2015-06-05 11:08:03 +02:00
|
|
|
|
2017-06-07 11:32:50 +02:00
|
|
|
FakeNativeBuffer(int width, int height) : width_(width), height_(height) {}
|
2015-06-05 11:08:03 +02:00
|
|
|
|
2017-06-07 11:32:50 +02:00
|
|
|
Type type() const override { return Type::kNative; }
|
|
|
|
|
int width() const override { return width_; }
|
|
|
|
|
int height() const override { return height_; }
|
2015-06-05 11:08:03 +02:00
|
|
|
|
|
|
|
|
private:
|
2017-06-07 11:32:50 +02:00
|
|
|
rtc::scoped_refptr<I420BufferInterface> ToI420() override {
|
Reland of Update test code to use I420Buffer when writing pixel data. (patchset #1 id:1 of https://codereview.webrtc.org/2343083002/ )
Reason for revert:
Will fix android build failure.
Original issue's description:
> Revert of Update test code to use I420Buffer when writing pixel data. (patchset #2 id:140001 of https://codereview.webrtc.org/2342783003/ )
>
> Reason for revert:
> I was too impatient; this made android builds fail instead. See https://build.chromium.org/p/client.webrtc/builders/Linux32%20ARM/builds/585/steps/compile/logs/stdio
>
> Original issue's description:
> > Reland of Update test code to use I420Buffer when writing pixel data. (patchset #1 id:1 of https://codereview.webrtc.org/2342123003/ )
> >
> > Reason for revert:
> > Intending to fix problem and reland.
> >
> > Original issue's description:
> > > Revert of Update test code to use I420Buffer when writing pixel data. (patchset #5 id:80001 of https://codereview.webrtc.org/2333373007/ )
> > >
> > > Reason for revert:
> > > Fails 64-bit windows builds, it turns out I missed some of the needed int/size_t casts. Example https://build.chromium.org/p/client.webrtc/waterfall?builder=Win64%20Release
> > >
> > > Hope our windows try bots get back in working shape soon.
> > >
> > > Original issue's description:
> > > > Update test code to use I420Buffer when writing pixel data.
> > > >
> > > > VideoFrameBuffer and VideoFrame will become immutable.
> > > >
> > > > BUG=webrtc:5921
> > > > R=magjed@webrtc.org, phoglund@webrtc.org
> > > >
> > > > Committed: https://crrev.com/280ad1514e44bf6717e5871526dd4632f759eb3d
> > > > Cr-Commit-Position: refs/heads/master@{#14249}
> > >
> > > TBR=phoglund@webrtc.org,palmkvist@webrtc.org,magjed@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:5921
> > >
> > > Committed: https://crrev.com/fbf14607267adf03d235273283ca452a1e564861
> > > Cr-Commit-Position: refs/heads/master@{#14251}
> >
> > TBR=phoglund@webrtc.org,palmkvist@webrtc.org,magjed@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/d21534a8cfe636bbcf3d7bb151945590abc92b2a
> > Cr-Commit-Position: refs/heads/master@{#14258}
>
> TBR=phoglund@webrtc.org,palmkvist@webrtc.org,magjed@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5921
>
> Committed: https://crrev.com/3011627142bccdd73fce9fec854abb1f6b02b5c1
> Cr-Commit-Position: refs/heads/master@{#14259}
TBR=phoglund@webrtc.org,palmkvist@webrtc.org,magjed@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2347863002
Cr-Commit-Position: refs/heads/master@{#14283}
2016-09-19 00:34:46 -07:00
|
|
|
rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(width_, height_);
|
2017-01-10 07:44:26 -08:00
|
|
|
I420Buffer::SetBlack(buffer);
|
2015-06-05 11:08:03 +02:00
|
|
|
return buffer;
|
|
|
|
|
}
|
2017-06-07 11:32:50 +02:00
|
|
|
|
|
|
|
|
const int width_;
|
|
|
|
|
const int height_;
|
2015-06-05 11:08:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // TEST_FAKE_TEXTURE_FRAME_H_
|