Call vpx_codec_destroy() only if vpx_codec_init() call preceded.
This fixes the issue when Init() with correct codec settings fails because preceding Init() was called with wrong settings. Bug: webrtc:8969 Change-Id: I50e618af6266ef593942fda27839c7c01e8717ae Reviewed-on: https://webrtc-review.googlesource.com/59382 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22271}
This commit is contained in:
committed by
Commit Bot
parent
ede748f14e
commit
9039969de2
@ -279,9 +279,11 @@ int VP8EncoderImpl::Release() {
|
|||||||
}
|
}
|
||||||
while (!encoders_.empty()) {
|
while (!encoders_.empty()) {
|
||||||
vpx_codec_ctx_t& encoder = encoders_.back();
|
vpx_codec_ctx_t& encoder = encoders_.back();
|
||||||
|
if (inited_) {
|
||||||
if (vpx_codec_destroy(&encoder)) {
|
if (vpx_codec_destroy(&encoder)) {
|
||||||
ret_val = WEBRTC_VIDEO_CODEC_MEMORY;
|
ret_val = WEBRTC_VIDEO_CODEC_MEMORY;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
encoders_.pop_back();
|
encoders_.pop_back();
|
||||||
}
|
}
|
||||||
configurations_.clear();
|
configurations_.clear();
|
||||||
@ -1294,9 +1296,11 @@ int VP8DecoderImpl::Release() {
|
|||||||
int ret_val = WEBRTC_VIDEO_CODEC_OK;
|
int ret_val = WEBRTC_VIDEO_CODEC_OK;
|
||||||
|
|
||||||
if (decoder_ != NULL) {
|
if (decoder_ != NULL) {
|
||||||
|
if (inited_) {
|
||||||
if (vpx_codec_destroy(decoder_)) {
|
if (vpx_codec_destroy(decoder_)) {
|
||||||
ret_val = WEBRTC_VIDEO_CODEC_MEMORY;
|
ret_val = WEBRTC_VIDEO_CODEC_MEMORY;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete decoder_;
|
delete decoder_;
|
||||||
decoder_ = NULL;
|
decoder_ = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,9 +101,11 @@ int VP9EncoderImpl::Release() {
|
|||||||
encoded_image_._buffer = nullptr;
|
encoded_image_._buffer = nullptr;
|
||||||
}
|
}
|
||||||
if (encoder_ != nullptr) {
|
if (encoder_ != nullptr) {
|
||||||
|
if (inited_) {
|
||||||
if (vpx_codec_destroy(encoder_)) {
|
if (vpx_codec_destroy(encoder_)) {
|
||||||
ret_val = WEBRTC_VIDEO_CODEC_MEMORY;
|
ret_val = WEBRTC_VIDEO_CODEC_MEMORY;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete encoder_;
|
delete encoder_;
|
||||||
encoder_ = nullptr;
|
encoder_ = nullptr;
|
||||||
}
|
}
|
||||||
@ -1008,11 +1010,13 @@ int VP9DecoderImpl::Release() {
|
|||||||
int ret_val = WEBRTC_VIDEO_CODEC_OK;
|
int ret_val = WEBRTC_VIDEO_CODEC_OK;
|
||||||
|
|
||||||
if (decoder_ != nullptr) {
|
if (decoder_ != nullptr) {
|
||||||
|
if (inited_) {
|
||||||
// When a codec is destroyed libvpx will release any buffers of
|
// When a codec is destroyed libvpx will release any buffers of
|
||||||
// |frame_buffer_pool_| it is currently using.
|
// |frame_buffer_pool_| it is currently using.
|
||||||
if (vpx_codec_destroy(decoder_)) {
|
if (vpx_codec_destroy(decoder_)) {
|
||||||
ret_val = WEBRTC_VIDEO_CODEC_MEMORY;
|
ret_val = WEBRTC_VIDEO_CODEC_MEMORY;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete decoder_;
|
delete decoder_;
|
||||||
decoder_ = nullptr;
|
decoder_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user