Commit 177cc1d1 authored by emircan's avatar emircan Committed by Commit bot

Enable RTCVideoDecoder SW H264 fallback only when it is available

Extensions have HW H264 encode enabled in 51. However SW implementations
of H264 isn't enabled by default. So, we need to be careful about SW fallback
as we cannot do it when it isn't available.

BUG=615513

Review-Url: https://codereview.chromium.org/2024303003
Cr-Commit-Position: refs/heads/master@{#397856}
parent 5ca57dfa
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/webrtc/base/bind.h" #include "third_party/webrtc/base/bind.h"
#include "third_party/webrtc/base/refcount.h" #include "third_party/webrtc/base/refcount.h"
#include "third_party/webrtc/modules/video_coding/codecs/h264/include/h264.h"
#include "third_party/webrtc/video_frame.h" #include "third_party/webrtc/video_frame.h"
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -180,7 +181,10 @@ int32_t RTCVideoDecoder::Decode( ...@@ -180,7 +181,10 @@ int32_t RTCVideoDecoder::Decode(
if (state_ == DECODE_ERROR) { if (state_ == DECODE_ERROR) {
LOG(ERROR) << "Decoding error occurred."; LOG(ERROR) << "Decoding error occurred.";
// Try reseting the session up to |kNumVDAErrorsHandled| times. // Try reseting the session up to |kNumVDAErrorsHandled| times.
if (vda_error_counter_ > kNumVDAErrorsBeforeSWFallback) { // Check if SW H264 implementation is available before falling back.
if (vda_error_counter_ > kNumVDAErrorsBeforeSWFallback &&
(video_codec_type_ != webrtc::kVideoCodecH264 ||
webrtc::H264Decoder::IsSupported())) {
DLOG(ERROR) << vda_error_counter_ DLOG(ERROR) << vda_error_counter_
<< " errors reported by VDA, falling back to software decode"; << " errors reported by VDA, falling back to software decode";
return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment