This is a reland of 890bc3069cbababa19b40ec02684253d60e051b2 Zero bitrate caused division by zero in DCHECK for max bitrate. Added unit tests to ensure that setting zero bitrate does not crash. > Original change's description: > > Cleanup of video packet overhead calculation. > > > > This CL updates the video packet overhead calculation to make it more > > clear. This prepares for future work on improving the accuracy of the > > calculation. > > > > Bug: webrtc:9883 > > Change-Id: I1d623a3e0de45be7b6e4a1f9e3cbe54fd2b8a45a > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138077 > > Commit-Queue: Sebastian Jansson <srte@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#28040} Bug: webrtc:10674 Change-Id: I156d1ee5546ede7e43ae1d9a298dcaba6071230f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140890 Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28212}
How to write code in the api/ directory
Mostly, just follow the regular style guide, but:
- Note that
api/code is not exempt from the “.hand.ccfiles come in pairs” rule, so if you declare something inapi/path/to/foo.h, it should be defined inapi/path/to/foo.cc. - Headers in
api/should, if possible, not#includeheaders outsideapi/. It’s not always possible to avoid this, but be aware that it adds to a small mountain of technical debt that we’re trying to shrink. .ccfiles inapi/, on the other hand, are free to#includeheaders outsideapi/.
That is, the preferred way for api/ code to access non-api/ code is to call
it from a .cc file, so that users of our API headers won’t transitively
#include non-public headers.
For headers in api/ that need to refer to non-public types, forward
declarations are often a lesser evil than including non-public header files. The
usual rules still apply, though.
.cc files in api/ should preferably be kept reasonably small. If a
substantial implementation is needed, consider putting it with our non-public
code, and just call it from the api/ .cc file.