Reland "VP9 decoder: Sets thread count based on resolution, reinit on change."
This is a reland of d5925756980f6e82a55f57532c8d855e954459fb Patchset 2 is a reland of https://webrtc-review.googlesource.com/c/src/+/177012 Patchset 3 is a fix for a potential crash when InitDecode()is called from VideoStreamDecoderImpl::GetDecoder(), where the decoder_settings parameter is a but surprisingly set to nullptr. Original change's description: > VP9 decoder: Sets thread count based on resolution, reinit on change. > > Previously, number of decoder threads for VP9 were always set to 8 but > with a cap at number of cores. This was done since we "can't know" the > resolution that will be used. > > With this change, we now intialize the number of threads based on > resolution given in InitDecode(). If a resolution change happens in > flight, it requires a keyframe. We therefore parse the header from > any key frame and if it has a new resolution, we re-initialize the > decoder. > > The number of threads used is based on pixel count. We set one thread > as target for 1280x720, and scale up lineraly from there. The 8-thread > cap is gone, but still limit it core count. > > This means for instance: 1 <= 720p, 2 for 1080p, 4 for 1440p, 9 for 4K. > > Bug: webrtc:11551 > Change-Id: I14c169a6c651c50bd1b870c4b22bc4495c8448fd > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174460 > Commit-Queue: Erik Språng <sprang@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31507} Bug: webrtc:11551 Change-Id: I2b4b146d0b8319f07ce1660202d6aa4b374eb015 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177246 Reviewed-by: Johannes Kron <kron@webrtc.org> Commit-Queue: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31527}
This commit is contained in:
@ -1733,4 +1733,12 @@ TEST_F(TestVp9Impl, ReenablingUpperLayerAfterKFWithInterlayerPredIsEnabled) {
|
||||
EXPECT_EQ(encoded_frames[0]._frameType, VideoFrameType::kVideoFrameDelta);
|
||||
}
|
||||
|
||||
TEST_F(TestVp9Impl, HandlesEmptyInitDecode) {
|
||||
std::unique_ptr<VideoDecoder> decoder = CreateDecoder();
|
||||
// Check that nullptr settings are ok for decoder.
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder->InitDecode(/*codec_settings=*/nullptr, 1));
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder->Release());
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user