PSA: Use accessors for codec specific infomation in webrtc::VideoCodec

27 views
Skip to first unread message

Harald Alvestrand

unread,
Oct 26, 2016, 8:39:46 AM10/26/16
to WebRTC-discuss
If you have code that includes webrtc/common_types.h and looks like this:

webrtc::VideoCodec foo;
foo.codecSpecificInfo.VP8.somefield = somevalue

you need to change it to use an accessor.
For write access, there's an accessor that returns a pointer:

foo.VP8()->somefield = somevalue

For read access, the accessor returns a const reference:

value = foo.VP8().somefield

If you access the wrong type of codec-specific info, there is a DCHECK that will generate an error (in debug mode), so there's a whole class of errors that shouldn't be possible to do any more.

I expect to land the CL that makes the old field private in about 2 weeks from now.

Harald Alvestrand



Harald Alvestrand

unread,
Nov 10, 2016, 6:36:35 AM11/10/16
to WebRTC-discuss
This change has now landed.

Reply all
Reply to author
Forward
0 new messages