2013-05-29 13:41:03 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-10-28 16:32:01 +00:00
|
|
|
#include "webrtc/test/frame_generator_capturer.h"
|
2013-05-29 13:41:03 +00:00
|
|
|
|
2015-05-01 13:00:41 +02:00
|
|
|
#include "webrtc/base/criticalsection.h"
|
2015-11-23 14:47:56 -08:00
|
|
|
#include "webrtc/base/platform_thread.h"
|
2015-10-28 18:17:40 +01:00
|
|
|
#include "webrtc/system_wrappers/include/clock.h"
|
Revert of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #11 id:300001 of https://codereview.webrtc.org/2750473002/ )
Reason for revert:
Changes to frame-generator resulted in reduced fps on android and Mac on all tests.
Original issue's description:
> Reland of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2748643002/ )
>
> Reason for revert:
> Reland with fixes to the failing perf tests.
>
> Original issue's description:
> > Revert of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #2 id:90001 of https://codereview.webrtc.org/2744003002/ )
> >
> > Reason for revert:
> > CallPerfTest.ReceivesCpuOveruseAndUnderuse perf test fails due to this CL. It requires very accurate frame rate, which may not be so accurate now.
> >
> > Original issue's description:
> > > Reland of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2743993002/ )
> > >
> > > And enable large full-stack test depending on that change (Reland of https://codereview.webrtc.org/2741823003/)
> > > TBR=stefan@webrtc.org,tommi@webrtc.org
> > > BUG=webrtc:7301,webrtc:7325
> > >
> > > Review-Url: https://codereview.webrtc.org/2744003002
> > > Cr-Commit-Position: refs/heads/master@{#17196}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8c0a5896d1cdc7bb81307c33fa4b3538d8160a0f
> >
> > TBR=stefan@webrtc.org,tommi@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:7301,webrtc:7325
> >
> > Review-Url: https://codereview.webrtc.org/2748643002
> > Cr-Commit-Position: refs/heads/master@{#17198}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/382a72a0d321f19ac9cdc9bb30712cefe2639f88
>
> BUG=webrtc:7301,webrtc:7325
>
> Review-Url: https://codereview.webrtc.org/2750473002
> Cr-Commit-Position: refs/heads/master@{#17253}
> Committed: https://chromium.googlesource.com/external/webrtc/+/2549ad4fef419a055671c5be39fcfa27ba573c3b
TBR=sprang@webrtc.org,tommi@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7301,webrtc:7325
Review-Url: https://codereview.webrtc.org/2751063005
Cr-Commit-Position: refs/heads/master@{#17276}
2017-03-16 09:43:44 -07:00
|
|
|
#include "webrtc/system_wrappers/include/event_wrapper.h"
|
2015-10-28 18:17:40 +01:00
|
|
|
#include "webrtc/system_wrappers/include/sleep.h"
|
2015-11-23 14:47:56 -08:00
|
|
|
#include "webrtc/test/frame_generator.h"
|
2013-10-28 16:32:01 +00:00
|
|
|
#include "webrtc/video_send_stream.h"
|
2013-05-29 13:41:03 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
2017-02-27 06:52:10 -08:00
|
|
|
FrameGeneratorCapturer* FrameGeneratorCapturer::Create(int width,
|
|
|
|
|
int height,
|
2015-06-26 06:58:16 +02:00
|
|
|
int target_fps,
|
|
|
|
|
Clock* clock) {
|
2013-09-19 12:14:03 +00:00
|
|
|
FrameGeneratorCapturer* capturer = new FrameGeneratorCapturer(
|
2017-02-27 06:52:10 -08:00
|
|
|
clock, FrameGenerator::CreateSquareGenerator(width, height), target_fps);
|
2013-05-29 13:41:03 +00:00
|
|
|
if (!capturer->Init()) {
|
|
|
|
|
delete capturer;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return capturer;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-19 12:14:03 +00:00
|
|
|
FrameGeneratorCapturer* FrameGeneratorCapturer::CreateFromYuvFile(
|
2015-02-18 12:46:06 +00:00
|
|
|
const std::string& file_name,
|
2013-09-19 12:14:03 +00:00
|
|
|
size_t width,
|
|
|
|
|
size_t height,
|
|
|
|
|
int target_fps,
|
|
|
|
|
Clock* clock) {
|
|
|
|
|
FrameGeneratorCapturer* capturer = new FrameGeneratorCapturer(
|
2016-09-16 07:53:41 -07:00
|
|
|
clock, FrameGenerator::CreateFromYuvFile(
|
|
|
|
|
std::vector<std::string>(1, file_name), width, height, 1),
|
2013-09-19 12:14:03 +00:00
|
|
|
target_fps);
|
|
|
|
|
if (!capturer->Init()) {
|
|
|
|
|
delete capturer;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return capturer;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-27 06:52:10 -08:00
|
|
|
FrameGeneratorCapturer::FrameGeneratorCapturer(
|
|
|
|
|
Clock* clock,
|
|
|
|
|
std::unique_ptr<FrameGenerator> frame_generator,
|
|
|
|
|
int target_fps)
|
2016-09-16 07:53:41 -07:00
|
|
|
: clock_(clock),
|
2013-05-29 13:41:03 +00:00
|
|
|
sending_(false),
|
2016-09-16 07:53:41 -07:00
|
|
|
sink_(nullptr),
|
2016-11-01 11:45:46 -07:00
|
|
|
sink_wants_observer_(nullptr),
|
Revert of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #11 id:300001 of https://codereview.webrtc.org/2750473002/ )
Reason for revert:
Changes to frame-generator resulted in reduced fps on android and Mac on all tests.
Original issue's description:
> Reland of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2748643002/ )
>
> Reason for revert:
> Reland with fixes to the failing perf tests.
>
> Original issue's description:
> > Revert of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #2 id:90001 of https://codereview.webrtc.org/2744003002/ )
> >
> > Reason for revert:
> > CallPerfTest.ReceivesCpuOveruseAndUnderuse perf test fails due to this CL. It requires very accurate frame rate, which may not be so accurate now.
> >
> > Original issue's description:
> > > Reland of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2743993002/ )
> > >
> > > And enable large full-stack test depending on that change (Reland of https://codereview.webrtc.org/2741823003/)
> > > TBR=stefan@webrtc.org,tommi@webrtc.org
> > > BUG=webrtc:7301,webrtc:7325
> > >
> > > Review-Url: https://codereview.webrtc.org/2744003002
> > > Cr-Commit-Position: refs/heads/master@{#17196}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8c0a5896d1cdc7bb81307c33fa4b3538d8160a0f
> >
> > TBR=stefan@webrtc.org,tommi@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:7301,webrtc:7325
> >
> > Review-Url: https://codereview.webrtc.org/2748643002
> > Cr-Commit-Position: refs/heads/master@{#17198}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/382a72a0d321f19ac9cdc9bb30712cefe2639f88
>
> BUG=webrtc:7301,webrtc:7325
>
> Review-Url: https://codereview.webrtc.org/2750473002
> Cr-Commit-Position: refs/heads/master@{#17253}
> Committed: https://chromium.googlesource.com/external/webrtc/+/2549ad4fef419a055671c5be39fcfa27ba573c3b
TBR=sprang@webrtc.org,tommi@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7301,webrtc:7325
Review-Url: https://codereview.webrtc.org/2751063005
Cr-Commit-Position: refs/heads/master@{#17276}
2017-03-16 09:43:44 -07:00
|
|
|
tick_(EventTimerWrapper::Create()),
|
|
|
|
|
thread_(FrameGeneratorCapturer::Run, this, "FrameGeneratorCapturer"),
|
2017-02-27 06:52:10 -08:00
|
|
|
frame_generator_(std::move(frame_generator)),
|
2014-04-24 22:10:24 +00:00
|
|
|
target_fps_(target_fps),
|
Revert of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #11 id:300001 of https://codereview.webrtc.org/2750473002/ )
Reason for revert:
Changes to frame-generator resulted in reduced fps on android and Mac on all tests.
Original issue's description:
> Reland of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2748643002/ )
>
> Reason for revert:
> Reland with fixes to the failing perf tests.
>
> Original issue's description:
> > Revert of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #2 id:90001 of https://codereview.webrtc.org/2744003002/ )
> >
> > Reason for revert:
> > CallPerfTest.ReceivesCpuOveruseAndUnderuse perf test fails due to this CL. It requires very accurate frame rate, which may not be so accurate now.
> >
> > Original issue's description:
> > > Reland of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2743993002/ )
> > >
> > > And enable large full-stack test depending on that change (Reland of https://codereview.webrtc.org/2741823003/)
> > > TBR=stefan@webrtc.org,tommi@webrtc.org
> > > BUG=webrtc:7301,webrtc:7325
> > >
> > > Review-Url: https://codereview.webrtc.org/2744003002
> > > Cr-Commit-Position: refs/heads/master@{#17196}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8c0a5896d1cdc7bb81307c33fa4b3538d8160a0f
> >
> > TBR=stefan@webrtc.org,tommi@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:7301,webrtc:7325
> >
> > Review-Url: https://codereview.webrtc.org/2748643002
> > Cr-Commit-Position: refs/heads/master@{#17198}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/382a72a0d321f19ac9cdc9bb30712cefe2639f88
>
> BUG=webrtc:7301,webrtc:7325
>
> Review-Url: https://codereview.webrtc.org/2750473002
> Cr-Commit-Position: refs/heads/master@{#17253}
> Committed: https://chromium.googlesource.com/external/webrtc/+/2549ad4fef419a055671c5be39fcfa27ba573c3b
TBR=sprang@webrtc.org,tommi@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7301,webrtc:7325
Review-Url: https://codereview.webrtc.org/2751063005
Cr-Commit-Position: refs/heads/master@{#17276}
2017-03-16 09:43:44 -07:00
|
|
|
first_frame_capture_time_(-1) {
|
2017-02-27 06:52:10 -08:00
|
|
|
RTC_DCHECK(frame_generator_);
|
2016-09-16 07:53:41 -07:00
|
|
|
RTC_DCHECK_GT(target_fps, 0);
|
2013-05-29 13:41:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FrameGeneratorCapturer::~FrameGeneratorCapturer() {
|
|
|
|
|
Stop();
|
Revert of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #11 id:300001 of https://codereview.webrtc.org/2750473002/ )
Reason for revert:
Changes to frame-generator resulted in reduced fps on android and Mac on all tests.
Original issue's description:
> Reland of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2748643002/ )
>
> Reason for revert:
> Reland with fixes to the failing perf tests.
>
> Original issue's description:
> > Revert of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #2 id:90001 of https://codereview.webrtc.org/2744003002/ )
> >
> > Reason for revert:
> > CallPerfTest.ReceivesCpuOveruseAndUnderuse perf test fails due to this CL. It requires very accurate frame rate, which may not be so accurate now.
> >
> > Original issue's description:
> > > Reland of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2743993002/ )
> > >
> > > And enable large full-stack test depending on that change (Reland of https://codereview.webrtc.org/2741823003/)
> > > TBR=stefan@webrtc.org,tommi@webrtc.org
> > > BUG=webrtc:7301,webrtc:7325
> > >
> > > Review-Url: https://codereview.webrtc.org/2744003002
> > > Cr-Commit-Position: refs/heads/master@{#17196}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8c0a5896d1cdc7bb81307c33fa4b3538d8160a0f
> >
> > TBR=stefan@webrtc.org,tommi@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:7301,webrtc:7325
> >
> > Review-Url: https://codereview.webrtc.org/2748643002
> > Cr-Commit-Position: refs/heads/master@{#17198}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/382a72a0d321f19ac9cdc9bb30712cefe2639f88
>
> BUG=webrtc:7301,webrtc:7325
>
> Review-Url: https://codereview.webrtc.org/2750473002
> Cr-Commit-Position: refs/heads/master@{#17253}
> Committed: https://chromium.googlesource.com/external/webrtc/+/2549ad4fef419a055671c5be39fcfa27ba573c3b
TBR=sprang@webrtc.org,tommi@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7301,webrtc:7325
Review-Url: https://codereview.webrtc.org/2751063005
Cr-Commit-Position: refs/heads/master@{#17276}
2017-03-16 09:43:44 -07:00
|
|
|
|
|
|
|
|
thread_.Stop();
|
2013-05-29 13:41:03 +00:00
|
|
|
}
|
|
|
|
|
|
2016-04-19 15:01:23 +02:00
|
|
|
void FrameGeneratorCapturer::SetFakeRotation(VideoRotation rotation) {
|
|
|
|
|
rtc::CritScope cs(&lock_);
|
|
|
|
|
fake_rotation_ = rotation;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-29 13:41:03 +00:00
|
|
|
bool FrameGeneratorCapturer::Init() {
|
2013-10-16 11:05:37 +00:00
|
|
|
// This check is added because frame_generator_ might be file based and should
|
|
|
|
|
// not crash because a file moved.
|
|
|
|
|
if (frame_generator_.get() == NULL)
|
|
|
|
|
return false;
|
|
|
|
|
|
Revert of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #11 id:300001 of https://codereview.webrtc.org/2750473002/ )
Reason for revert:
Changes to frame-generator resulted in reduced fps on android and Mac on all tests.
Original issue's description:
> Reland of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2748643002/ )
>
> Reason for revert:
> Reland with fixes to the failing perf tests.
>
> Original issue's description:
> > Revert of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #2 id:90001 of https://codereview.webrtc.org/2744003002/ )
> >
> > Reason for revert:
> > CallPerfTest.ReceivesCpuOveruseAndUnderuse perf test fails due to this CL. It requires very accurate frame rate, which may not be so accurate now.
> >
> > Original issue's description:
> > > Reland of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2743993002/ )
> > >
> > > And enable large full-stack test depending on that change (Reland of https://codereview.webrtc.org/2741823003/)
> > > TBR=stefan@webrtc.org,tommi@webrtc.org
> > > BUG=webrtc:7301,webrtc:7325
> > >
> > > Review-Url: https://codereview.webrtc.org/2744003002
> > > Cr-Commit-Position: refs/heads/master@{#17196}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8c0a5896d1cdc7bb81307c33fa4b3538d8160a0f
> >
> > TBR=stefan@webrtc.org,tommi@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:7301,webrtc:7325
> >
> > Review-Url: https://codereview.webrtc.org/2748643002
> > Cr-Commit-Position: refs/heads/master@{#17198}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/382a72a0d321f19ac9cdc9bb30712cefe2639f88
>
> BUG=webrtc:7301,webrtc:7325
>
> Review-Url: https://codereview.webrtc.org/2750473002
> Cr-Commit-Position: refs/heads/master@{#17253}
> Committed: https://chromium.googlesource.com/external/webrtc/+/2549ad4fef419a055671c5be39fcfa27ba573c3b
TBR=sprang@webrtc.org,tommi@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7301,webrtc:7325
Review-Url: https://codereview.webrtc.org/2751063005
Cr-Commit-Position: refs/heads/master@{#17276}
2017-03-16 09:43:44 -07:00
|
|
|
if (!tick_->StartTimer(true, 1000 / target_fps_))
|
|
|
|
|
return false;
|
|
|
|
|
thread_.Start();
|
|
|
|
|
thread_.SetPriority(rtc::kHighPriority);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2013-05-29 13:41:03 +00:00
|
|
|
|
Revert of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #11 id:300001 of https://codereview.webrtc.org/2750473002/ )
Reason for revert:
Changes to frame-generator resulted in reduced fps on android and Mac on all tests.
Original issue's description:
> Reland of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2748643002/ )
>
> Reason for revert:
> Reland with fixes to the failing perf tests.
>
> Original issue's description:
> > Revert of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #2 id:90001 of https://codereview.webrtc.org/2744003002/ )
> >
> > Reason for revert:
> > CallPerfTest.ReceivesCpuOveruseAndUnderuse perf test fails due to this CL. It requires very accurate frame rate, which may not be so accurate now.
> >
> > Original issue's description:
> > > Reland of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2743993002/ )
> > >
> > > And enable large full-stack test depending on that change (Reland of https://codereview.webrtc.org/2741823003/)
> > > TBR=stefan@webrtc.org,tommi@webrtc.org
> > > BUG=webrtc:7301,webrtc:7325
> > >
> > > Review-Url: https://codereview.webrtc.org/2744003002
> > > Cr-Commit-Position: refs/heads/master@{#17196}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8c0a5896d1cdc7bb81307c33fa4b3538d8160a0f
> >
> > TBR=stefan@webrtc.org,tommi@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:7301,webrtc:7325
> >
> > Review-Url: https://codereview.webrtc.org/2748643002
> > Cr-Commit-Position: refs/heads/master@{#17198}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/382a72a0d321f19ac9cdc9bb30712cefe2639f88
>
> BUG=webrtc:7301,webrtc:7325
>
> Review-Url: https://codereview.webrtc.org/2750473002
> Cr-Commit-Position: refs/heads/master@{#17253}
> Committed: https://chromium.googlesource.com/external/webrtc/+/2549ad4fef419a055671c5be39fcfa27ba573c3b
TBR=sprang@webrtc.org,tommi@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7301,webrtc:7325
Review-Url: https://codereview.webrtc.org/2751063005
Cr-Commit-Position: refs/heads/master@{#17276}
2017-03-16 09:43:44 -07:00
|
|
|
bool FrameGeneratorCapturer::Run(void* obj) {
|
|
|
|
|
static_cast<FrameGeneratorCapturer*>(obj)->InsertFrame();
|
2013-05-29 13:41:03 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FrameGeneratorCapturer::InsertFrame() {
|
|
|
|
|
{
|
2015-05-01 13:00:41 +02:00
|
|
|
rtc::CritScope cs(&lock_);
|
2013-09-19 12:14:03 +00:00
|
|
|
if (sending_) {
|
2015-05-29 17:21:40 -07:00
|
|
|
VideoFrame* frame = frame_generator_->NextFrame();
|
2015-03-18 09:51:05 +00:00
|
|
|
frame->set_ntp_time_ms(clock_->CurrentNtpInMilliseconds());
|
2016-04-19 15:01:23 +02:00
|
|
|
frame->set_rotation(fake_rotation_);
|
2014-04-24 22:10:24 +00:00
|
|
|
if (first_frame_capture_time_ == -1) {
|
2015-03-18 09:51:05 +00:00
|
|
|
first_frame_capture_time_ = frame->ntp_time_ms();
|
2014-04-24 22:10:24 +00:00
|
|
|
}
|
2016-09-16 07:53:41 -07:00
|
|
|
if (sink_)
|
|
|
|
|
sink_->OnFrame(*frame);
|
2013-09-19 12:14:03 +00:00
|
|
|
}
|
2013-05-29 13:41:03 +00:00
|
|
|
}
|
Revert of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #11 id:300001 of https://codereview.webrtc.org/2750473002/ )
Reason for revert:
Changes to frame-generator resulted in reduced fps on android and Mac on all tests.
Original issue's description:
> Reland of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2748643002/ )
>
> Reason for revert:
> Reland with fixes to the failing perf tests.
>
> Original issue's description:
> > Revert of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #2 id:90001 of https://codereview.webrtc.org/2744003002/ )
> >
> > Reason for revert:
> > CallPerfTest.ReceivesCpuOveruseAndUnderuse perf test fails due to this CL. It requires very accurate frame rate, which may not be so accurate now.
> >
> > Original issue's description:
> > > Reland of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2743993002/ )
> > >
> > > And enable large full-stack test depending on that change (Reland of https://codereview.webrtc.org/2741823003/)
> > > TBR=stefan@webrtc.org,tommi@webrtc.org
> > > BUG=webrtc:7301,webrtc:7325
> > >
> > > Review-Url: https://codereview.webrtc.org/2744003002
> > > Cr-Commit-Position: refs/heads/master@{#17196}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8c0a5896d1cdc7bb81307c33fa4b3538d8160a0f
> >
> > TBR=stefan@webrtc.org,tommi@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:7301,webrtc:7325
> >
> > Review-Url: https://codereview.webrtc.org/2748643002
> > Cr-Commit-Position: refs/heads/master@{#17198}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/382a72a0d321f19ac9cdc9bb30712cefe2639f88
>
> BUG=webrtc:7301,webrtc:7325
>
> Review-Url: https://codereview.webrtc.org/2750473002
> Cr-Commit-Position: refs/heads/master@{#17253}
> Committed: https://chromium.googlesource.com/external/webrtc/+/2549ad4fef419a055671c5be39fcfa27ba573c3b
TBR=sprang@webrtc.org,tommi@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7301,webrtc:7325
Review-Url: https://codereview.webrtc.org/2751063005
Cr-Commit-Position: refs/heads/master@{#17276}
2017-03-16 09:43:44 -07:00
|
|
|
tick_->Wait(WEBRTC_EVENT_INFINITE);
|
2013-05-29 13:41:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FrameGeneratorCapturer::Start() {
|
2015-05-01 13:00:41 +02:00
|
|
|
rtc::CritScope cs(&lock_);
|
2013-05-29 13:41:03 +00:00
|
|
|
sending_ = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FrameGeneratorCapturer::Stop() {
|
2015-05-01 13:00:41 +02:00
|
|
|
rtc::CritScope cs(&lock_);
|
2013-05-29 13:41:03 +00:00
|
|
|
sending_ = false;
|
|
|
|
|
}
|
2015-08-03 04:38:41 -07:00
|
|
|
|
2016-10-02 23:45:26 -07:00
|
|
|
void FrameGeneratorCapturer::ChangeResolution(size_t width, size_t height) {
|
|
|
|
|
rtc::CritScope cs(&lock_);
|
|
|
|
|
frame_generator_->ChangeResolution(width, height);
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-01 11:45:46 -07:00
|
|
|
void FrameGeneratorCapturer::SetSinkWantsObserver(SinkWantsObserver* observer) {
|
|
|
|
|
rtc::CritScope cs(&lock_);
|
|
|
|
|
RTC_DCHECK(!sink_wants_observer_);
|
|
|
|
|
sink_wants_observer_ = observer;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 07:53:41 -07:00
|
|
|
void FrameGeneratorCapturer::AddOrUpdateSink(
|
|
|
|
|
rtc::VideoSinkInterface<VideoFrame>* sink,
|
|
|
|
|
const rtc::VideoSinkWants& wants) {
|
|
|
|
|
rtc::CritScope cs(&lock_);
|
2016-11-01 11:45:46 -07:00
|
|
|
RTC_CHECK(!sink_ || sink_ == sink);
|
2016-09-16 07:53:41 -07:00
|
|
|
sink_ = sink;
|
2016-11-01 11:45:46 -07:00
|
|
|
if (sink_wants_observer_)
|
|
|
|
|
sink_wants_observer_->OnSinkWantsChanged(sink, wants);
|
2016-09-16 07:53:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FrameGeneratorCapturer::RemoveSink(
|
|
|
|
|
rtc::VideoSinkInterface<VideoFrame>* sink) {
|
|
|
|
|
rtc::CritScope cs(&lock_);
|
|
|
|
|
RTC_CHECK(sink_ == sink);
|
|
|
|
|
sink_ = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-03 04:38:41 -07:00
|
|
|
void FrameGeneratorCapturer::ForceFrame() {
|
Revert of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #11 id:300001 of https://codereview.webrtc.org/2750473002/ )
Reason for revert:
Changes to frame-generator resulted in reduced fps on android and Mac on all tests.
Original issue's description:
> Reland of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2748643002/ )
>
> Reason for revert:
> Reland with fixes to the failing perf tests.
>
> Original issue's description:
> > Revert of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #2 id:90001 of https://codereview.webrtc.org/2744003002/ )
> >
> > Reason for revert:
> > CallPerfTest.ReceivesCpuOveruseAndUnderuse perf test fails due to this CL. It requires very accurate frame rate, which may not be so accurate now.
> >
> > Original issue's description:
> > > Reland of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2743993002/ )
> > >
> > > And enable large full-stack test depending on that change (Reland of https://codereview.webrtc.org/2741823003/)
> > > TBR=stefan@webrtc.org,tommi@webrtc.org
> > > BUG=webrtc:7301,webrtc:7325
> > >
> > > Review-Url: https://codereview.webrtc.org/2744003002
> > > Cr-Commit-Position: refs/heads/master@{#17196}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8c0a5896d1cdc7bb81307c33fa4b3538d8160a0f
> >
> > TBR=stefan@webrtc.org,tommi@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:7301,webrtc:7325
> >
> > Review-Url: https://codereview.webrtc.org/2748643002
> > Cr-Commit-Position: refs/heads/master@{#17198}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/382a72a0d321f19ac9cdc9bb30712cefe2639f88
>
> BUG=webrtc:7301,webrtc:7325
>
> Review-Url: https://codereview.webrtc.org/2750473002
> Cr-Commit-Position: refs/heads/master@{#17253}
> Committed: https://chromium.googlesource.com/external/webrtc/+/2549ad4fef419a055671c5be39fcfa27ba573c3b
TBR=sprang@webrtc.org,tommi@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7301,webrtc:7325
Review-Url: https://codereview.webrtc.org/2751063005
Cr-Commit-Position: refs/heads/master@{#17276}
2017-03-16 09:43:44 -07:00
|
|
|
tick_->Set();
|
2015-08-03 04:38:41 -07:00
|
|
|
}
|
Revert of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #11 id:300001 of https://codereview.webrtc.org/2750473002/ )
Reason for revert:
Changes to frame-generator resulted in reduced fps on android and Mac on all tests.
Original issue's description:
> Reland of write frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2748643002/ )
>
> Reason for revert:
> Reland with fixes to the failing perf tests.
>
> Original issue's description:
> > Revert of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #2 id:90001 of https://codereview.webrtc.org/2744003002/ )
> >
> > Reason for revert:
> > CallPerfTest.ReceivesCpuOveruseAndUnderuse perf test fails due to this CL. It requires very accurate frame rate, which may not be so accurate now.
> >
> > Original issue's description:
> > > Reland of rewrite frame generator capturer to use TaskQueue instead of EventTimeWrapper (patchset #1 id:1 of https://codereview.webrtc.org/2743993002/ )
> > >
> > > And enable large full-stack test depending on that change (Reland of https://codereview.webrtc.org/2741823003/)
> > > TBR=stefan@webrtc.org,tommi@webrtc.org
> > > BUG=webrtc:7301,webrtc:7325
> > >
> > > Review-Url: https://codereview.webrtc.org/2744003002
> > > Cr-Commit-Position: refs/heads/master@{#17196}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/8c0a5896d1cdc7bb81307c33fa4b3538d8160a0f
> >
> > TBR=stefan@webrtc.org,tommi@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:7301,webrtc:7325
> >
> > Review-Url: https://codereview.webrtc.org/2748643002
> > Cr-Commit-Position: refs/heads/master@{#17198}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/382a72a0d321f19ac9cdc9bb30712cefe2639f88
>
> BUG=webrtc:7301,webrtc:7325
>
> Review-Url: https://codereview.webrtc.org/2750473002
> Cr-Commit-Position: refs/heads/master@{#17253}
> Committed: https://chromium.googlesource.com/external/webrtc/+/2549ad4fef419a055671c5be39fcfa27ba573c3b
TBR=sprang@webrtc.org,tommi@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7301,webrtc:7325
Review-Url: https://codereview.webrtc.org/2751063005
Cr-Commit-Position: refs/heads/master@{#17276}
2017-03-16 09:43:44 -07:00
|
|
|
} // test
|
|
|
|
|
} // webrtc
|