2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-07 20:46:45 -08:00
|
|
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-07 20:46:45 -08: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.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#ifndef MEDIA_BASE_FAKE_VIDEO_RENDERER_H_
|
|
|
|
|
#define MEDIA_BASE_FAKE_VIDEO_RENDERER_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2019-01-25 20:26:48 +01:00
|
|
|
#include "api/scoped_refptr.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/video/video_frame.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/video/video_frame_buffer.h"
|
|
|
|
|
#include "api/video/video_rotation.h"
|
2018-05-11 11:15:30 +02:00
|
|
|
#include "api/video/video_sink_interface.h"
|
2020-07-07 15:43:11 +02:00
|
|
|
#include "rtc_base/synchronization/mutex.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace cricket {
|
|
|
|
|
|
|
|
|
|
// Faked video renderer that has a callback for actions on rendering.
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@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/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
class FakeVideoRenderer : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
2018-07-26 12:20:40 +02:00
|
|
|
FakeVideoRenderer();
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2018-07-26 12:20:40 +02:00
|
|
|
void OnFrame(const webrtc::VideoFrame& frame) override;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2014-01-14 10:00:58 +00:00
|
|
|
int width() const {
|
2020-07-07 15:43:11 +02:00
|
|
|
webrtc::MutexLock lock(&mutex_);
|
2014-01-14 10:00:58 +00:00
|
|
|
return width_;
|
|
|
|
|
}
|
|
|
|
|
int height() const {
|
2020-07-07 15:43:11 +02:00
|
|
|
webrtc::MutexLock lock(&mutex_);
|
2014-01-14 10:00:58 +00:00
|
|
|
return height_;
|
|
|
|
|
}
|
2019-05-13 16:13:36 +02:00
|
|
|
|
2016-03-20 07:34:29 -07:00
|
|
|
webrtc::VideoRotation rotation() const {
|
2020-07-07 15:43:11 +02:00
|
|
|
webrtc::MutexLock lock(&mutex_);
|
2016-02-12 13:30:57 +01:00
|
|
|
return rotation_;
|
|
|
|
|
}
|
2016-03-17 10:35:23 +01:00
|
|
|
|
2016-09-06 07:52:40 -07:00
|
|
|
int64_t timestamp_us() const {
|
2020-07-07 15:43:11 +02:00
|
|
|
webrtc::MutexLock lock(&mutex_);
|
2016-09-06 07:52:40 -07:00
|
|
|
return timestamp_us_;
|
2016-03-17 10:35:23 +01:00
|
|
|
}
|
2019-05-13 16:13:36 +02:00
|
|
|
|
2014-01-14 10:00:58 +00:00
|
|
|
int num_rendered_frames() const {
|
2020-07-07 15:43:11 +02:00
|
|
|
webrtc::MutexLock lock(&mutex_);
|
2014-01-14 10:00:58 +00:00
|
|
|
return num_rendered_frames_;
|
|
|
|
|
}
|
2019-05-13 16:13:36 +02:00
|
|
|
|
2014-01-14 10:00:58 +00:00
|
|
|
bool black_frame() const {
|
2020-07-07 15:43:11 +02:00
|
|
|
webrtc::MutexLock lock(&mutex_);
|
2014-01-14 10:00:58 +00:00
|
|
|
return black_frame_;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
private:
|
2018-07-26 12:20:40 +02:00
|
|
|
int width_ = 0;
|
|
|
|
|
int height_ = 0;
|
|
|
|
|
webrtc::VideoRotation rotation_ = webrtc::kVideoRotation_0;
|
|
|
|
|
int64_t timestamp_us_ = 0;
|
|
|
|
|
int num_rendered_frames_ = 0;
|
|
|
|
|
bool black_frame_ = false;
|
2020-07-07 15:43:11 +02:00
|
|
|
mutable webrtc::Mutex mutex_;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace cricket
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#endif // MEDIA_BASE_FAKE_VIDEO_RENDERER_H_
|