Chromium Code Reviews
Help | Chromium Project | Sign in
(8)

Issue 2695203004: Clean up RTCVideoFrame

Can't Edit
Can't Publish+Mail
Start Review
Created:
3 days, 22 hours ago by magjed_webrtc
Modified:
1 hour, 50 minutes ago
Reviewers:
denicija-webrtc
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Clean up RTCVideoFrame RTCVideoFrame is an ObjectiveC version of webrtc::VideoFrame, but it currently contains some extra logic beyond that. We want RTCVideoFrame to be as simple as possible, i.e. just a container with no extra state, so we can use it as input to RTCVideoSource without complicating the interface for consumers. BUG=webrtc:7177

Patch Set 1 #

Total comments: 7

Patch Set 2 : Fix memory leak. Add ObjC rotation enum. Add space in pointer types. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -122 lines) Patch
M webrtc/sdk/objc/Framework/Classes/RTCEAGLVideoView.m View 1 chunk +0 lines, -6 lines 0 comments Download
M webrtc/sdk/objc/Framework/Classes/RTCI420Shader.mm View 1 4 chunks +17 lines, -17 lines 0 comments Download
M webrtc/sdk/objc/Framework/Classes/RTCNativeNV12Shader.mm View 1 3 chunks +2 lines, -4 lines 0 comments Download
M webrtc/sdk/objc/Framework/Classes/RTCOpenGLVideoRenderer.mm View 1 1 chunk +8 lines, -4 lines 0 comments Download
M webrtc/sdk/objc/Framework/Classes/RTCShader.mm View 1 2 chunks +5 lines, -5 lines 0 comments Download
M webrtc/sdk/objc/Framework/Classes/RTCShader+Private.h View 1 2 chunks +2 lines, -1 line 0 comments Download
M webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm View 1 3 chunks +23 lines, -63 lines 0 comments Download
M webrtc/sdk/objc/Framework/Classes/RTCVideoFrame+Private.h View 1 1 chunk +1 line, -5 lines 0 comments Download
M webrtc/sdk/objc/Framework/Classes/RTCVideoRendererAdapter.mm View 1 1 chunk +3 lines, -2 lines 0 comments Download
M webrtc/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrame.h View 1 2 chunks +23 lines, -15 lines 0 comments Download
Commit queue not available (can’t edit this change).

Dependent Patchsets:

Messages

Total messages: 36 (32 generated)
magjed_webrtc
Daniela - please take a look.
3 days, 7 hours ago (2017-02-17 12:16:38 UTC) #19
denicija-webrtc
https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame+Private.h File webrtc/sdk/objc/Framework/Classes/RTCVideoFrame+Private.h (left): https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame+Private.h#oldcode25 webrtc/sdk/objc/Framework/Classes/RTCVideoFrame+Private.h:25: rotation:(webrtc::VideoRotation)rotation I think in general using Enums is better ...
3 days, 3 hours ago (2017-02-17 16:26:34 UTC) #22
denicija-webrtc
https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm File webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm (right): https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm#newcode63 webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm:63: - (RTCVideoFrame*)convertToI420 { On 2017/02/17 16:26:34, denicija-webrtc wrote: > ...
7 hours, 44 minutes ago (2017-02-20 12:17:27 UTC) #23
magjed_webrtc
3 hours, 45 minutes ago (2017-02-20 16:16:44 UTC) #34
https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framewor...
File webrtc/sdk/objc/Framework/Classes/RTCVideoFrame+Private.h (left):

https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framewor...
webrtc/sdk/objc/Framework/Classes/RTCVideoFrame+Private.h:25:
rotation:(webrtc::VideoRotation)rotation
On 2017/02/17 16:26:34, denicija-webrtc wrote:
> I think in general using Enums is better approach than int. Was there any
> particular reason why you decided to remove this?

It caused so many static casts in the implementation file. The reason we can't
use webrtc::VideoRotation in the public header is because it's C++ (because of
the namespace). It leads to this error:
../../webrtc/sdk/objc/Framework/Classes/RTCEAGLVideoView.m -o
obj/webrtc/sdk/objc/Framework/Classes/rtc_sdk_peerconnection_objc.RTCEAGLVideoView.o
In file included from
../../webrtc/sdk/objc/Framework/Classes/RTCEAGLVideoView.m:16:
In file included from
../../webrtc/sdk/objc/Framework/Headers/WebRTC//RTCVideoFrame.h:16:
../../webrtc/common_video/rotation.h:14:1: error: unknown type name 'namespace'
namespace webrtc {

I added a corresponding pure ObjC enum instead now.

https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framewor...
File webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm (right):

https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framewor...
webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm:63: -
(RTCVideoFrame*)convertToI420 {
On 2017/02/20 12:17:27, denicija-webrtc wrote:
> On 2017/02/17 16:26:34, denicija-webrtc wrote:
> > This method might not be safe from memory management perspective since it's
> > allocating new memory and might cause memory leaks (case in, point this
patch
> > increases the memory usage in Mac AppRTCMobile for several GBs).
> > I'd suggest thinking of:
> > 1. Renaming this method to something like newI420Frame or similar 
> > Source:
> >
>
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Me...
> > 
> > 2. Go trough this document
> > http://clang.llvm.org/docs/AutomaticReferenceCounting.html
> > and see if there is a reasonable ownership qualifier that can be applied to
> the
> > return pointer to ease memory management.
> 
> Ok, I've done bit more thinking about this. I think the best way forward to be
> to have this method always return new instance of RTCVideoFrame and name the
> method as newI420VideoFrame.
> We can keep the check for the native_handle() and use the NativeToI420
> conversion only when needed. 
> The creation of the new object *should* not take away too much from the
> optimization

Done.

https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framewor...
File webrtc/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrame.h (right):

https://codereview.webrtc.org/2695203004/diff/100001/webrtc/sdk/objc/Framewor...
webrtc/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrame.h:49: -
(RTCVideoFrame*)convertToI420;
On 2017/02/17 16:26:34, denicija-webrtc wrote:
> Nit: pointer spacing, here and in other places as well.
> RTCVideoFrame* -> RTCVideoFrame *

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f8e48bd