Destroy compression session instead of reset it on release.

This will prevent one extra initialization of the encoder each time
it's recreated.

BUG=None

Review-Url: https://codereview.webrtc.org/2992233002
Cr-Commit-Position: refs/heads/master@{#19250}
This commit is contained in:
kthelgason
2017-08-04 10:18:43 -07:00
committed by Commit Bot
parent 227f8b9be8
commit d48f56de1f

View File

@ -534,12 +534,12 @@ int H264VideoToolboxEncoder::SetRates(uint32_t new_bitrate_kbit,
} }
int H264VideoToolboxEncoder::Release() { int H264VideoToolboxEncoder::Release() {
// Need to reset so that the session is invalidated and won't use the // Need to destroy so that the session is invalidated and won't use the
// callback anymore. Do not remove callback until the session is invalidated // callback anymore. Do not remove callback until the session is invalidated
// since async encoder callbacks can occur until invalidation. // since async encoder callbacks can occur until invalidation.
int ret = ResetCompressionSession(); DestroyCompressionSession();
callback_ = nullptr; callback_ = nullptr;
return ret; return WEBRTC_VIDEO_CODEC_OK;
} }
int H264VideoToolboxEncoder::ResetCompressionSession() { int H264VideoToolboxEncoder::ResetCompressionSession() {