2016-02-29 00:04:41 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright 2016 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-10-31 09:53:08 -07:00
|
|
|
#include <limits>
|
|
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "absl/types/optional.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/video/i420_buffer.h"
|
|
|
|
|
#include "api/video/video_frame.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/video/video_rotation.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "media/base/fake_video_renderer.h"
|
|
|
|
|
#include "media/base/video_broadcaster.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "test/gtest.h"
|
2016-02-29 00:04:41 -08:00
|
|
|
|
|
|
|
|
using rtc::VideoBroadcaster;
|
|
|
|
|
using rtc::VideoSinkWants;
|
2016-03-17 10:35:23 +01:00
|
|
|
using cricket::FakeVideoRenderer;
|
2016-02-29 00:04:41 -08:00
|
|
|
|
|
|
|
|
TEST(VideoBroadcasterTest, frame_wanted) {
|
|
|
|
|
VideoBroadcaster broadcaster;
|
|
|
|
|
EXPECT_FALSE(broadcaster.frame_wanted());
|
|
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
FakeVideoRenderer sink;
|
2016-02-29 00:04:41 -08:00
|
|
|
broadcaster.AddOrUpdateSink(&sink, rtc::VideoSinkWants());
|
|
|
|
|
EXPECT_TRUE(broadcaster.frame_wanted());
|
|
|
|
|
|
|
|
|
|
broadcaster.RemoveSink(&sink);
|
|
|
|
|
EXPECT_FALSE(broadcaster.frame_wanted());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(VideoBroadcasterTest, OnFrame) {
|
|
|
|
|
VideoBroadcaster broadcaster;
|
|
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
FakeVideoRenderer sink1;
|
|
|
|
|
FakeVideoRenderer sink2;
|
2016-02-29 00:04:41 -08:00
|
|
|
broadcaster.AddOrUpdateSink(&sink1, rtc::VideoSinkWants());
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink2, rtc::VideoSinkWants());
|
2016-12-15 06:29:53 -08:00
|
|
|
static int kWidth = 100;
|
|
|
|
|
static int kHeight = 50;
|
2016-02-29 00:04:41 -08:00
|
|
|
|
2016-12-15 06:29:53 -08:00
|
|
|
rtc::scoped_refptr<webrtc::I420Buffer> buffer(
|
|
|
|
|
webrtc::I420Buffer::Create(kWidth, kHeight));
|
|
|
|
|
// Initialize, to avoid warnings on use of initialized values.
|
2017-01-10 07:44:26 -08:00
|
|
|
webrtc::I420Buffer::SetBlack(buffer);
|
2016-12-15 06:29:53 -08:00
|
|
|
|
2019-01-03 23:49:37 +01:00
|
|
|
webrtc::VideoFrame frame = webrtc::VideoFrame::Builder()
|
|
|
|
|
.set_video_frame_buffer(buffer)
|
|
|
|
|
.set_rotation(webrtc::kVideoRotation_0)
|
|
|
|
|
.set_timestamp_us(0)
|
|
|
|
|
.build();
|
2016-02-29 00:04:41 -08:00
|
|
|
|
|
|
|
|
broadcaster.OnFrame(frame);
|
2016-03-17 10:35:23 +01:00
|
|
|
EXPECT_EQ(1, sink1.num_rendered_frames());
|
|
|
|
|
EXPECT_EQ(1, sink2.num_rendered_frames());
|
2016-02-29 00:04:41 -08:00
|
|
|
|
|
|
|
|
broadcaster.RemoveSink(&sink1);
|
|
|
|
|
broadcaster.OnFrame(frame);
|
2016-03-17 10:35:23 +01:00
|
|
|
EXPECT_EQ(1, sink1.num_rendered_frames());
|
|
|
|
|
EXPECT_EQ(2, sink2.num_rendered_frames());
|
2016-02-29 00:04:41 -08:00
|
|
|
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink1, rtc::VideoSinkWants());
|
|
|
|
|
broadcaster.OnFrame(frame);
|
2016-03-17 10:35:23 +01:00
|
|
|
EXPECT_EQ(2, sink1.num_rendered_frames());
|
|
|
|
|
EXPECT_EQ(3, sink2.num_rendered_frames());
|
2016-02-29 00:04:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(VideoBroadcasterTest, AppliesRotationIfAnySinkWantsRotationApplied) {
|
|
|
|
|
VideoBroadcaster broadcaster;
|
2016-03-18 11:38:26 -07:00
|
|
|
EXPECT_FALSE(broadcaster.wants().rotation_applied);
|
2016-02-29 00:04:41 -08:00
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
FakeVideoRenderer sink1;
|
2016-02-29 00:04:41 -08:00
|
|
|
VideoSinkWants wants1;
|
|
|
|
|
wants1.rotation_applied = false;
|
|
|
|
|
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink1, wants1);
|
|
|
|
|
EXPECT_FALSE(broadcaster.wants().rotation_applied);
|
|
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
FakeVideoRenderer sink2;
|
2016-02-29 00:04:41 -08:00
|
|
|
VideoSinkWants wants2;
|
|
|
|
|
wants2.rotation_applied = true;
|
|
|
|
|
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink2, wants2);
|
|
|
|
|
EXPECT_TRUE(broadcaster.wants().rotation_applied);
|
|
|
|
|
|
|
|
|
|
broadcaster.RemoveSink(&sink2);
|
|
|
|
|
EXPECT_FALSE(broadcaster.wants().rotation_applied);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(VideoBroadcasterTest, AppliesMinOfSinkWantsMaxPixelCount) {
|
|
|
|
|
VideoBroadcaster broadcaster;
|
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ )
Reason for revert:
Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test.
Original issue's description:
> Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ )
>
> Reason for revert:
> This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780
>
> Original issue's description:
> > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ )
> >
> > Reason for revert:
> > Found issue with test case, will add fix to reland cl.
> >
> > Original issue's description:
> > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ )
> > >
> > > Reason for revert:
> > > Breaks perf tests:
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325
> > >
> > > Original issue's description:
> > > > Add framerate to VideoSinkWants and ability to signal on overuse
> > > >
> > > > In ViEEncoder, try to reduce framerate instead of resolution if the
> > > > current degradation preference is maintain-resolution rather than
> > > > balanced.
> > > >
> > > > BUG=webrtc:4172
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2716643002
> > > > Cr-Commit-Position: refs/heads/master@{#17327}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6
> > >
> > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:4172
> > >
> > > Review-Url: https://codereview.webrtc.org/2764133002
> > > Cr-Commit-Position: refs/heads/master@{#17331}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b
> >
> > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:4172
> >
> > Review-Url: https://codereview.webrtc.org/2781433002
> > Cr-Commit-Position: refs/heads/master@{#17474}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51
>
> TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4172
>
> Review-Url: https://codereview.webrtc.org/2783183003
> Cr-Commit-Position: refs/heads/master@{#17477}
> Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59
R=ilnik@webrtc.org,stefan@webrtc.org
BUG=webrtc:4172
Review-Url: https://codereview.webrtc.org/2789823002
Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
|
|
|
EXPECT_EQ(std::numeric_limits<int>::max(),
|
|
|
|
|
broadcaster.wants().max_pixel_count);
|
2016-02-29 00:04:41 -08:00
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
FakeVideoRenderer sink1;
|
2016-02-29 00:04:41 -08:00
|
|
|
VideoSinkWants wants1;
|
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ )
Reason for revert:
Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test.
Original issue's description:
> Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ )
>
> Reason for revert:
> This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780
>
> Original issue's description:
> > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ )
> >
> > Reason for revert:
> > Found issue with test case, will add fix to reland cl.
> >
> > Original issue's description:
> > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ )
> > >
> > > Reason for revert:
> > > Breaks perf tests:
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325
> > >
> > > Original issue's description:
> > > > Add framerate to VideoSinkWants and ability to signal on overuse
> > > >
> > > > In ViEEncoder, try to reduce framerate instead of resolution if the
> > > > current degradation preference is maintain-resolution rather than
> > > > balanced.
> > > >
> > > > BUG=webrtc:4172
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2716643002
> > > > Cr-Commit-Position: refs/heads/master@{#17327}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6
> > >
> > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:4172
> > >
> > > Review-Url: https://codereview.webrtc.org/2764133002
> > > Cr-Commit-Position: refs/heads/master@{#17331}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b
> >
> > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:4172
> >
> > Review-Url: https://codereview.webrtc.org/2781433002
> > Cr-Commit-Position: refs/heads/master@{#17474}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51
>
> TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4172
>
> Review-Url: https://codereview.webrtc.org/2783183003
> Cr-Commit-Position: refs/heads/master@{#17477}
> Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59
R=ilnik@webrtc.org,stefan@webrtc.org
BUG=webrtc:4172
Review-Url: https://codereview.webrtc.org/2789823002
Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
|
|
|
wants1.max_pixel_count = 1280 * 720;
|
2016-02-29 00:04:41 -08:00
|
|
|
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink1, wants1);
|
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ )
Reason for revert:
Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test.
Original issue's description:
> Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ )
>
> Reason for revert:
> This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780
>
> Original issue's description:
> > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ )
> >
> > Reason for revert:
> > Found issue with test case, will add fix to reland cl.
> >
> > Original issue's description:
> > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ )
> > >
> > > Reason for revert:
> > > Breaks perf tests:
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325
> > >
> > > Original issue's description:
> > > > Add framerate to VideoSinkWants and ability to signal on overuse
> > > >
> > > > In ViEEncoder, try to reduce framerate instead of resolution if the
> > > > current degradation preference is maintain-resolution rather than
> > > > balanced.
> > > >
> > > > BUG=webrtc:4172
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2716643002
> > > > Cr-Commit-Position: refs/heads/master@{#17327}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6
> > >
> > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:4172
> > >
> > > Review-Url: https://codereview.webrtc.org/2764133002
> > > Cr-Commit-Position: refs/heads/master@{#17331}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b
> >
> > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:4172
> >
> > Review-Url: https://codereview.webrtc.org/2781433002
> > Cr-Commit-Position: refs/heads/master@{#17474}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51
>
> TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4172
>
> Review-Url: https://codereview.webrtc.org/2783183003
> Cr-Commit-Position: refs/heads/master@{#17477}
> Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59
R=ilnik@webrtc.org,stefan@webrtc.org
BUG=webrtc:4172
Review-Url: https://codereview.webrtc.org/2789823002
Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
|
|
|
EXPECT_EQ(1280 * 720, broadcaster.wants().max_pixel_count);
|
2016-02-29 00:04:41 -08:00
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
FakeVideoRenderer sink2;
|
2016-02-29 00:04:41 -08:00
|
|
|
VideoSinkWants wants2;
|
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ )
Reason for revert:
Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test.
Original issue's description:
> Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ )
>
> Reason for revert:
> This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780
>
> Original issue's description:
> > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ )
> >
> > Reason for revert:
> > Found issue with test case, will add fix to reland cl.
> >
> > Original issue's description:
> > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ )
> > >
> > > Reason for revert:
> > > Breaks perf tests:
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325
> > >
> > > Original issue's description:
> > > > Add framerate to VideoSinkWants and ability to signal on overuse
> > > >
> > > > In ViEEncoder, try to reduce framerate instead of resolution if the
> > > > current degradation preference is maintain-resolution rather than
> > > > balanced.
> > > >
> > > > BUG=webrtc:4172
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2716643002
> > > > Cr-Commit-Position: refs/heads/master@{#17327}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6
> > >
> > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:4172
> > >
> > > Review-Url: https://codereview.webrtc.org/2764133002
> > > Cr-Commit-Position: refs/heads/master@{#17331}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b
> >
> > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:4172
> >
> > Review-Url: https://codereview.webrtc.org/2781433002
> > Cr-Commit-Position: refs/heads/master@{#17474}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51
>
> TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4172
>
> Review-Url: https://codereview.webrtc.org/2783183003
> Cr-Commit-Position: refs/heads/master@{#17477}
> Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59
R=ilnik@webrtc.org,stefan@webrtc.org
BUG=webrtc:4172
Review-Url: https://codereview.webrtc.org/2789823002
Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
|
|
|
wants2.max_pixel_count = 640 * 360;
|
2016-02-29 00:04:41 -08:00
|
|
|
broadcaster.AddOrUpdateSink(&sink2, wants2);
|
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ )
Reason for revert:
Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test.
Original issue's description:
> Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ )
>
> Reason for revert:
> This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780
>
> Original issue's description:
> > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ )
> >
> > Reason for revert:
> > Found issue with test case, will add fix to reland cl.
> >
> > Original issue's description:
> > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ )
> > >
> > > Reason for revert:
> > > Breaks perf tests:
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325
> > >
> > > Original issue's description:
> > > > Add framerate to VideoSinkWants and ability to signal on overuse
> > > >
> > > > In ViEEncoder, try to reduce framerate instead of resolution if the
> > > > current degradation preference is maintain-resolution rather than
> > > > balanced.
> > > >
> > > > BUG=webrtc:4172
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2716643002
> > > > Cr-Commit-Position: refs/heads/master@{#17327}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6
> > >
> > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:4172
> > >
> > > Review-Url: https://codereview.webrtc.org/2764133002
> > > Cr-Commit-Position: refs/heads/master@{#17331}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b
> >
> > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:4172
> >
> > Review-Url: https://codereview.webrtc.org/2781433002
> > Cr-Commit-Position: refs/heads/master@{#17474}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51
>
> TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4172
>
> Review-Url: https://codereview.webrtc.org/2783183003
> Cr-Commit-Position: refs/heads/master@{#17477}
> Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59
R=ilnik@webrtc.org,stefan@webrtc.org
BUG=webrtc:4172
Review-Url: https://codereview.webrtc.org/2789823002
Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
|
|
|
EXPECT_EQ(640 * 360, broadcaster.wants().max_pixel_count);
|
2016-02-29 00:04:41 -08:00
|
|
|
|
|
|
|
|
broadcaster.RemoveSink(&sink2);
|
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ )
Reason for revert:
Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test.
Original issue's description:
> Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ )
>
> Reason for revert:
> This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780
>
> Original issue's description:
> > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ )
> >
> > Reason for revert:
> > Found issue with test case, will add fix to reland cl.
> >
> > Original issue's description:
> > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ )
> > >
> > > Reason for revert:
> > > Breaks perf tests:
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325
> > >
> > > Original issue's description:
> > > > Add framerate to VideoSinkWants and ability to signal on overuse
> > > >
> > > > In ViEEncoder, try to reduce framerate instead of resolution if the
> > > > current degradation preference is maintain-resolution rather than
> > > > balanced.
> > > >
> > > > BUG=webrtc:4172
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2716643002
> > > > Cr-Commit-Position: refs/heads/master@{#17327}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6
> > >
> > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:4172
> > >
> > > Review-Url: https://codereview.webrtc.org/2764133002
> > > Cr-Commit-Position: refs/heads/master@{#17331}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b
> >
> > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:4172
> >
> > Review-Url: https://codereview.webrtc.org/2781433002
> > Cr-Commit-Position: refs/heads/master@{#17474}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51
>
> TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4172
>
> Review-Url: https://codereview.webrtc.org/2783183003
> Cr-Commit-Position: refs/heads/master@{#17477}
> Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59
R=ilnik@webrtc.org,stefan@webrtc.org
BUG=webrtc:4172
Review-Url: https://codereview.webrtc.org/2789823002
Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
|
|
|
EXPECT_EQ(1280 * 720, broadcaster.wants().max_pixel_count);
|
2016-02-29 00:04:41 -08:00
|
|
|
}
|
|
|
|
|
|
2017-02-10 07:04:27 -08:00
|
|
|
TEST(VideoBroadcasterTest, AppliesMinOfSinkWantsMaxAndTargetPixelCount) {
|
2016-02-29 00:04:41 -08:00
|
|
|
VideoBroadcaster broadcaster;
|
2017-02-10 07:04:27 -08:00
|
|
|
EXPECT_TRUE(!broadcaster.wants().target_pixel_count);
|
2016-02-29 00:04:41 -08:00
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
FakeVideoRenderer sink1;
|
2016-02-29 00:04:41 -08:00
|
|
|
VideoSinkWants wants1;
|
2017-11-16 11:09:55 +01:00
|
|
|
wants1.target_pixel_count = 1280 * 720;
|
2016-02-29 00:04:41 -08:00
|
|
|
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink1, wants1);
|
2017-02-10 07:04:27 -08:00
|
|
|
EXPECT_EQ(1280 * 720, *broadcaster.wants().target_pixel_count);
|
2016-02-29 00:04:41 -08:00
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
FakeVideoRenderer sink2;
|
2016-02-29 00:04:41 -08:00
|
|
|
VideoSinkWants wants2;
|
2017-11-16 11:09:55 +01:00
|
|
|
wants2.target_pixel_count = 640 * 360;
|
2016-02-29 00:04:41 -08:00
|
|
|
broadcaster.AddOrUpdateSink(&sink2, wants2);
|
2017-02-10 07:04:27 -08:00
|
|
|
EXPECT_EQ(640 * 360, *broadcaster.wants().target_pixel_count);
|
2016-02-29 00:04:41 -08:00
|
|
|
|
|
|
|
|
broadcaster.RemoveSink(&sink2);
|
2017-02-10 07:04:27 -08:00
|
|
|
EXPECT_EQ(1280 * 720, *broadcaster.wants().target_pixel_count);
|
2016-02-29 00:04:41 -08:00
|
|
|
}
|
2016-03-17 10:35:23 +01:00
|
|
|
|
Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2783183003/ )
Reason for revert:
Seem to be a flaky test rather than an issue with this cl. Creating reland, will add code to reduce flakiness to that test.
Original issue's description:
> Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #8 id:410001 of https://codereview.webrtc.org/2781433002/ )
>
> Reason for revert:
> This has resulted in failure of CallPerfTest.ReceivesCpuOveruseAndUnderuse test on the Win7 build bot https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1780
>
> Original issue's description:
> > Reland of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #1 id:1 of https://codereview.webrtc.org/2764133002/ )
> >
> > Reason for revert:
> > Found issue with test case, will add fix to reland cl.
> >
> > Original issue's description:
> > > Revert of Add framerate to VideoSinkWants and ability to signal on overuse (patchset #14 id:250001 of https://codereview.webrtc.org/2716643002/ )
> > >
> > > Reason for revert:
> > > Breaks perf tests:
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Win7/builds/1679
> > > https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20%28L%20Nexus5%29/builds/2325
> > >
> > > Original issue's description:
> > > > Add framerate to VideoSinkWants and ability to signal on overuse
> > > >
> > > > In ViEEncoder, try to reduce framerate instead of resolution if the
> > > > current degradation preference is maintain-resolution rather than
> > > > balanced.
> > > >
> > > > BUG=webrtc:4172
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2716643002
> > > > Cr-Commit-Position: refs/heads/master@{#17327}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/72acf2526177bb4dbb5103cd6e165eb4361a5ae6
> > >
> > > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,sprang@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:4172
> > >
> > > Review-Url: https://codereview.webrtc.org/2764133002
> > > Cr-Commit-Position: refs/heads/master@{#17331}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8b45b11144c968b4173215c76f78c710c9a2ed0b
> >
> > TBR=nisse@webrtc.org,magjed@webrtc.org,kthelgason@webrtc.org,ilnik@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:4172
> >
> > Review-Url: https://codereview.webrtc.org/2781433002
> > Cr-Commit-Position: refs/heads/master@{#17474}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/3ea3c77e93121b1ab9d5e46641e6764f2cca0d51
>
> TBR=ilnik@webrtc.org,stefan@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4172
>
> Review-Url: https://codereview.webrtc.org/2783183003
> Cr-Commit-Position: refs/heads/master@{#17477}
> Committed: https://chromium.googlesource.com/external/webrtc/+/f9ed235c9b7248694edcb46feb1f29ce7456ab59
R=ilnik@webrtc.org,stefan@webrtc.org
BUG=webrtc:4172
Review-Url: https://codereview.webrtc.org/2789823002
Cr-Commit-Position: refs/heads/master@{#17498}
2017-04-02 23:53:04 -07:00
|
|
|
TEST(VideoBroadcasterTest, AppliesMinOfSinkWantsMaxFramerate) {
|
|
|
|
|
VideoBroadcaster broadcaster;
|
|
|
|
|
EXPECT_EQ(std::numeric_limits<int>::max(),
|
|
|
|
|
broadcaster.wants().max_framerate_fps);
|
|
|
|
|
|
|
|
|
|
FakeVideoRenderer sink1;
|
|
|
|
|
VideoSinkWants wants1;
|
|
|
|
|
wants1.max_framerate_fps = 30;
|
|
|
|
|
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink1, wants1);
|
|
|
|
|
EXPECT_EQ(30, broadcaster.wants().max_framerate_fps);
|
|
|
|
|
|
|
|
|
|
FakeVideoRenderer sink2;
|
|
|
|
|
VideoSinkWants wants2;
|
|
|
|
|
wants2.max_framerate_fps = 15;
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink2, wants2);
|
|
|
|
|
EXPECT_EQ(15, broadcaster.wants().max_framerate_fps);
|
|
|
|
|
|
|
|
|
|
broadcaster.RemoveSink(&sink2);
|
|
|
|
|
EXPECT_EQ(30, broadcaster.wants().max_framerate_fps);
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
TEST(VideoBroadcasterTest, SinkWantsBlackFrames) {
|
|
|
|
|
VideoBroadcaster broadcaster;
|
|
|
|
|
EXPECT_TRUE(!broadcaster.wants().black_frames);
|
|
|
|
|
|
|
|
|
|
FakeVideoRenderer sink1;
|
|
|
|
|
VideoSinkWants wants1;
|
|
|
|
|
wants1.black_frames = true;
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink1, wants1);
|
|
|
|
|
|
|
|
|
|
FakeVideoRenderer sink2;
|
|
|
|
|
VideoSinkWants wants2;
|
2016-06-09 00:31:39 -07:00
|
|
|
wants2.black_frames = false;
|
2016-03-17 10:35:23 +01:00
|
|
|
broadcaster.AddOrUpdateSink(&sink2, wants2);
|
|
|
|
|
|
2016-06-09 00:31:39 -07:00
|
|
|
rtc::scoped_refptr<webrtc::I420Buffer> buffer(
|
2017-01-10 07:44:26 -08:00
|
|
|
webrtc::I420Buffer::Create(100, 200));
|
2016-06-09 00:31:39 -07:00
|
|
|
// Makes it not all black.
|
|
|
|
|
buffer->InitializeData();
|
|
|
|
|
|
2019-01-03 23:49:37 +01:00
|
|
|
webrtc::VideoFrame frame1 = webrtc::VideoFrame::Builder()
|
|
|
|
|
.set_video_frame_buffer(buffer)
|
|
|
|
|
.set_rotation(webrtc::kVideoRotation_0)
|
|
|
|
|
.set_timestamp_us(10)
|
|
|
|
|
.build();
|
2016-03-17 10:35:23 +01:00
|
|
|
broadcaster.OnFrame(frame1);
|
|
|
|
|
EXPECT_TRUE(sink1.black_frame());
|
2016-09-06 07:52:40 -07:00
|
|
|
EXPECT_EQ(10, sink1.timestamp_us());
|
2016-03-17 10:35:23 +01:00
|
|
|
EXPECT_FALSE(sink2.black_frame());
|
2016-09-06 07:52:40 -07:00
|
|
|
EXPECT_EQ(10, sink2.timestamp_us());
|
2016-03-17 10:35:23 +01:00
|
|
|
|
|
|
|
|
// Switch the sink wants.
|
|
|
|
|
wants1.black_frames = false;
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink1, wants1);
|
|
|
|
|
wants2.black_frames = true;
|
|
|
|
|
broadcaster.AddOrUpdateSink(&sink2, wants2);
|
|
|
|
|
|
2019-01-03 23:49:37 +01:00
|
|
|
webrtc::VideoFrame frame2 = webrtc::VideoFrame::Builder()
|
|
|
|
|
.set_video_frame_buffer(buffer)
|
|
|
|
|
.set_rotation(webrtc::kVideoRotation_0)
|
|
|
|
|
.set_timestamp_us(30)
|
|
|
|
|
.build();
|
2016-03-17 10:35:23 +01:00
|
|
|
broadcaster.OnFrame(frame2);
|
|
|
|
|
EXPECT_FALSE(sink1.black_frame());
|
2016-09-06 07:52:40 -07:00
|
|
|
EXPECT_EQ(30, sink1.timestamp_us());
|
2016-03-17 10:35:23 +01:00
|
|
|
EXPECT_TRUE(sink2.black_frame());
|
2016-09-06 07:52:40 -07:00
|
|
|
EXPECT_EQ(30, sink2.timestamp_us());
|
2016-03-17 10:35:23 +01:00
|
|
|
}
|