• Dean Liao's avatar
    media_recorder: Improve VideoTrackRecorder::CanUseAcceleratedEncoder · 00b91cbc
    Dean Liao authored
    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
    CanUseAcceleratedEncoder().
    
    To write unittest for CodecEnumerator, I moved its definition from
    video_track_recorder.cc 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.
    
    BUG=926667
    TEST=Test MediaCapabilities.encodingInfo() API on CrOS devices.
    Pass content_unittest:
    out/Default/content_unittests --gtest_filter=CodecEnumeratorTest.* \
    --gtest_filter=VideoTrackRecorderTest.*
    
    Change-Id: Ifa6d4fc9059214a0c666643700b299d4128e633d
    Reviewed-on: https://chromium-review.googlesource.com/c/1449479Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
    Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
    Commit-Queue: Shuo-Peng Liao <deanliao@google.com>
    Cr-Commit-Position: refs/heads/master@{#634068}
    00b91cbc
video_encode_accelerator.cc 4.31 KB