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

Side by Side Diff: content/renderer/media/rtc_video_decoder.cc

Issue 1969673002: Disable HW H264 decoder for Win7 & add enable flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename. Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/rtc_video_decoder.h" 5 #include "content/renderer/media/rtc_video_decoder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/numerics/safe_conversions.h" 13 #include "base/numerics/safe_conversions.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "base/task_runner_util.h" 16 #include "base/task_runner_util.h"
17 #include "content/renderer/media/webrtc/webrtc_video_frame_adapter.h" 17 #include "content/renderer/media/webrtc/webrtc_video_frame_adapter.h"
18 #include "gpu/command_buffer/common/mailbox_holder.h" 18 #include "gpu/command_buffer/common/mailbox_holder.h"
19 #include "media/base/bind_to_current_loop.h" 19 #include "media/base/bind_to_current_loop.h"
20 #include "media/renderers/gpu_video_accelerator_factories.h" 20 #include "media/renderers/gpu_video_accelerator_factories.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "third_party/webrtc/base/bind.h" 22 #include "third_party/webrtc/base/bind.h"
23 #include "third_party/webrtc/base/refcount.h" 23 #include "third_party/webrtc/base/refcount.h"
24 #include "third_party/webrtc/video_frame.h" 24 #include "third_party/webrtc/video_frame.h"
25 25
26 #if defined(OS_WIN)
27 #include "base/command_line.h"
28 #include "base/win/windows_version.h"
29 #include "content/public/common/content_switches.h"
30 #endif // defined(OS_WIN)
31
26 namespace content { 32 namespace content {
27 33
28 const int32_t RTCVideoDecoder::ID_LAST = 0x3FFFFFFF; 34 const int32_t RTCVideoDecoder::ID_LAST = 0x3FFFFFFF;
29 const int32_t RTCVideoDecoder::ID_HALF = 0x20000000; 35 const int32_t RTCVideoDecoder::ID_HALF = 0x20000000;
30 const int32_t RTCVideoDecoder::ID_INVALID = -1; 36 const int32_t RTCVideoDecoder::ID_INVALID = -1;
31 const uint32_t kNumVDAErrorsBeforeSWFallback = 50; 37 const uint32_t kNumVDAErrorsBeforeSWFallback = 50;
32 38
33 // Maximum number of concurrent VDA::Decode() operations RVD will maintain. 39 // Maximum number of concurrent VDA::Decode() operations RVD will maintain.
34 // Higher values allow better pipelining in the GPU, but also require more 40 // Higher values allow better pipelining in the GPU, but also require more
35 // resources. 41 // resources.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 decode_buffers_.end()); 88 decode_buffers_.end());
83 decode_buffers_.clear(); 89 decode_buffers_.clear();
84 ClearPendingBuffers(); 90 ClearPendingBuffers();
85 } 91 }
86 92
87 // static 93 // static
88 std::unique_ptr<RTCVideoDecoder> RTCVideoDecoder::Create( 94 std::unique_ptr<RTCVideoDecoder> RTCVideoDecoder::Create(
89 webrtc::VideoCodecType type, 95 webrtc::VideoCodecType type,
90 media::GpuVideoAcceleratorFactories* factories) { 96 media::GpuVideoAcceleratorFactories* factories) {
91 std::unique_ptr<RTCVideoDecoder> decoder; 97 std::unique_ptr<RTCVideoDecoder> decoder;
98 // See https://bugs.chromium.org/p/webrtc/issues/detail?id=5717.
99 #if defined(OS_WIN)
100 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
101 switches::kEnableWin7WebRtcHWH264Decoding) &&
102 type == webrtc::kVideoCodecH264 &&
103 base::win::GetVersion() == base::win::VERSION_WIN7) {
104 DLOG(ERROR) << "H264 HW decoding on Win7 is not supported.";
105 return decoder;
106 }
107 #endif // defined(OS_WIN)
92 // Convert WebRTC codec type to media codec profile. 108 // Convert WebRTC codec type to media codec profile.
93 media::VideoCodecProfile profile; 109 media::VideoCodecProfile profile;
94 switch (type) { 110 switch (type) {
95 case webrtc::kVideoCodecVP8: 111 case webrtc::kVideoCodecVP8:
96 profile = media::VP8PROFILE_ANY; 112 profile = media::VP8PROFILE_ANY;
97 break; 113 break;
98 case webrtc::kVideoCodecH264: 114 case webrtc::kVideoCodecH264:
99 profile = media::H264PROFILE_MAIN; 115 profile = media::H264PROFILE_MAIN;
100 break; 116 break;
101 default: 117 default:
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 874
859 void RTCVideoDecoder::TryResetVDAErrorCounter_Locked() { 875 void RTCVideoDecoder::TryResetVDAErrorCounter_Locked() {
860 lock_.AssertAcquired(); 876 lock_.AssertAcquired();
861 877
862 if (vda_error_counter_ == 0) 878 if (vda_error_counter_ == 0)
863 return; 879 return;
864 vda_error_counter_ = 0; 880 vda_error_counter_ = 0;
865 } 881 }
866 882
867 } // namespace content 883 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | content/renderer/media/rtc_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698