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

Side by Side Diff: content/renderer/media_recorder/video_track_recorder.cc

Issue 2775453003: Fix multiple Initialize() calls and reenable VEA usage in MediaRecorder for Win8 (Closed)
Patch Set: Drop all frames. Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_recorder/video_track_recorder.h" 5 #include "content/renderer/media_recorder/video_track_recorder.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"
(...skipping 12 matching lines...) Expand all
23 #include "media/base/bind_to_current_loop.h" 23 #include "media/base/bind_to_current_loop.h"
24 #include "media/base/video_frame.h" 24 #include "media/base/video_frame.h"
25 #include "media/base/video_util.h" 25 #include "media/base/video_util.h"
26 #include "media/filters/context_3d.h" 26 #include "media/filters/context_3d.h"
27 #include "media/renderers/skcanvas_video_renderer.h" 27 #include "media/renderers/skcanvas_video_renderer.h"
28 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 28 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
29 #include "skia/ext/platform_canvas.h" 29 #include "skia/ext/platform_canvas.h"
30 #include "third_party/libyuv/include/libyuv.h" 30 #include "third_party/libyuv/include/libyuv.h"
31 #include "ui/gfx/geometry/size.h" 31 #include "ui/gfx/geometry/size.h"
32 32
33 #if defined(OS_WIN)
34 #include "base/win/windows_version.h"
35 #endif
36
37 #if BUILDFLAG(RTC_USE_H264) 33 #if BUILDFLAG(RTC_USE_H264)
38 #include "third_party/openh264/src/codec/api/svc/codec_api.h" 34 #include "third_party/openh264/src/codec/api/svc/codec_api.h"
39 #include "third_party/openh264/src/codec/api/svc/codec_app_def.h" 35 #include "third_party/openh264/src/codec/api/svc/codec_app_def.h"
40 #include "third_party/openh264/src/codec/api/svc/codec_def.h" 36 #include "third_party/openh264/src/codec/api/svc/codec_def.h"
41 #endif // #if BUILDFLAG(RTC_USE_H264) 37 #endif // #if BUILDFLAG(RTC_USE_H264)
42 38
43 extern "C" { 39 extern "C" {
44 // VPX_CODEC_DISABLE_COMPAT excludes parts of the libvpx API that provide 40 // VPX_CODEC_DISABLE_COMPAT excludes parts of the libvpx API that provide
45 // backwards compatibility for legacy applications using the library. 41 // backwards compatibility for legacy applications using the library.
46 #define VPX_CODEC_DISABLE_COMPAT 1 42 #define VPX_CODEC_DISABLE_COMPAT 1
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #if defined(OS_CHROMEOS) 110 #if defined(OS_CHROMEOS)
115 // See https://crbug.com/616659. 111 // See https://crbug.com/616659.
116 return; 112 return;
117 #endif 113 #endif
118 114
119 #if defined(OS_ANDROID) 115 #if defined(OS_ANDROID)
120 // See https://crbug.com/653864. 116 // See https://crbug.com/653864.
121 return; 117 return;
122 #endif 118 #endif
123 119
124 #if defined(OS_WIN)
125 // See https://crbug.com/698441.
126 if (base::win::GetVersion() < base::win::VERSION_WIN10)
127 return;
128 #endif
129
130 content::RenderThreadImpl* const render_thread_impl = 120 content::RenderThreadImpl* const render_thread_impl =
131 content::RenderThreadImpl::current(); 121 content::RenderThreadImpl::current();
132 if (!render_thread_impl) { 122 if (!render_thread_impl) {
133 DVLOG(2) << "Couldn't access the render thread"; 123 DVLOG(2) << "Couldn't access the render thread";
134 return; 124 return;
135 } 125 }
136 126
137 media::GpuVideoAcceleratorFactories* const gpu_factories = 127 media::GpuVideoAcceleratorFactories* const gpu_factories =
138 render_thread_impl->GetGpuFactories(); 128 render_thread_impl->GetGpuFactories();
139 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { 129 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) {
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 1286
1297 void VideoTrackRecorder::InitializeEncoder( 1287 void VideoTrackRecorder::InitializeEncoder(
1298 CodecId codec, 1288 CodecId codec,
1299 const OnEncodedVideoCB& on_encoded_video_callback, 1289 const OnEncodedVideoCB& on_encoded_video_callback,
1300 int32_t bits_per_second, 1290 int32_t bits_per_second,
1301 const scoped_refptr<media::VideoFrame>& frame, 1291 const scoped_refptr<media::VideoFrame>& frame,
1302 base::TimeTicks capture_time) { 1292 base::TimeTicks capture_time) {
1303 DVLOG(3) << __func__ << frame->visible_rect().size().ToString(); 1293 DVLOG(3) << __func__ << frame->visible_rect().size().ToString();
1304 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 1294 DCHECK(main_render_thread_checker_.CalledOnValidThread());
1305 1295
1296 // Avoid reinitializing |encoder_| when there are multiple frames sent to the
1297 // sink to initialize, https://crbug.com/698441.
1298 if (encoder_)
1299 return;
1300
1306 MediaStreamVideoSink::DisconnectFromTrack(); 1301 MediaStreamVideoSink::DisconnectFromTrack();
1307 1302
1308 const gfx::Size& input_size = frame->visible_rect().size(); 1303 const gfx::Size& input_size = frame->visible_rect().size();
1309 const auto& vea_supported_profile = 1304 const auto& vea_supported_profile =
1310 GetCodecEnumerator()->CodecIdToVEAProfile(codec); 1305 GetCodecEnumerator()->CodecIdToVEAProfile(codec);
1311 if (vea_supported_profile != media::VIDEO_CODEC_PROFILE_UNKNOWN && 1306 if (vea_supported_profile != media::VIDEO_CODEC_PROFILE_UNKNOWN &&
1312 input_size.width() >= kVEAEncoderMinResolutionWidth && 1307 input_size.width() >= kVEAEncoderMinResolutionWidth &&
1313 input_size.height() >= kVEAEncoderMinResolutionHeight) { 1308 input_size.height() >= kVEAEncoderMinResolutionHeight) {
1314 encoder_ = new VEAEncoder(on_encoded_video_callback, bits_per_second, 1309 encoder_ = new VEAEncoder(on_encoded_video_callback, bits_per_second,
1315 vea_supported_profile, input_size); 1310 vea_supported_profile, input_size);
(...skipping 24 matching lines...) Expand all
1340 base::Bind(&VideoTrackRecorder::Encoder::StartFrameEncode, encoder_), 1335 base::Bind(&VideoTrackRecorder::Encoder::StartFrameEncode, encoder_),
1341 false); 1336 false);
1342 } 1337 }
1343 1338
1344 bool VideoTrackRecorder::CanEncodeAlphaChannelForTesting() { 1339 bool VideoTrackRecorder::CanEncodeAlphaChannelForTesting() {
1345 DCHECK(encoder_); 1340 DCHECK(encoder_);
1346 return encoder_->CanEncodeAlphaChannel(); 1341 return encoder_->CanEncodeAlphaChannel();
1347 } 1342 }
1348 1343
1349 } // namespace content 1344 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698