ObjC EncodedImage: Use fixed width integer types

We currently use long for some variables, which causes warnings when
converting from int64_t. We should use fixed width integer types
instead.

BUG=b/65491700

Review-Url: https://codereview.webrtc.org/3009293002
Cr-Commit-Position: refs/heads/master@{#19791}
This commit is contained in:
magjed
2017-09-12 02:29:43 -07:00
committed by Commit Bot
parent 9a2d5c9846
commit 43467b09c8
2 changed files with 16 additions and 15 deletions

View File

@ -12,6 +12,8 @@
#import "RTCVideoCodec+Private.h" #import "RTCVideoCodec+Private.h"
#include "webrtc/rtc_base/safe_conversions.h"
@implementation RTCEncodedImage @implementation RTCEncodedImage
@synthesize buffer = _buffer; @synthesize buffer = _buffer;
@ -35,16 +37,16 @@
_buffer = [NSData dataWithBytesNoCopy:encodedImage._buffer _buffer = [NSData dataWithBytesNoCopy:encodedImage._buffer
length:encodedImage._length length:encodedImage._length
freeWhenDone:NO]; freeWhenDone:NO];
_encodedWidth = encodedImage._encodedWidth; _encodedWidth = rtc::dchecked_cast<int32_t>(encodedImage._encodedWidth);
_encodedHeight = encodedImage._encodedHeight; _encodedHeight = rtc::dchecked_cast<int32_t>(encodedImage._encodedHeight);
_timeStamp = encodedImage._timeStamp; _timeStamp = encodedImage._timeStamp;
_captureTimeMs = encodedImage.capture_time_ms_; _captureTimeMs = encodedImage.capture_time_ms_;
_ntpTimeMs = encodedImage.ntp_time_ms_; _ntpTimeMs = encodedImage.ntp_time_ms_;
_flags = encodedImage.timing_.flags; _flags = encodedImage.timing_.flags;
_encodeStartMs = encodedImage.timing_.encode_start_ms; _encodeStartMs = encodedImage.timing_.encode_start_ms;
_encodeFinishMs = encodedImage.timing_.encode_finish_ms; _encodeFinishMs = encodedImage.timing_.encode_finish_ms;
_frameType = (RTCFrameType)encodedImage._frameType; _frameType = static_cast<RTCFrameType>(encodedImage._frameType);
_rotation = encodedImage.rotation_; _rotation = static_cast<RTCVideoRotation>(encodedImage.rotation_);
_completeFrame = encodedImage._completeFrame; _completeFrame = encodedImage._completeFrame;
_qp = encodedImage.qp_ == -1 ? nil : @(encodedImage.qp_); _qp = encodedImage.qp_ == -1 ? nil : @(encodedImage.qp_);
_contentType = (encodedImage.content_type_ == webrtc::VideoContentType::SCREENSHARE) ? _contentType = (encodedImage.content_type_ == webrtc::VideoContentType::SCREENSHARE) ?
@ -59,8 +61,8 @@
// Return the pointer without copying. // Return the pointer without copying.
webrtc::EncodedImage encodedImage( webrtc::EncodedImage encodedImage(
(uint8_t *)_buffer.bytes, (size_t)_buffer.length, (size_t)_buffer.length); (uint8_t *)_buffer.bytes, (size_t)_buffer.length, (size_t)_buffer.length);
encodedImage._encodedWidth = _encodedWidth; encodedImage._encodedWidth = rtc::dchecked_cast<uint32_t>(_encodedWidth);
encodedImage._encodedHeight = _encodedHeight; encodedImage._encodedHeight = rtc::dchecked_cast<uint32_t>(_encodedHeight);
encodedImage._timeStamp = _timeStamp; encodedImage._timeStamp = _timeStamp;
encodedImage.capture_time_ms_ = _captureTimeMs; encodedImage.capture_time_ms_ = _captureTimeMs;
encodedImage.ntp_time_ms_ = _ntpTimeMs; encodedImage.ntp_time_ms_ = _ntpTimeMs;

View File

@ -11,8 +11,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <WebRTC/RTCMacros.h> #import <WebRTC/RTCMacros.h>
#import <WebRTC/RTCVideoFrame.h>
@class RTCVideoFrame;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -35,16 +34,16 @@ RTC_EXPORT
@interface RTCEncodedImage : NSObject @interface RTCEncodedImage : NSObject
@property(nonatomic, strong) NSData *buffer; @property(nonatomic, strong) NSData *buffer;
@property(nonatomic, assign) int encodedWidth; @property(nonatomic, assign) int32_t encodedWidth;
@property(nonatomic, assign) int encodedHeight; @property(nonatomic, assign) int32_t encodedHeight;
@property(nonatomic, assign) uint32_t timeStamp; @property(nonatomic, assign) uint32_t timeStamp;
@property(nonatomic, assign) long captureTimeMs; @property(nonatomic, assign) int64_t captureTimeMs;
@property(nonatomic, assign) long ntpTimeMs; @property(nonatomic, assign) int64_t ntpTimeMs;
@property(nonatomic, assign) uint8_t flags; @property(nonatomic, assign) uint8_t flags;
@property(nonatomic, assign) long encodeStartMs; @property(nonatomic, assign) int64_t encodeStartMs;
@property(nonatomic, assign) long encodeFinishMs; @property(nonatomic, assign) int64_t encodeFinishMs;
@property(nonatomic, assign) RTCFrameType frameType; @property(nonatomic, assign) RTCFrameType frameType;
@property(nonatomic, assign) int rotation; @property(nonatomic, assign) RTCVideoRotation rotation;
@property(nonatomic, assign) BOOL completeFrame; @property(nonatomic, assign) BOOL completeFrame;
@property(nonatomic, strong) NSNumber *qp; @property(nonatomic, strong) NSNumber *qp;
@property(nonatomic, assign) RTCVideoContentType contentType; @property(nonatomic, assign) RTCVideoContentType contentType;