media_recorder: Improve VideoTrackRecorder::CanUseAcceleratedEncoder

Right now, VideoTrackRecorder::CanUseAcceleratedEncoder() only matches
if codec is supported by hardware encoder. For video width and height,
it just checks it is at least larger than minimum encoding resolution.

This change overhauls CodecEnumerator class to keep all hardware video
encoder supported profile structure instead of just profile name. So we
can also match if a video's resolution is within hardware encoder's
capability. Also, add an optional argument, framerate, for

To write unittest for CodecEnumerator, I moved its definition from to header file. Also, its constructor
accepts a list of SupportedProfile. And it has a static CodecEnumerator
getter which initializes CodecEnumerator with SupportedProfiles
provided by gpu_factories.

Also, add a four-parameter constructor for SupportedProfile.

TEST=Test MediaCapabilities.encodingInfo() API on CrOS devices.
Pass content_unittest:
out/Default/content_unittests --gtest_filter=CodecEnumeratorTest.* \

Change-Id: Ifa6d4fc9059214a0c666643700b299d4128e633d
Reviewed-by: Miguel Casas <>
Reviewed-by: Dale Curtis <>
Commit-Queue: Shuo-Peng Liao <>
Cr-Commit-Position: refs/heads/master@{#634068}
6 files changed