2011-12-05 09:58:55 +00:00
|
|
|
/*
|
2012-03-01 16:30:40 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-12-05 09:58:55 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
2014-04-09 01:18:32 +00:00
|
|
|
#include <map>
|
2016-03-02 01:01:11 -08:00
|
|
|
#include <memory>
|
2014-04-09 01:18:32 +00:00
|
|
|
#include <sstream>
|
|
|
|
|
|
2015-06-04 15:18:17 +02:00
|
|
|
#include "webrtc/base/scoped_ref_ptr.h"
|
2016-05-10 16:31:47 +02:00
|
|
|
#include "webrtc/base/timeutils.h"
|
2013-07-12 10:03:52 +00:00
|
|
|
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
2015-11-04 08:31:52 +01:00
|
|
|
#include "webrtc/modules/utility/include/process_thread.h"
|
2015-11-12 12:46:09 +01:00
|
|
|
#include "webrtc/modules/video_capture/video_capture.h"
|
|
|
|
|
#include "webrtc/modules/video_capture/video_capture_factory.h"
|
2015-10-28 18:17:40 +01:00
|
|
|
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
|
|
|
|
#include "webrtc/system_wrappers/include/sleep.h"
|
Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1983583002/ )
Reason for revert:
Should work after cl https://codereview.webrtc.org/1985693002/ is landed, which initializes the frames used by FakeWebRtcVideoCaptureModule. So intend to reland after that, with no changes.
Original issue's description:
> Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #2 id:290001 of https://codereview.webrtc.org/1963413004/ )
>
> Reason for revert:
> Speculative revert to see if failures on the DrMemory bot are related to this cl. See e.g. here:
> https://build.chromium.org/p/client.webrtc/builders/Win%20DrMemory%20Full/builds/4243
>
> UNINITIALIZED READ: reading 0x04980040-0x04980060 32 byte(s) within 0x04980040-0x04980060
> # 0 CopyRow_AVX
> # 1 CopyPlane
> # 2 I420Copy
> # 3 webrtc::ExtractBuffer
> # 4 cricket::WebRtcVideoCapturer::SignalFrameCapturedOnStartThread
> # 5 cricket::WebRtcVideoCapturer::OnIncomingCapturedFrame
> # 6 FakeWebRtcVideoCaptureModule::SendFrame
> # 7 WebRtcVideoCapturerTest_TestCaptureVcm_Test::TestBody
> # 8 testing::internal::HandleSehExceptionsInMethodIfSupported<>
>
> Original issue's description:
> > Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1935443002/ )
> >
> > Reason for revert:
> > I plan to reland this change in a week or two, after downstream users are updated.
> >
> > Original issue's description:
> > > Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #14 id:250001 of https://codereview.webrtc.org/1900673002/ )
> > >
> > > Reason for revert:
> > > Breaks chrome FYI bots.
> > >
> > > Original issue's description:
> > > > Delete webrtc::VideoFrame methods buffer and stride.
> > > >
> > > > To make the HasOneRef/IsMutable hack work, also had to change the
> > > > video_frame_buffer method to return a const ref to a scoped_ref_ptr,
> > > > to not imply an AddRef.
> > > >
> > > > BUG=webrtc:5682
> > >
> > > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@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:5682
> > >
> > > Committed: https://crrev.com/5b3c443d301f2c2f18dac5b02652c08b91ea3828
> > > Cr-Commit-Position: refs/heads/master@{#12558}
> >
> > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/d0dc66e0ea30c8614001e425a4ae0aa7dd56c2a7
> > Cr-Commit-Position: refs/heads/master@{#12721}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,nisse@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/d49c30cd2fe442f2b5b4ecec8d5cbaa430464725
> Cr-Commit-Position: refs/heads/master@{#12745}
TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,tommi@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/1979193003
Cr-Commit-Position: refs/heads/master@{#12773}
2016-05-17 04:05:47 -07:00
|
|
|
#include "webrtc/test/frame_utils.h"
|
2016-09-30 22:29:43 -07:00
|
|
|
#include "webrtc/test/gtest.h"
|
2015-04-10 12:52:13 +02:00
|
|
|
#include "webrtc/video_frame.h"
|
2012-08-08 14:01:09 +00:00
|
|
|
|
|
|
|
|
using webrtc::CriticalSectionWrapper;
|
|
|
|
|
using webrtc::CriticalSectionScoped;
|
2012-06-25 11:33:34 +00:00
|
|
|
using webrtc::SleepMs;
|
2011-12-05 09:58:55 +00:00
|
|
|
using webrtc::VideoCaptureAlarm;
|
|
|
|
|
using webrtc::VideoCaptureCapability;
|
|
|
|
|
using webrtc::VideoCaptureDataCallback;
|
|
|
|
|
using webrtc::VideoCaptureFactory;
|
|
|
|
|
using webrtc::VideoCaptureFeedBack;
|
|
|
|
|
using webrtc::VideoCaptureModule;
|
|
|
|
|
|
2012-08-08 14:01:09 +00:00
|
|
|
|
2011-12-05 09:58:55 +00:00
|
|
|
#define WAIT_(ex, timeout, res) \
|
|
|
|
|
do { \
|
|
|
|
|
res = (ex); \
|
2016-05-10 16:31:47 +02:00
|
|
|
int64_t start = rtc::TimeMillis(); \
|
|
|
|
|
while (!res && rtc::TimeMillis() < start + timeout) { \
|
2012-06-25 11:33:34 +00:00
|
|
|
SleepMs(5); \
|
2011-12-05 09:58:55 +00:00
|
|
|
res = (ex); \
|
|
|
|
|
} \
|
2015-12-16 18:38:31 -08:00
|
|
|
} while (0)
|
2011-12-05 09:58:55 +00:00
|
|
|
|
|
|
|
|
#define EXPECT_TRUE_WAIT(ex, timeout) \
|
|
|
|
|
do { \
|
|
|
|
|
bool res; \
|
|
|
|
|
WAIT_(ex, timeout, res); \
|
|
|
|
|
if (!res) EXPECT_TRUE(ex); \
|
2015-12-16 18:38:31 -08:00
|
|
|
} while (0)
|
2011-12-05 09:58:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
static const int kTimeOut = 5000;
|
|
|
|
|
static const int kTestHeight = 288;
|
|
|
|
|
static const int kTestWidth = 352;
|
|
|
|
|
static const int kTestFramerate = 30;
|
|
|
|
|
|
|
|
|
|
class TestVideoCaptureCallback : public VideoCaptureDataCallback {
|
|
|
|
|
public:
|
|
|
|
|
TestVideoCaptureCallback()
|
2015-02-13 14:31:26 +00:00
|
|
|
: capture_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
|
|
|
|
capture_delay_(-1),
|
|
|
|
|
last_render_time_ms_(0),
|
|
|
|
|
incoming_frames_(0),
|
|
|
|
|
timing_warnings_(0),
|
|
|
|
|
rotate_frame_(webrtc::kVideoRotation_0) {}
|
2011-12-05 09:58:55 +00:00
|
|
|
|
|
|
|
|
~TestVideoCaptureCallback() {
|
2012-08-08 14:01:09 +00:00
|
|
|
if (timing_warnings_ > 0)
|
|
|
|
|
printf("No of timing warnings %d\n", timing_warnings_);
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-29 17:21:40 -07:00
|
|
|
virtual void OnIncomingCapturedFrame(const int32_t id,
|
|
|
|
|
const webrtc::VideoFrame& videoFrame) {
|
2012-08-08 14:01:09 +00:00
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
2015-03-16 13:46:52 +00:00
|
|
|
int height = videoFrame.height();
|
|
|
|
|
int width = videoFrame.width();
|
2016-09-28 17:42:01 -07:00
|
|
|
#if defined(ANDROID) && ANDROID
|
2014-10-17 16:25:06 +00:00
|
|
|
// Android camera frames may be rotated depending on test device
|
|
|
|
|
// orientation.
|
|
|
|
|
EXPECT_TRUE(height == capability_.height || height == capability_.width);
|
|
|
|
|
EXPECT_TRUE(width == capability_.width || width == capability_.height);
|
|
|
|
|
#else
|
2016-03-18 11:38:26 -07:00
|
|
|
EXPECT_EQ(height, capability_.height);
|
|
|
|
|
EXPECT_EQ(width, capability_.width);
|
|
|
|
|
EXPECT_EQ(rotate_frame_, videoFrame.rotation());
|
2014-10-17 16:25:06 +00:00
|
|
|
#endif
|
2011-12-05 09:58:55 +00:00
|
|
|
// RenderTimstamp should be the time now.
|
|
|
|
|
EXPECT_TRUE(
|
2016-05-10 16:31:47 +02:00
|
|
|
videoFrame.render_time_ms() >= rtc::TimeMillis()-30 &&
|
|
|
|
|
videoFrame.render_time_ms() <= rtc::TimeMillis());
|
2011-12-05 09:58:55 +00:00
|
|
|
|
2015-03-16 13:46:52 +00:00
|
|
|
if ((videoFrame.render_time_ms() >
|
2012-08-08 14:01:09 +00:00
|
|
|
last_render_time_ms_ + (1000 * 1.1) / capability_.maxFPS &&
|
|
|
|
|
last_render_time_ms_ > 0) ||
|
2015-03-16 13:46:52 +00:00
|
|
|
(videoFrame.render_time_ms() <
|
2012-08-08 14:01:09 +00:00
|
|
|
last_render_time_ms_ + (1000 * 0.9) / capability_.maxFPS &&
|
|
|
|
|
last_render_time_ms_ > 0)) {
|
|
|
|
|
timing_warnings_++;
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 14:01:09 +00:00
|
|
|
incoming_frames_++;
|
2015-03-16 13:46:52 +00:00
|
|
|
last_render_time_ms_ = videoFrame.render_time_ms();
|
Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1983583002/ )
Reason for revert:
Should work after cl https://codereview.webrtc.org/1985693002/ is landed, which initializes the frames used by FakeWebRtcVideoCaptureModule. So intend to reland after that, with no changes.
Original issue's description:
> Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #2 id:290001 of https://codereview.webrtc.org/1963413004/ )
>
> Reason for revert:
> Speculative revert to see if failures on the DrMemory bot are related to this cl. See e.g. here:
> https://build.chromium.org/p/client.webrtc/builders/Win%20DrMemory%20Full/builds/4243
>
> UNINITIALIZED READ: reading 0x04980040-0x04980060 32 byte(s) within 0x04980040-0x04980060
> # 0 CopyRow_AVX
> # 1 CopyPlane
> # 2 I420Copy
> # 3 webrtc::ExtractBuffer
> # 4 cricket::WebRtcVideoCapturer::SignalFrameCapturedOnStartThread
> # 5 cricket::WebRtcVideoCapturer::OnIncomingCapturedFrame
> # 6 FakeWebRtcVideoCaptureModule::SendFrame
> # 7 WebRtcVideoCapturerTest_TestCaptureVcm_Test::TestBody
> # 8 testing::internal::HandleSehExceptionsInMethodIfSupported<>
>
> Original issue's description:
> > Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1935443002/ )
> >
> > Reason for revert:
> > I plan to reland this change in a week or two, after downstream users are updated.
> >
> > Original issue's description:
> > > Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #14 id:250001 of https://codereview.webrtc.org/1900673002/ )
> > >
> > > Reason for revert:
> > > Breaks chrome FYI bots.
> > >
> > > Original issue's description:
> > > > Delete webrtc::VideoFrame methods buffer and stride.
> > > >
> > > > To make the HasOneRef/IsMutable hack work, also had to change the
> > > > video_frame_buffer method to return a const ref to a scoped_ref_ptr,
> > > > to not imply an AddRef.
> > > >
> > > > BUG=webrtc:5682
> > >
> > > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@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:5682
> > >
> > > Committed: https://crrev.com/5b3c443d301f2c2f18dac5b02652c08b91ea3828
> > > Cr-Commit-Position: refs/heads/master@{#12558}
> >
> > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/d0dc66e0ea30c8614001e425a4ae0aa7dd56c2a7
> > Cr-Commit-Position: refs/heads/master@{#12721}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,nisse@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/d49c30cd2fe442f2b5b4ecec8d5cbaa430464725
> Cr-Commit-Position: refs/heads/master@{#12745}
TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,tommi@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/1979193003
Cr-Commit-Position: refs/heads/master@{#12773}
2016-05-17 04:05:47 -07:00
|
|
|
last_frame_ = videoFrame.video_frame_buffer();
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
2013-04-10 08:23:13 +00:00
|
|
|
virtual void OnCaptureDelayChanged(const int32_t id,
|
|
|
|
|
const int32_t delay) {
|
2012-08-08 14:01:09 +00:00
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
capture_delay_ = delay;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetExpectedCapability(VideoCaptureCapability capability) {
|
|
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
capability_= capability;
|
|
|
|
|
incoming_frames_ = 0;
|
|
|
|
|
last_render_time_ms_ = 0;
|
2013-09-23 17:58:45 +00:00
|
|
|
capture_delay_ = -1;
|
2012-08-08 14:01:09 +00:00
|
|
|
}
|
|
|
|
|
int incoming_frames() {
|
|
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
return incoming_frames_;
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 14:01:09 +00:00
|
|
|
int capture_delay() {
|
|
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
return capture_delay_;
|
|
|
|
|
}
|
|
|
|
|
int timing_warnings() {
|
|
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
return timing_warnings_;
|
|
|
|
|
}
|
|
|
|
|
VideoCaptureCapability capability() {
|
|
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
return capability_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-29 17:21:40 -07:00
|
|
|
bool CompareLastFrame(const webrtc::VideoFrame& frame) {
|
2012-08-08 14:01:09 +00:00
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1983583002/ )
Reason for revert:
Should work after cl https://codereview.webrtc.org/1985693002/ is landed, which initializes the frames used by FakeWebRtcVideoCaptureModule. So intend to reland after that, with no changes.
Original issue's description:
> Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #2 id:290001 of https://codereview.webrtc.org/1963413004/ )
>
> Reason for revert:
> Speculative revert to see if failures on the DrMemory bot are related to this cl. See e.g. here:
> https://build.chromium.org/p/client.webrtc/builders/Win%20DrMemory%20Full/builds/4243
>
> UNINITIALIZED READ: reading 0x04980040-0x04980060 32 byte(s) within 0x04980040-0x04980060
> # 0 CopyRow_AVX
> # 1 CopyPlane
> # 2 I420Copy
> # 3 webrtc::ExtractBuffer
> # 4 cricket::WebRtcVideoCapturer::SignalFrameCapturedOnStartThread
> # 5 cricket::WebRtcVideoCapturer::OnIncomingCapturedFrame
> # 6 FakeWebRtcVideoCaptureModule::SendFrame
> # 7 WebRtcVideoCapturerTest_TestCaptureVcm_Test::TestBody
> # 8 testing::internal::HandleSehExceptionsInMethodIfSupported<>
>
> Original issue's description:
> > Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1935443002/ )
> >
> > Reason for revert:
> > I plan to reland this change in a week or two, after downstream users are updated.
> >
> > Original issue's description:
> > > Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #14 id:250001 of https://codereview.webrtc.org/1900673002/ )
> > >
> > > Reason for revert:
> > > Breaks chrome FYI bots.
> > >
> > > Original issue's description:
> > > > Delete webrtc::VideoFrame methods buffer and stride.
> > > >
> > > > To make the HasOneRef/IsMutable hack work, also had to change the
> > > > video_frame_buffer method to return a const ref to a scoped_ref_ptr,
> > > > to not imply an AddRef.
> > > >
> > > > BUG=webrtc:5682
> > >
> > > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@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:5682
> > >
> > > Committed: https://crrev.com/5b3c443d301f2c2f18dac5b02652c08b91ea3828
> > > Cr-Commit-Position: refs/heads/master@{#12558}
> >
> > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/d0dc66e0ea30c8614001e425a4ae0aa7dd56c2a7
> > Cr-Commit-Position: refs/heads/master@{#12721}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,nisse@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/d49c30cd2fe442f2b5b4ecec8d5cbaa430464725
> Cr-Commit-Position: refs/heads/master@{#12745}
TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,tommi@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/1979193003
Cr-Commit-Position: refs/heads/master@{#12773}
2016-05-17 04:05:47 -07:00
|
|
|
return webrtc::test::FrameBufsEqual(last_frame_,
|
|
|
|
|
frame.video_frame_buffer());
|
2012-08-08 14:01:09 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-13 14:31:26 +00:00
|
|
|
void SetExpectedCaptureRotation(webrtc::VideoRotation rotation) {
|
2012-11-19 21:15:35 +00:00
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
rotate_frame_ = rotation;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-08 14:01:09 +00:00
|
|
|
private:
|
2016-03-02 01:01:11 -08:00
|
|
|
std::unique_ptr<CriticalSectionWrapper> capture_cs_;
|
2012-08-08 14:01:09 +00:00
|
|
|
VideoCaptureCapability capability_;
|
|
|
|
|
int capture_delay_;
|
2013-04-10 08:23:13 +00:00
|
|
|
int64_t last_render_time_ms_;
|
2012-08-08 14:01:09 +00:00
|
|
|
int incoming_frames_;
|
|
|
|
|
int timing_warnings_;
|
Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1983583002/ )
Reason for revert:
Should work after cl https://codereview.webrtc.org/1985693002/ is landed, which initializes the frames used by FakeWebRtcVideoCaptureModule. So intend to reland after that, with no changes.
Original issue's description:
> Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #2 id:290001 of https://codereview.webrtc.org/1963413004/ )
>
> Reason for revert:
> Speculative revert to see if failures on the DrMemory bot are related to this cl. See e.g. here:
> https://build.chromium.org/p/client.webrtc/builders/Win%20DrMemory%20Full/builds/4243
>
> UNINITIALIZED READ: reading 0x04980040-0x04980060 32 byte(s) within 0x04980040-0x04980060
> # 0 CopyRow_AVX
> # 1 CopyPlane
> # 2 I420Copy
> # 3 webrtc::ExtractBuffer
> # 4 cricket::WebRtcVideoCapturer::SignalFrameCapturedOnStartThread
> # 5 cricket::WebRtcVideoCapturer::OnIncomingCapturedFrame
> # 6 FakeWebRtcVideoCaptureModule::SendFrame
> # 7 WebRtcVideoCapturerTest_TestCaptureVcm_Test::TestBody
> # 8 testing::internal::HandleSehExceptionsInMethodIfSupported<>
>
> Original issue's description:
> > Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1935443002/ )
> >
> > Reason for revert:
> > I plan to reland this change in a week or two, after downstream users are updated.
> >
> > Original issue's description:
> > > Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #14 id:250001 of https://codereview.webrtc.org/1900673002/ )
> > >
> > > Reason for revert:
> > > Breaks chrome FYI bots.
> > >
> > > Original issue's description:
> > > > Delete webrtc::VideoFrame methods buffer and stride.
> > > >
> > > > To make the HasOneRef/IsMutable hack work, also had to change the
> > > > video_frame_buffer method to return a const ref to a scoped_ref_ptr,
> > > > to not imply an AddRef.
> > > >
> > > > BUG=webrtc:5682
> > >
> > > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@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:5682
> > >
> > > Committed: https://crrev.com/5b3c443d301f2c2f18dac5b02652c08b91ea3828
> > > Cr-Commit-Position: refs/heads/master@{#12558}
> >
> > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/d0dc66e0ea30c8614001e425a4ae0aa7dd56c2a7
> > Cr-Commit-Position: refs/heads/master@{#12721}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,nisse@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/d49c30cd2fe442f2b5b4ecec8d5cbaa430464725
> Cr-Commit-Position: refs/heads/master@{#12745}
TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,tommi@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/1979193003
Cr-Commit-Position: refs/heads/master@{#12773}
2016-05-17 04:05:47 -07:00
|
|
|
rtc::scoped_refptr<webrtc::VideoFrameBuffer> last_frame_;
|
2015-02-13 14:31:26 +00:00
|
|
|
webrtc::VideoRotation rotate_frame_;
|
2011-12-05 09:58:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TestVideoCaptureFeedBack : public VideoCaptureFeedBack {
|
|
|
|
|
public:
|
2012-08-08 14:01:09 +00:00
|
|
|
TestVideoCaptureFeedBack() :
|
|
|
|
|
capture_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
|
|
|
|
frame_rate_(0),
|
|
|
|
|
alarm_(webrtc::Cleared) {
|
|
|
|
|
}
|
2011-12-05 09:58:55 +00:00
|
|
|
|
2013-04-10 08:23:13 +00:00
|
|
|
virtual void OnCaptureFrameRate(const int32_t id,
|
|
|
|
|
const uint32_t frameRate) {
|
2012-08-08 14:01:09 +00:00
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
frame_rate_ = frameRate;
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
2013-04-10 08:23:13 +00:00
|
|
|
virtual void OnNoPictureAlarm(const int32_t id,
|
2011-12-05 09:58:55 +00:00
|
|
|
const VideoCaptureAlarm reported_alarm) {
|
2012-08-08 14:01:09 +00:00
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
alarm_ = reported_alarm;
|
|
|
|
|
}
|
|
|
|
|
int frame_rate() {
|
|
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
return frame_rate_;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
VideoCaptureAlarm alarm() {
|
|
|
|
|
CriticalSectionScoped cs(capture_cs_.get());
|
|
|
|
|
return alarm_;
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
2012-08-08 14:01:09 +00:00
|
|
|
|
|
|
|
|
private:
|
2016-03-02 01:01:11 -08:00
|
|
|
std::unique_ptr<CriticalSectionWrapper> capture_cs_;
|
2012-08-08 14:01:09 +00:00
|
|
|
unsigned int frame_rate_;
|
|
|
|
|
VideoCaptureAlarm alarm_;
|
2011-12-05 09:58:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class VideoCaptureTest : public testing::Test {
|
|
|
|
|
public:
|
|
|
|
|
VideoCaptureTest() : number_of_devices_(0) {}
|
|
|
|
|
|
|
|
|
|
void SetUp() {
|
2014-04-09 01:18:32 +00:00
|
|
|
device_info_.reset(VideoCaptureFactory::CreateDeviceInfo(0));
|
|
|
|
|
assert(device_info_.get());
|
2011-12-05 09:58:55 +00:00
|
|
|
number_of_devices_ = device_info_->NumberOfDevices();
|
|
|
|
|
ASSERT_GT(number_of_devices_, 0u);
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-04 15:18:17 +02:00
|
|
|
rtc::scoped_refptr<VideoCaptureModule> OpenVideoCaptureDevice(
|
2011-12-05 09:58:55 +00:00
|
|
|
unsigned int device,
|
|
|
|
|
VideoCaptureDataCallback* callback) {
|
2012-03-01 16:30:40 +00:00
|
|
|
char device_name[256];
|
|
|
|
|
char unique_name[256];
|
2011-12-05 09:58:55 +00:00
|
|
|
|
|
|
|
|
EXPECT_EQ(0, device_info_->GetDeviceName(
|
|
|
|
|
device, device_name, 256, unique_name, 256));
|
|
|
|
|
|
2015-06-04 15:18:17 +02:00
|
|
|
rtc::scoped_refptr<VideoCaptureModule> module(
|
2011-12-05 09:58:55 +00:00
|
|
|
VideoCaptureFactory::Create(device, unique_name));
|
|
|
|
|
if (module.get() == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(module->CaptureStarted());
|
|
|
|
|
|
2014-01-29 00:56:02 +00:00
|
|
|
module->RegisterCaptureDataCallback(*callback);
|
2011-12-05 09:58:55 +00:00
|
|
|
return module;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartCapture(VideoCaptureModule* capture_module,
|
|
|
|
|
VideoCaptureCapability capability) {
|
2014-04-09 01:18:32 +00:00
|
|
|
ASSERT_EQ(0, capture_module->StartCapture(capability));
|
2011-12-05 09:58:55 +00:00
|
|
|
EXPECT_TRUE(capture_module->CaptureStarted());
|
|
|
|
|
|
|
|
|
|
VideoCaptureCapability resulting_capability;
|
|
|
|
|
EXPECT_EQ(0, capture_module->CaptureSettings(resulting_capability));
|
2012-08-08 14:01:09 +00:00
|
|
|
EXPECT_EQ(capability.width, resulting_capability.width);
|
|
|
|
|
EXPECT_EQ(capability.height, resulting_capability.height);
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
2016-03-02 01:01:11 -08:00
|
|
|
std::unique_ptr<VideoCaptureModule::DeviceInfo> device_info_;
|
2011-12-05 09:58:55 +00:00
|
|
|
unsigned int number_of_devices_;
|
|
|
|
|
};
|
|
|
|
|
|
2016-01-06 05:23:09 -08:00
|
|
|
#ifdef WEBRTC_MAC
|
|
|
|
|
// Currently fails on Mac 64-bit, see
|
|
|
|
|
// https://bugs.chromium.org/p/webrtc/issues/detail?id=5406
|
|
|
|
|
#define MAYBE_CreateDelete DISABLED_CreateDelete
|
|
|
|
|
#else
|
|
|
|
|
#define MAYBE_CreateDelete CreateDelete
|
|
|
|
|
#endif
|
|
|
|
|
TEST_F(VideoCaptureTest, MAYBE_CreateDelete) {
|
2011-12-05 09:58:55 +00:00
|
|
|
for (int i = 0; i < 5; ++i) {
|
2016-05-10 16:31:47 +02:00
|
|
|
int64_t start_time = rtc::TimeMillis();
|
2011-12-05 09:58:55 +00:00
|
|
|
TestVideoCaptureCallback capture_observer;
|
2015-06-04 15:18:17 +02:00
|
|
|
rtc::scoped_refptr<VideoCaptureModule> module(
|
|
|
|
|
OpenVideoCaptureDevice(0, &capture_observer));
|
2011-12-05 09:58:55 +00:00
|
|
|
ASSERT_TRUE(module.get() != NULL);
|
|
|
|
|
|
2012-08-08 14:01:09 +00:00
|
|
|
VideoCaptureCapability capability;
|
2011-12-05 09:58:55 +00:00
|
|
|
#ifndef WEBRTC_MAC
|
2012-08-08 14:01:09 +00:00
|
|
|
device_info_->GetCapability(module->CurrentDeviceName(), 0, capability);
|
2011-12-05 09:58:55 +00:00
|
|
|
#else
|
2012-08-08 14:01:09 +00:00
|
|
|
capability.width = kTestWidth;
|
|
|
|
|
capability.height = kTestHeight;
|
|
|
|
|
capability.maxFPS = kTestFramerate;
|
|
|
|
|
capability.rawType = webrtc::kVideoUnknown;
|
2011-12-05 09:58:55 +00:00
|
|
|
#endif
|
2012-08-08 14:01:09 +00:00
|
|
|
capture_observer.SetExpectedCapability(capability);
|
2014-04-09 01:18:32 +00:00
|
|
|
ASSERT_NO_FATAL_FAILURE(StartCapture(module.get(), capability));
|
2011-12-05 09:58:55 +00:00
|
|
|
|
|
|
|
|
// Less than 4s to start the camera.
|
2016-05-10 16:31:47 +02:00
|
|
|
EXPECT_LE(rtc::TimeMillis() - start_time, 4000);
|
2011-12-05 09:58:55 +00:00
|
|
|
|
|
|
|
|
// Make sure 5 frames are captured.
|
2012-08-08 14:01:09 +00:00
|
|
|
EXPECT_TRUE_WAIT(capture_observer.incoming_frames() >= 5, kTimeOut);
|
2011-12-05 09:58:55 +00:00
|
|
|
|
2013-09-23 17:58:45 +00:00
|
|
|
EXPECT_GE(capture_observer.capture_delay(), 0);
|
2011-12-05 09:58:55 +00:00
|
|
|
|
2016-05-10 16:31:47 +02:00
|
|
|
int64_t stop_time = rtc::TimeMillis();
|
2011-12-05 09:58:55 +00:00
|
|
|
EXPECT_EQ(0, module->StopCapture());
|
|
|
|
|
EXPECT_FALSE(module->CaptureStarted());
|
|
|
|
|
|
|
|
|
|
// Less than 3s to stop the camera.
|
2016-05-10 16:31:47 +02:00
|
|
|
EXPECT_LE(rtc::TimeMillis() - stop_time, 3000);
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-06 05:23:09 -08:00
|
|
|
#ifdef WEBRTC_MAC
|
|
|
|
|
// Currently fails on Mac 64-bit, see
|
|
|
|
|
// https://bugs.chromium.org/p/webrtc/issues/detail?id=5406
|
|
|
|
|
#define MAYBE_Capabilities DISABLED_Capabilities
|
|
|
|
|
#else
|
|
|
|
|
#define MAYBE_Capabilities Capabilities
|
|
|
|
|
#endif
|
|
|
|
|
TEST_F(VideoCaptureTest, MAYBE_Capabilities) {
|
2011-12-05 09:58:55 +00:00
|
|
|
#ifdef WEBRTC_MAC
|
|
|
|
|
printf("Video capture capabilities are not supported on Mac.\n");
|
|
|
|
|
return;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
TestVideoCaptureCallback capture_observer;
|
|
|
|
|
|
2015-06-04 15:18:17 +02:00
|
|
|
rtc::scoped_refptr<VideoCaptureModule> module(
|
|
|
|
|
OpenVideoCaptureDevice(0, &capture_observer));
|
2011-12-05 09:58:55 +00:00
|
|
|
ASSERT_TRUE(module.get() != NULL);
|
|
|
|
|
|
|
|
|
|
int number_of_capabilities = device_info_->NumberOfCapabilities(
|
|
|
|
|
module->CurrentDeviceName());
|
|
|
|
|
EXPECT_GT(number_of_capabilities, 0);
|
2014-04-09 01:18:32 +00:00
|
|
|
// Key is <width>x<height>, value is vector of maxFPS values at that
|
|
|
|
|
// resolution.
|
|
|
|
|
typedef std::map<std::string, std::vector<int> > FrameRatesByResolution;
|
|
|
|
|
FrameRatesByResolution frame_rates_by_resolution;
|
2011-12-05 09:58:55 +00:00
|
|
|
for (int i = 0; i < number_of_capabilities; ++i) {
|
2012-08-08 14:01:09 +00:00
|
|
|
VideoCaptureCapability capability;
|
|
|
|
|
EXPECT_EQ(0, device_info_->GetCapability(module->CurrentDeviceName(), i,
|
|
|
|
|
capability));
|
2014-04-09 01:18:32 +00:00
|
|
|
std::ostringstream resolutionStream;
|
|
|
|
|
resolutionStream << capability.width << "x" << capability.height;
|
|
|
|
|
resolutionStream.flush();
|
|
|
|
|
std::string resolution = resolutionStream.str();
|
|
|
|
|
frame_rates_by_resolution[resolution].push_back(capability.maxFPS);
|
|
|
|
|
|
|
|
|
|
// Since Android presents so many resolution/FPS combinations and the test
|
|
|
|
|
// runner imposes a timeout, we only actually start the capture and test
|
|
|
|
|
// that a frame was captured for 2 frame-rates at each resolution.
|
|
|
|
|
if (frame_rates_by_resolution[resolution].size() > 2)
|
|
|
|
|
continue;
|
|
|
|
|
|
2012-08-08 14:01:09 +00:00
|
|
|
capture_observer.SetExpectedCapability(capability);
|
2014-04-09 01:18:32 +00:00
|
|
|
ASSERT_NO_FATAL_FAILURE(StartCapture(module.get(), capability));
|
|
|
|
|
// Make sure at least one frame is captured.
|
|
|
|
|
EXPECT_TRUE_WAIT(capture_observer.incoming_frames() >= 1, kTimeOut);
|
2012-08-08 14:01:09 +00:00
|
|
|
|
2011-12-05 09:58:55 +00:00
|
|
|
EXPECT_EQ(0, module->StopCapture());
|
|
|
|
|
}
|
2014-04-09 01:18:32 +00:00
|
|
|
|
2016-09-28 17:42:01 -07:00
|
|
|
#if defined(ANDROID) && ANDROID
|
2014-04-09 01:18:32 +00:00
|
|
|
// There's no reason for this to _necessarily_ be true, but in practice all
|
|
|
|
|
// Android devices this test runs on in fact do support multiple capture
|
|
|
|
|
// resolutions and multiple frame-rates per captured resolution, so we assert
|
|
|
|
|
// this fact here as a regression-test against the time that we only noticed a
|
|
|
|
|
// single frame-rate per resolution (bug 2974). If this test starts being run
|
|
|
|
|
// on devices for which this is untrue (e.g. Nexus4) then the following should
|
|
|
|
|
// probably be wrapped in a base::android::BuildInfo::model()/device() check.
|
|
|
|
|
EXPECT_GT(frame_rates_by_resolution.size(), 1U);
|
|
|
|
|
for (FrameRatesByResolution::const_iterator it =
|
|
|
|
|
frame_rates_by_resolution.begin();
|
|
|
|
|
it != frame_rates_by_resolution.end();
|
|
|
|
|
++it) {
|
|
|
|
|
EXPECT_GT(it->second.size(), 1U) << it->first;
|
|
|
|
|
}
|
|
|
|
|
#endif // ANDROID
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
2012-08-27 15:16:20 +00:00
|
|
|
// NOTE: flaky, crashes sometimes.
|
|
|
|
|
// http://code.google.com/p/webrtc/issues/detail?id=777
|
|
|
|
|
TEST_F(VideoCaptureTest, DISABLED_TestTwoCameras) {
|
2011-12-05 09:58:55 +00:00
|
|
|
if (number_of_devices_ < 2) {
|
|
|
|
|
printf("There are not two cameras available. Aborting test. \n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TestVideoCaptureCallback capture_observer1;
|
2015-06-04 15:18:17 +02:00
|
|
|
rtc::scoped_refptr<VideoCaptureModule> module1(
|
|
|
|
|
OpenVideoCaptureDevice(0, &capture_observer1));
|
2011-12-05 09:58:55 +00:00
|
|
|
ASSERT_TRUE(module1.get() != NULL);
|
2012-08-08 14:01:09 +00:00
|
|
|
VideoCaptureCapability capability1;
|
2011-12-05 09:58:55 +00:00
|
|
|
#ifndef WEBRTC_MAC
|
2012-08-08 14:01:09 +00:00
|
|
|
device_info_->GetCapability(module1->CurrentDeviceName(), 0, capability1);
|
2011-12-05 09:58:55 +00:00
|
|
|
#else
|
2012-08-08 14:01:09 +00:00
|
|
|
capability1.width = kTestWidth;
|
|
|
|
|
capability1.height = kTestHeight;
|
|
|
|
|
capability1.maxFPS = kTestFramerate;
|
|
|
|
|
capability1.rawType = webrtc::kVideoUnknown;
|
2011-12-05 09:58:55 +00:00
|
|
|
#endif
|
2012-08-08 14:01:09 +00:00
|
|
|
capture_observer1.SetExpectedCapability(capability1);
|
2011-12-05 09:58:55 +00:00
|
|
|
|
|
|
|
|
TestVideoCaptureCallback capture_observer2;
|
2015-06-04 15:18:17 +02:00
|
|
|
rtc::scoped_refptr<VideoCaptureModule> module2(
|
|
|
|
|
OpenVideoCaptureDevice(1, &capture_observer2));
|
2011-12-05 09:58:55 +00:00
|
|
|
ASSERT_TRUE(module1.get() != NULL);
|
|
|
|
|
|
|
|
|
|
|
2012-08-08 14:01:09 +00:00
|
|
|
VideoCaptureCapability capability2;
|
2011-12-05 09:58:55 +00:00
|
|
|
#ifndef WEBRTC_MAC
|
2012-08-08 14:01:09 +00:00
|
|
|
device_info_->GetCapability(module2->CurrentDeviceName(), 0, capability2);
|
2011-12-05 09:58:55 +00:00
|
|
|
#else
|
2012-08-08 14:01:09 +00:00
|
|
|
capability2.width = kTestWidth;
|
|
|
|
|
capability2.height = kTestHeight;
|
|
|
|
|
capability2.maxFPS = kTestFramerate;
|
|
|
|
|
capability2.rawType = webrtc::kVideoUnknown;
|
2011-12-05 09:58:55 +00:00
|
|
|
#endif
|
2012-08-08 14:01:09 +00:00
|
|
|
capture_observer2.SetExpectedCapability(capability2);
|
2011-12-05 09:58:55 +00:00
|
|
|
|
2014-04-09 01:18:32 +00:00
|
|
|
ASSERT_NO_FATAL_FAILURE(StartCapture(module1.get(), capability1));
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(StartCapture(module2.get(), capability2));
|
2012-08-08 14:01:09 +00:00
|
|
|
EXPECT_TRUE_WAIT(capture_observer1.incoming_frames() >= 5, kTimeOut);
|
|
|
|
|
EXPECT_TRUE_WAIT(capture_observer2.incoming_frames() >= 5, kTimeOut);
|
2014-04-09 01:18:32 +00:00
|
|
|
EXPECT_EQ(0, module2->StopCapture());
|
|
|
|
|
EXPECT_EQ(0, module1->StopCapture());
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test class for testing external capture and capture feedback information
|
|
|
|
|
// such as frame rate and picture alarm.
|
|
|
|
|
class VideoCaptureExternalTest : public testing::Test {
|
|
|
|
|
public:
|
|
|
|
|
void SetUp() {
|
|
|
|
|
capture_module_ = VideoCaptureFactory::Create(0, capture_input_interface_);
|
2016-04-26 08:18:04 -07:00
|
|
|
process_module_ = webrtc::ProcessThread::Create("ProcessThread");
|
2011-12-05 09:58:55 +00:00
|
|
|
process_module_->Start();
|
|
|
|
|
process_module_->RegisterModule(capture_module_);
|
|
|
|
|
|
2012-08-08 14:01:09 +00:00
|
|
|
VideoCaptureCapability capability;
|
|
|
|
|
capability.width = kTestWidth;
|
|
|
|
|
capability.height = kTestHeight;
|
|
|
|
|
capability.rawType = webrtc::kVideoYV12;
|
|
|
|
|
capability.maxFPS = kTestFramerate;
|
|
|
|
|
capture_callback_.SetExpectedCapability(capability);
|
2011-12-05 09:58:55 +00:00
|
|
|
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
rtc::scoped_refptr<webrtc::I420Buffer> buffer = webrtc::I420Buffer::Create(
|
|
|
|
|
kTestWidth, kTestHeight,
|
|
|
|
|
kTestWidth, ((kTestWidth + 1) / 2), (kTestWidth + 1) / 2);
|
|
|
|
|
|
|
|
|
|
memset(buffer->MutableDataY(), 127, kTestWidth * kTestHeight);
|
|
|
|
|
memset(buffer->MutableDataU(), 127,
|
2012-10-24 18:33:04 +00:00
|
|
|
((kTestWidth + 1) / 2) * ((kTestHeight + 1) / 2));
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
memset(buffer->MutableDataV(), 127,
|
2012-10-24 18:33:04 +00:00
|
|
|
((kTestWidth + 1) / 2) * ((kTestHeight + 1) / 2));
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
test_frame_.reset(
|
|
|
|
|
new webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0));
|
|
|
|
|
|
|
|
|
|
SleepMs(1); // Wait 1ms so that two tests can't have the same timestamp.
|
2011-12-05 09:58:55 +00:00
|
|
|
|
2014-01-29 00:56:02 +00:00
|
|
|
capture_module_->RegisterCaptureDataCallback(capture_callback_);
|
|
|
|
|
capture_module_->RegisterCaptureCallback(capture_feedback_);
|
|
|
|
|
capture_module_->EnableFrameRateCallback(true);
|
|
|
|
|
capture_module_->EnableNoPictureAlarm(true);
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TearDown() {
|
|
|
|
|
process_module_->Stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
webrtc::VideoCaptureExternal* capture_input_interface_;
|
2015-06-04 15:18:17 +02:00
|
|
|
rtc::scoped_refptr<VideoCaptureModule> capture_module_;
|
2016-03-02 01:01:11 -08:00
|
|
|
std::unique_ptr<webrtc::ProcessThread> process_module_;
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
std::unique_ptr<webrtc::VideoFrame> test_frame_;
|
2011-12-05 09:58:55 +00:00
|
|
|
TestVideoCaptureCallback capture_callback_;
|
|
|
|
|
TestVideoCaptureFeedBack capture_feedback_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Test input of external video frames.
|
2014-09-17 11:56:25 +00:00
|
|
|
TEST_F(VideoCaptureExternalTest, TestExternalCapture) {
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
size_t length = webrtc::CalcBufferSize(webrtc::kI420,
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
test_frame_->width(),
|
|
|
|
|
test_frame_->height());
|
2016-03-02 01:01:11 -08:00
|
|
|
std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
|
2012-10-24 18:33:04 +00:00
|
|
|
EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
|
|
|
|
|
length, capture_callback_.capability(), 0));
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
EXPECT_TRUE(capture_callback_.CompareLastFrame(*test_frame_));
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test frame rate and no picture alarm.
|
2014-04-28 11:27:36 +00:00
|
|
|
// Flaky on Win32, see webrtc:3270.
|
2016-04-01 03:23:14 -07:00
|
|
|
#if defined(WEBRTC_WIN) || defined(WEBRTC_MAC)
|
2016-01-04 22:44:05 +01:00
|
|
|
#define MAYBE_FrameRate DISABLED_FrameRate
|
|
|
|
|
#else
|
|
|
|
|
#define MAYBE_FrameRate FrameRate
|
|
|
|
|
#endif
|
|
|
|
|
TEST_F(VideoCaptureExternalTest, MAYBE_FrameRate) {
|
2016-05-10 16:31:47 +02:00
|
|
|
uint64_t testTime = 3 * rtc::kNumNanosecsPerSec;
|
|
|
|
|
uint64_t startTime = rtc::TimeNanos();
|
2012-08-08 14:01:09 +00:00
|
|
|
|
2016-05-10 16:31:47 +02:00
|
|
|
while ((rtc::TimeNanos() - startTime) < testTime) {
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
size_t length = webrtc::CalcBufferSize(webrtc::kI420,
|
|
|
|
|
test_frame_->width(),
|
|
|
|
|
test_frame_->height());
|
|
|
|
|
std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
|
|
|
|
|
webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
0, capture_input_interface_->IncomingFrame(
|
|
|
|
|
test_buffer.get(), length, capture_callback_.capability(), 0));
|
2012-08-08 14:01:09 +00:00
|
|
|
SleepMs(100);
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
2012-08-08 14:01:09 +00:00
|
|
|
EXPECT_TRUE(capture_feedback_.frame_rate() >= 8 &&
|
|
|
|
|
capture_feedback_.frame_rate() <= 10);
|
2012-06-25 11:33:34 +00:00
|
|
|
SleepMs(500);
|
2012-08-08 14:01:09 +00:00
|
|
|
EXPECT_EQ(webrtc::Raised, capture_feedback_.alarm());
|
2011-12-05 09:58:55 +00:00
|
|
|
|
2016-05-10 16:31:47 +02:00
|
|
|
startTime = rtc::TimeNanos();
|
|
|
|
|
while ((rtc::TimeNanos() - startTime) < testTime) {
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
size_t length = webrtc::CalcBufferSize(webrtc::kI420,
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
test_frame_->width(),
|
|
|
|
|
test_frame_->height());
|
2016-03-02 01:01:11 -08:00
|
|
|
std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
|
2012-10-24 18:33:04 +00:00
|
|
|
EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
|
|
|
|
|
length, capture_callback_.capability(), 0));
|
2012-08-08 14:01:09 +00:00
|
|
|
SleepMs(1000 / 30);
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
2012-08-08 14:01:09 +00:00
|
|
|
EXPECT_EQ(webrtc::Cleared, capture_feedback_.alarm());
|
2011-12-05 09:58:55 +00:00
|
|
|
// Frame rate might be less than 33 since we have paused providing
|
|
|
|
|
// frames for a while.
|
2012-08-08 14:01:09 +00:00
|
|
|
EXPECT_TRUE(capture_feedback_.frame_rate() >= 25 &&
|
|
|
|
|
capture_feedback_.frame_rate() <= 33);
|
2011-12-05 09:58:55 +00:00
|
|
|
}
|
2012-11-19 21:15:35 +00:00
|
|
|
|
2014-09-17 11:56:25 +00:00
|
|
|
TEST_F(VideoCaptureExternalTest, Rotation) {
|
2015-02-13 14:31:26 +00:00
|
|
|
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_0));
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
size_t length = webrtc::CalcBufferSize(webrtc::kI420,
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
test_frame_->width(),
|
|
|
|
|
test_frame_->height());
|
2016-03-02 01:01:11 -08:00
|
|
|
std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@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:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
|
2012-11-19 21:15:35 +00:00
|
|
|
EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
|
|
|
|
|
length, capture_callback_.capability(), 0));
|
2015-02-13 14:31:26 +00:00
|
|
|
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_90));
|
|
|
|
|
capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_90);
|
2012-11-19 21:15:35 +00:00
|
|
|
EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
|
|
|
|
|
length, capture_callback_.capability(), 0));
|
2015-02-13 14:31:26 +00:00
|
|
|
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180));
|
|
|
|
|
capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180);
|
2012-11-19 21:15:35 +00:00
|
|
|
EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
|
|
|
|
|
length, capture_callback_.capability(), 0));
|
2015-02-13 14:31:26 +00:00
|
|
|
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270));
|
|
|
|
|
capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270);
|
2012-11-19 21:15:35 +00:00
|
|
|
EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
|
|
|
|
|
length, capture_callback_.capability(), 0));
|
|
|
|
|
}
|