Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1528)

Unified Diff: content/common/gpu/media/vaapi_h264_decoder.cc

Issue 10823246: VAVDA: Fix a crash if we fail parsing SPS/DecodeInitial. (Closed) Base URL: https://git.chromium.org/git/chromium/src@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/media/vaapi_h264_decoder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/vaapi_h264_decoder.cc
diff --git a/content/common/gpu/media/vaapi_h264_decoder.cc b/content/common/gpu/media/vaapi_h264_decoder.cc
index dcdea4c911b5713b3be000154dd8e469b29d598d..0d8643e9de2f8612911de9c725489efa1da86308 100644
--- a/content/common/gpu/media/vaapi_h264_decoder.cc
+++ b/content/common/gpu/media/vaapi_h264_decoder.cc
@@ -323,6 +323,7 @@ VaapiH264Decoder::VaapiH264Decoder() {
max_pic_order_cnt_lsb_ = 0;
state_ = kUninitialized;
num_available_decode_surfaces_ = 0;
+ va_context_created_ = false;
}
VaapiH264Decoder::~VaapiH264Decoder() {
@@ -584,6 +585,8 @@ bool VaapiH264Decoder::CreateVASurfaces() {
return false;
}
+ va_context_created_ = true;
+
return true;
}
@@ -591,12 +594,18 @@ void VaapiH264Decoder::DestroyVASurfaces() {
DCHECK(state_ == kDecoding || state_ == kError || state_ == kAfterReset);
decode_surfaces_.clear();
+ // This can happen if we fail during DecodeInitial.
+ if (!va_context_created_)
+ return;
+
VAStatus va_res = VAAPI_DestroyContext(va_display_, va_context_id_);
VA_LOG_ON_ERROR(va_res, "vaDestroyContext failed");
va_res = VAAPI_DestroySurfaces(va_display_, va_surface_ids_,
GetRequiredNumOfPictures());
VA_LOG_ON_ERROR(va_res, "vaDestroySurfaces failed");
+
+ va_context_created_ = false;
}
void VaapiH264Decoder::DestroyPendingBuffers() {
« no previous file with comments | « content/common/gpu/media/vaapi_h264_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698