WebRtcVideoFrame: DCHECK exclusive ownership for non-const pixel access

Add some const safety by DCHECK(HasOneRef()) in non-const GetYPlane. This CL also replaces all incorrect non-const calls with const calls for pixel data access in cricket::VideoFrame. It's easy to call the non-const version of e.g. GetYPlane by mistake, even if only const-access is needed. For example:
const scoped_ptr<cricket::VideoFrame> foo;
const uint8_t* y = foo->GetYPlane();
will actually call the non-const version of GetYPlane.

R=mflodman@webrtc.org, perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8507}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8507 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
magjed@webrtc.org
2015-02-25 14:49:48 +00:00
parent 6c66163567
commit f09e7b8a4f
8 changed files with 39 additions and 25 deletions

View File

@@ -55,15 +55,18 @@
}
- (const uint8_t*)yPlane {
return _videoFrame->GetYPlane();
const cricket::VideoFrame* const_frame = _videoFrame.get();
return const_frame->GetYPlane();
}
- (const uint8_t*)uPlane {
return _videoFrame->GetUPlane();
const cricket::VideoFrame* const_frame = _videoFrame.get();
return const_frame->GetUPlane();
}
- (const uint8_t*)vPlane {
return _videoFrame->GetVPlane();
const cricket::VideoFrame* const_frame = _videoFrame.get();
return const_frame->GetVPlane();
}
- (NSInteger)yPitch {