webrtc_m130/media/base/fake_video_renderer.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
1.9 KiB
C
Raw Permalink Normal View History

/*
* Copyright (c) 2011 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.
*/
#ifndef MEDIA_BASE_FAKE_VIDEO_RENDERER_H_
#define MEDIA_BASE_FAKE_VIDEO_RENDERER_H_
#include <stdint.h>
#include "api/scoped_refptr.h"
#include "api/video/video_frame.h"
#include "api/video/video_frame_buffer.h"
#include "api/video/video_rotation.h"
#include "api/video/video_sink_interface.h"
#include "rtc_base/synchronization/mutex.h"
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> {
public:
FakeVideoRenderer();
void OnFrame(const webrtc::VideoFrame& frame) override;
int width() const {
webrtc::MutexLock lock(&mutex_);
return width_;
}
int height() const {
webrtc::MutexLock lock(&mutex_);
return height_;
}
webrtc::VideoRotation rotation() const {
webrtc::MutexLock lock(&mutex_);
return rotation_;
}
Reland of Delete cricket::VideoFrame::GetTimeStamp. (patchset #1 id:1 of https://codereview.webrtc.org/2315703002/ ) Reason for revert: Chrome has now been updated (cl https://codereview.chromium.org/2317673002/). Original issue's description: > Revert of Delete cricket::VideoFrame::GetTimeStamp. (patchset #2 id:150001 of https://codereview.webrtc.org/2310043002/ ) > > Reason for revert: > Broke Chrome fyi bots. See, e.g., > > https://build.chromium.org/p/chromium.webrtc.fyi/builders/Win%20Builder/builds/6730/steps/compile/logs/stdio > > Use of GetTimeStamp must be eliminated in Chrome before relanding. > > Original issue's description: > > Reland of Delete cricket::VideoFrame::GetTimeStamp. (patchset #1 id:1 of https://codereview.webrtc.org/2306953002/ ) > > > > Reason for revert: > > Will reland after downstream projects are updated. > > > > Original issue's description: > > > Revert of Delete cricket::VideoFrame::GetTimeStamp. (patchset #1 id:1 of https://codereview.webrtc.org/2305623002/ ) > > > > > > Reason for revert: > > > Broke downstream project. > > > > > > Original issue's description: > > > > Delete cricket::VideoFrame::GetTimeStamp. > > > > > > > > TBR=tkchin@webrtc.org # Trivial change to VideoRendererAdapter > > > > BUG=webrtc:5682 > > > > > > > > Committed: https://crrev.com/fd6c99e43137d01fa6c120f7160f7c2999d1d8a3 > > > > Cr-Commit-Position: refs/heads/master@{#14037} > > > > > > TBR=perkj@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/bca69e87de5df290f728833a4b3d8af3ae5d88e6 > > > Cr-Commit-Position: refs/heads/master@{#14038} > > > > TBR=perkj@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:5682 > > > > Committed: https://crrev.com/fa1ba19c5c7c57c8d16fae1a5da51877770fd53e > > Cr-Commit-Position: refs/heads/master@{#14089} > > TBR=perkj@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/92b2e0852fcbe7765926755ccee884db965b6231 > Cr-Commit-Position: refs/heads/master@{#14090} TBR=perkj@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5682 Review-Url: https://codereview.webrtc.org/2316493003 Cr-Commit-Position: refs/heads/master@{#14093}
2016-09-06 07:52:40 -07:00
int64_t timestamp_us() const {
webrtc::MutexLock lock(&mutex_);
Reland of Delete cricket::VideoFrame::GetTimeStamp. (patchset #1 id:1 of https://codereview.webrtc.org/2315703002/ ) Reason for revert: Chrome has now been updated (cl https://codereview.chromium.org/2317673002/). Original issue's description: > Revert of Delete cricket::VideoFrame::GetTimeStamp. (patchset #2 id:150001 of https://codereview.webrtc.org/2310043002/ ) > > Reason for revert: > Broke Chrome fyi bots. See, e.g., > > https://build.chromium.org/p/chromium.webrtc.fyi/builders/Win%20Builder/builds/6730/steps/compile/logs/stdio > > Use of GetTimeStamp must be eliminated in Chrome before relanding. > > Original issue's description: > > Reland of Delete cricket::VideoFrame::GetTimeStamp. (patchset #1 id:1 of https://codereview.webrtc.org/2306953002/ ) > > > > Reason for revert: > > Will reland after downstream projects are updated. > > > > Original issue's description: > > > Revert of Delete cricket::VideoFrame::GetTimeStamp. (patchset #1 id:1 of https://codereview.webrtc.org/2305623002/ ) > > > > > > Reason for revert: > > > Broke downstream project. > > > > > > Original issue's description: > > > > Delete cricket::VideoFrame::GetTimeStamp. > > > > > > > > TBR=tkchin@webrtc.org # Trivial change to VideoRendererAdapter > > > > BUG=webrtc:5682 > > > > > > > > Committed: https://crrev.com/fd6c99e43137d01fa6c120f7160f7c2999d1d8a3 > > > > Cr-Commit-Position: refs/heads/master@{#14037} > > > > > > TBR=perkj@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/bca69e87de5df290f728833a4b3d8af3ae5d88e6 > > > Cr-Commit-Position: refs/heads/master@{#14038} > > > > TBR=perkj@webrtc.org > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > BUG=webrtc:5682 > > > > Committed: https://crrev.com/fa1ba19c5c7c57c8d16fae1a5da51877770fd53e > > Cr-Commit-Position: refs/heads/master@{#14089} > > TBR=perkj@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/92b2e0852fcbe7765926755ccee884db965b6231 > Cr-Commit-Position: refs/heads/master@{#14090} TBR=perkj@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5682 Review-Url: https://codereview.webrtc.org/2316493003 Cr-Commit-Position: refs/heads/master@{#14093}
2016-09-06 07:52:40 -07:00
return timestamp_us_;
}
int num_rendered_frames() const {
webrtc::MutexLock lock(&mutex_);
return num_rendered_frames_;
}
bool black_frame() const {
webrtc::MutexLock lock(&mutex_);
return black_frame_;
}
private:
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;
mutable webrtc::Mutex mutex_;
};
} // namespace cricket
#endif // MEDIA_BASE_FAKE_VIDEO_RENDERER_H_