| Index: media/gpu/dxva_video_decode_accelerator_win.cc
|
| diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc
|
| index 42951071961a4d05ba40b715a0a87efc5d96008b..e65f1e857c878fe4b0c712a73cbff69b40184c1d 100644
|
| --- a/media/gpu/dxva_video_decode_accelerator_win.cc
|
| +++ b/media/gpu/dxva_video_decode_accelerator_win.cc
|
| @@ -1549,17 +1549,34 @@ bool DXVAVideoDecodeAccelerator::InitDecoder(VideoCodecProfile profile) {
|
| EGL_ALPHA_SIZE, 0,
|
| EGL_NONE};
|
|
|
| - EGLint num_configs;
|
| -
|
| - if (!eglChooseConfig(egl_display, config_attribs, &egl_config_, 1,
|
| - &num_configs) ||
|
| - num_configs == 0) {
|
| - if (use_fp16_) {
|
| - // Try again, but without use_fp16_
|
| - use_fp16_ = false;
|
| - continue;
|
| + EGLint num_configs = 0;
|
| +
|
| + if (eglChooseConfig(egl_display, config_attribs, NULL, 0, &num_configs) &&
|
| + num_configs > 0) {
|
| + std::vector<EGLConfig> configs(num_configs);
|
| + if (eglChooseConfig(egl_display, config_attribs, configs.data(),
|
| + num_configs, &num_configs)) {
|
| + egl_config_ = configs[0];
|
| + for (int i = 0; i < num_configs; i++) {
|
| + EGLint red_bits;
|
| + eglGetConfigAttrib(egl_display, configs[i], EGL_RED_SIZE, &red_bits);
|
| + // Try to pick a configuration with the right number of bits rather
|
| + // than one that just has enough bits.
|
| + if (red_bits == (use_fp16_ ? 16 : 8)) {
|
| + egl_config_ = configs[i];
|
| + break;
|
| + }
|
| + }
|
| + }
|
| +
|
| + if (!num_configs) {
|
| + if (use_fp16_) {
|
| + // Try again, but without use_fp16_
|
| + use_fp16_ = false;
|
| + continue;
|
| + }
|
| + return false;
|
| }
|
| - return false;
|
| }
|
|
|
| break;
|
|
|