Skip to content

Commit 1736589

Browse files
Hnoo112233Commit bot
authored and
Commit bot
committed
Reland of Move CoreVideoFrameBuffer from webrtc/common_video/ to webrtc/sdk/objc/ (patchset #1 id:1 of https://codereview.webrtc.org/2862663003/ )
Reason for revert: Keep header file for backwards compatibility Original issue's description: > Revert of Move CoreVideoFrameBuffer from webrtc/common_video/ to webrtc/sdk/objc/ (patchset #2 id:60001 of https://codereview.webrtc.org/2851563003/ ) > > Reason for revert: > Breaks downstream targets. > > Original issue's description: > > Move CoreVideoFrameBuffer from webrtc/common_video/ to webrtc/sdk/objc/ > > > > CoreVideoFrameBuffer is Mac/iPhone specific and should be moved into > > the webrtc/sdk/objc/ folder. > > > > BUG=None > > > > Review-Url: https://codereview.webrtc.org/2851563003 > > Cr-Commit-Position: refs/heads/master@{#17998} > > Committed: https://chromium.googlesource.com/external/webrtc/+/d41631aa274e926c4fba1600cbcfbc18020eb35a > > [email protected],[email protected] > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=None > > Review-Url: https://codereview.webrtc.org/2862663003 > Cr-Commit-Position: refs/heads/master@{#18004} > Committed: https://chromium.googlesource.com/external/webrtc/+/c34e730896032ae730b5917306bb4f79e62d03dd [email protected],[email protected] # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=None Review-Url: https://codereview.webrtc.org/2860033002 Cr-Commit-Position: refs/heads/master@{#18011}
1 parent 76a1ce7 commit 1736589

File tree

3 files changed

+64
-45
lines changed

3 files changed

+64
-45
lines changed

webrtc/common_video/DEPS

+2
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ include_rules = [
22
"+webrtc/base",
33
"+webrtc/media/base",
44
"+webrtc/system_wrappers",
5+
# TODO(magjed): This is temporary, remove once external clients are updated.
6+
"+webrtc/sdk/objc",
57
]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
2+
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
33
*
44
* Use of this source code is governed by a BSD-style license
55
* that can be found in the LICENSE file in the root of the source
@@ -8,52 +8,10 @@
88
* be found in the AUTHORS file in the root of the source tree.
99
*/
1010

11+
// TODO(magjed): Remove this file once external clients are updated.
1112
#ifndef WEBRTC_COMMON_VIDEO_INCLUDE_COREVIDEO_FRAME_BUFFER_H_
1213
#define WEBRTC_COMMON_VIDEO_INCLUDE_COREVIDEO_FRAME_BUFFER_H_
1314

14-
#include <CoreVideo/CoreVideo.h>
15-
16-
#include <vector>
17-
18-
#include "webrtc/common_video/include/video_frame_buffer.h"
19-
20-
namespace webrtc {
21-
22-
class CoreVideoFrameBuffer : public NativeHandleBuffer {
23-
public:
24-
explicit CoreVideoFrameBuffer(CVPixelBufferRef pixel_buffer);
25-
CoreVideoFrameBuffer(CVPixelBufferRef pixel_buffer,
26-
int adapted_width,
27-
int adapted_height,
28-
int crop_width,
29-
int crop_height,
30-
int crop_x,
31-
int crop_y);
32-
~CoreVideoFrameBuffer() override;
33-
34-
rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
35-
// Returns true if the internal pixel buffer needs to be cropped.
36-
bool RequiresCropping() const;
37-
// Crop and scales the internal pixel buffer to the output pixel buffer. The
38-
// tmp buffer is used for intermediary splitting the UV channels. This
39-
// function returns true if successful.
40-
bool CropAndScaleTo(std::vector<uint8_t>* tmp_buffer,
41-
CVPixelBufferRef output_pixel_buffer) const;
42-
43-
private:
44-
CVPixelBufferRef pixel_buffer_;
45-
// buffer_width/height is the actual pixel buffer resolution. The width/height
46-
// in NativeHandleBuffer, i.e. width()/height(), is the resolution we will
47-
// scale to in NativeToI420Buffer(). Cropping happens before scaling, so:
48-
// buffer_width >= crop_width >= width().
49-
const int buffer_width_;
50-
const int buffer_height_;
51-
const int crop_width_;
52-
const int crop_height_;
53-
const int crop_x_;
54-
const int crop_y_;
55-
};
56-
57-
} // namespace webrtc
15+
#include "webrtc/sdk/objc/Framework/Classes/corevideo_frame_buffer.h"
5816

5917
#endif // WEBRTC_COMMON_VIDEO_INCLUDE_COREVIDEO_FRAME_BUFFER_H_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree. An additional intellectual property rights grant can be found
7+
* in the file PATENTS. All contributing project authors may
8+
* be found in the AUTHORS file in the root of the source tree.
9+
*/
10+
11+
#ifndef WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_COREVIDEO_FRAME_BUFFER_H_
12+
#define WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_COREVIDEO_FRAME_BUFFER_H_
13+
14+
#include <CoreVideo/CoreVideo.h>
15+
16+
#include <vector>
17+
18+
#include "webrtc/common_video/include/video_frame_buffer.h"
19+
20+
namespace webrtc {
21+
22+
class CoreVideoFrameBuffer : public NativeHandleBuffer {
23+
public:
24+
explicit CoreVideoFrameBuffer(CVPixelBufferRef pixel_buffer);
25+
CoreVideoFrameBuffer(CVPixelBufferRef pixel_buffer,
26+
int adapted_width,
27+
int adapted_height,
28+
int crop_width,
29+
int crop_height,
30+
int crop_x,
31+
int crop_y);
32+
~CoreVideoFrameBuffer() override;
33+
34+
rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
35+
// Returns true if the internal pixel buffer needs to be cropped.
36+
bool RequiresCropping() const;
37+
// Crop and scales the internal pixel buffer to the output pixel buffer. The
38+
// tmp buffer is used for intermediary splitting the UV channels. This
39+
// function returns true if successful.
40+
bool CropAndScaleTo(std::vector<uint8_t>* tmp_buffer,
41+
CVPixelBufferRef output_pixel_buffer) const;
42+
43+
private:
44+
CVPixelBufferRef pixel_buffer_;
45+
// buffer_width/height is the actual pixel buffer resolution. The width/height
46+
// in NativeHandleBuffer, i.e. width()/height(), is the resolution we will
47+
// scale to in NativeToI420Buffer(). Cropping happens before scaling, so:
48+
// buffer_width >= crop_width >= width().
49+
const int buffer_width_;
50+
const int buffer_height_;
51+
const int crop_width_;
52+
const int crop_height_;
53+
const int crop_x_;
54+
const int crop_y_;
55+
};
56+
57+
} // namespace webrtc
58+
59+
#endif // WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_COREVIDEO_FRAME_BUFFER_H_

0 commit comments

Comments
 (0)