Reason for revert: Relanding because this doesn't actually break the bot. The issue the caused the test to crash on the bot should be fixed by: https://codereview.webrtc.org/1815733002/ Original issue's description: > Revert of Change VideoCapture_apply_rotation default to false (patchset #4 id:80001 of https://codereview.webrtc.org/1779883004/ ) > > Reason for revert: > Seems to break on linux ubsan > > https://build.chromium.org/p/client.webrtc/builders/Linux%20UBSan/builds/247 > > Original issue's description: > > Change VideoCapture_apply_rotation default to false > > > > BUG=webrtc:5621 > > R=pthatcher@webrtc.org > > > > Committed: https://crrev.com/6919457319b0088ed8b68db30f68a03966d67121 > > Cr-Commit-Position: refs/heads/master@{#12052} > > TBR=pthatcher@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:5621 > > Committed: https://crrev.com/223b982785573323aa399de4f2e551cadbaace8d > Cr-Commit-Position: refs/heads/master@{#12053} TBR=pthatcher@webrtc.org,perkj@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5621 Review URL: https://codereview.webrtc.org/1809943006 Cr-Commit-Position: refs/heads/master@{#12054}
63 lines
2.2 KiB
C++
63 lines
2.2 KiB
C++
/*
|
|
* Copyright (c) 2014 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 WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_
|
|
#define WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_
|
|
|
|
#include <memory>
|
|
|
|
#include "webrtc/media/base/videoframe.h"
|
|
|
|
namespace cricket {
|
|
|
|
struct CapturedFrame;
|
|
class VideoFrame;
|
|
|
|
// Creates cricket::VideoFrames, or a subclass of cricket::VideoFrame
|
|
// depending on the subclass of VideoFrameFactory.
|
|
class VideoFrameFactory {
|
|
public:
|
|
VideoFrameFactory() : apply_rotation_(false) {}
|
|
virtual ~VideoFrameFactory() {}
|
|
|
|
// The returned frame aliases the aliased_frame if the input color
|
|
// space allows for aliasing, otherwise a color conversion will
|
|
// occur. Returns NULL if conversion fails.
|
|
|
|
// The returned frame will be a center crop of |input_frame| with
|
|
// size |cropped_width| x |cropped_height|.
|
|
virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame,
|
|
int cropped_width,
|
|
int cropped_height) const = 0;
|
|
|
|
// The returned frame will be a center crop of |input_frame| with size
|
|
// |cropped_width| x |cropped_height|, scaled to |output_width| x
|
|
// |output_height|.
|
|
virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame,
|
|
int cropped_input_width,
|
|
int cropped_input_height,
|
|
int output_width,
|
|
int output_height) const;
|
|
|
|
void SetApplyRotation(bool enable) { apply_rotation_ = enable; }
|
|
|
|
protected:
|
|
bool apply_rotation_;
|
|
|
|
private:
|
|
// An internal frame buffer to avoid reallocations. It is mutable because it
|
|
// does not affect behaviour, only performance.
|
|
mutable std::unique_ptr<VideoFrame> output_frame_;
|
|
};
|
|
|
|
} // namespace cricket
|
|
|
|
#endif // WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_
|