Adjust for initial cropping when adapting frame.

When adapting a frame, any initial cropping coordinate was replaced
by the coordinate calculated for adapting. Offset initial coordinate
instead.

BUG=webrtc:7880

Review-Url: https://codereview.webrtc.org/2975613002
Cr-Commit-Position: refs/heads/master@{#19509}
This commit is contained in:
andersc
2017-08-25 01:33:18 -07:00
committed by Commit Bot
parent 8b07305b04
commit 151aa6b3f7
3 changed files with 6 additions and 4 deletions

View File

@ -21,11 +21,11 @@
int _bufferHeight;
int _cropWidth;
int _cropHeight;
int _cropX;
int _cropY;
}
@synthesize pixelBuffer = _pixelBuffer;
@synthesize cropX = _cropX;
@synthesize cropY = _cropY;
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer {
return [self initWithPixelBuffer:pixelBuffer

View File

@ -54,8 +54,8 @@ void ObjcVideoTrackSource::OnCapturedFrame(RTCVideoFrame* frame) {
adaptedHeight:adapted_height
cropWidth:crop_width
cropHeight:crop_height
cropX:crop_x
cropY:crop_y]);
cropX:crop_x + rtcPixelBuffer.cropX
cropY:crop_y + rtcPixelBuffer.cropY]);
} else {
// Adapted I420 frame.
// TODO(magjed): Optimize this I420 path.

View File

@ -69,6 +69,8 @@ RTC_EXPORT
@interface RTCCVPixelBuffer : NSObject <RTCVideoFrameBuffer>
@property(nonatomic, readonly) CVPixelBufferRef pixelBuffer;
@property(nonatomic, readonly) int cropX;
@property(nonatomic, readonly) int cropY;
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer;
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer