summaryrefslogtreecommitdiffstats
path: root/remoting/base/encoder_vp8.cc
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/base/encoder_vp8.cc')
-rw-r--r--remoting/base/encoder_vp8.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/remoting/base/encoder_vp8.cc b/remoting/base/encoder_vp8.cc
index 84a0bc6..0bba179 100644
--- a/remoting/base/encoder_vp8.cc
+++ b/remoting/base/encoder_vp8.cc
@@ -37,13 +37,19 @@ EncoderVp8::EncoderVp8()
}
EncoderVp8::~EncoderVp8() {
+ Destroy();
+}
+
+void EncoderVp8::Destroy() {
if (initialized_) {
vpx_codec_err_t ret = vpx_codec_destroy(codec_.get());
DCHECK(ret == VPX_CODEC_OK) << "Failed to destroy codec";
+ initialized_ = false;
}
}
bool EncoderVp8::Init(const gfx::Size& size) {
+ Destroy();
size_ = size;
codec_.reset(new vpx_codec_ctx_t());
image_.reset(new vpx_image_t());