Files
platform-external-webrtc/webrtc/common_video/interface/texture_video_frame.h
magjed@webrtc.org 97ed2a4b70 I420VideoFrame: Remove function ResetSize
This is a partial reland of https://webrtc-codereview.appspot.com/39939004/.

The original CL was reverted because ViECapturer use ResetSize/IsZeroSize on |captured_frame_| as a check to make sure each captured frame is only delivered once. Removing ResetSize introduced a race condition where a captured frame could be delivered multiple times.

I have fixed this problem in this CL by replacing ResetSize with scoped_ptr::release.

BUG=4352
R=perkj@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/39359004

Cr-Commit-Position: refs/heads/master@{#8561}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8561 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-02 17:33:41 +00:00

85 lines
3.1 KiB
C++

/*
* 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.
*/
#ifndef COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H
#define COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H
// TextureVideoFrame class
//
// Storing and handling of video frames backed by textures.
#include "webrtc/common_video/interface/i420_video_frame.h"
#include "webrtc/common_video/interface/native_handle.h"
#include "webrtc/system_wrappers/interface/scoped_refptr.h"
#include "webrtc/typedefs.h"
namespace webrtc {
class TextureVideoFrame : public I420VideoFrame {
public:
TextureVideoFrame(NativeHandle* handle,
int width,
int height,
uint32_t timestamp,
int64_t render_time_ms);
virtual ~TextureVideoFrame();
// I420VideoFrame implementation
virtual int CreateEmptyFrame(int width,
int height,
int stride_y,
int stride_u,
int stride_v) OVERRIDE;
virtual int CreateFrame(int size_y,
const uint8_t* buffer_y,
int size_u,
const uint8_t* buffer_u,
int size_v,
const uint8_t* buffer_v,
int width,
int height,
int stride_y,
int stride_u,
int stride_v) OVERRIDE;
virtual int CreateFrame(int size_y,
const uint8_t* buffer_y,
int size_u,
const uint8_t* buffer_u,
int size_v,
const uint8_t* buffer_v,
int width,
int height,
int stride_y,
int stride_u,
int stride_v,
webrtc::VideoRotation rotation) OVERRIDE;
virtual int CopyFrame(const I420VideoFrame& videoFrame) OVERRIDE;
virtual I420VideoFrame* CloneFrame() const OVERRIDE;
virtual void SwapFrame(I420VideoFrame* videoFrame) OVERRIDE;
virtual uint8_t* buffer(PlaneType type) OVERRIDE;
virtual const uint8_t* buffer(PlaneType type) const OVERRIDE;
virtual int allocated_size(PlaneType type) const OVERRIDE;
virtual int stride(PlaneType type) const OVERRIDE;
virtual bool IsZeroSize() const OVERRIDE;
virtual void* native_handle() const OVERRIDE;
protected:
virtual int CheckDimensions(
int width, int height, int stride_y, int stride_u, int stride_v) OVERRIDE;
private:
// An opaque handle that stores the underlying video frame.
scoped_refptr<NativeHandle> handle_;
};
} // namespace webrtc
#endif // COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H