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

Unified Diff: content/renderer/media/rtc_video_encoder_factory.cc

Issue 568413002: Add VEA supported profiles to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: content/renderer/media/rtc_video_encoder_factory.cc
diff --git a/content/renderer/media/rtc_video_encoder_factory.cc b/content/renderer/media/rtc_video_encoder_factory.cc
index ec92f5572f9bd7c1877985cd1e1f3f073186e7f0..a345d957dbe078b478ffebc8895a2402ca3c77d5 100644
--- a/content/renderer/media/rtc_video_encoder_factory.cc
+++ b/content/renderer/media/rtc_video_encoder_factory.cc
@@ -4,7 +4,11 @@
#include "content/renderer/media/rtc_video_encoder_factory.h"
+#include "base/bind.h"
#include "base/command_line.h"
+#include "base/location.h"
+#include "base/message_loop/message_loop_proxy.h"
+#include "base/synchronization/waitable_event.h"
#include "content/common/gpu/client/gpu_video_encode_accelerator_host.h"
#include "content/public/common/content_switches.h"
#include "content/renderer/media/rtc_video_encoder.h"
@@ -22,8 +26,8 @@ void VEAToWebRTCCodecs(
const media::VideoEncodeAccelerator::SupportedProfile& profile) {
int width = profile.max_resolution.width();
int height = profile.max_resolution.height();
- int fps = profile.max_framerate.numerator;
- DCHECK_EQ(profile.max_framerate.denominator, 1U);
+ int fps = profile.max_framerate_numerator;
+ DCHECK_EQ(profile.max_framerate_denominator, 1U);
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (profile.profile >= media::VP8PROFILE_MIN &&
@@ -64,14 +68,18 @@ media::VideoCodecProfile WebRTCCodecToVideoCodecProfile(
RTCVideoEncoderFactory::RTCVideoEncoderFactory(
const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories)
: gpu_factories_(gpu_factories) {
- // Query media::VideoEncodeAccelerator (statically) for our supported codecs.
- std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles =
- GpuVideoEncodeAcceleratorHost::GetSupportedProfiles();
- for (size_t i = 0; i < profiles.size(); ++i)
- VEAToWebRTCCodecs(&codecs_, profiles[i]);
+ // Query media::VideoEncodeAccelerator for our supported codecs.
+ base::WaitableEvent waiter(true, false);
+ gpu_factories_->GetTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&RTCVideoEncoderFactory::GetSupportedCodecs,
+ base::Unretained(this),
+ &waiter));
+ waiter.Wait();
piman 2014/09/18 18:11:51 I don't think the RTCVideoEncoderFactory is create
wuchengli 2014/09/19 14:27:24 RTCVideoEncoderFactory is created in PeerConnectio
}
-RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {}
+RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {
+}
webrtc::VideoEncoder* RTCVideoEncoderFactory::CreateVideoEncoder(
webrtc::VideoCodecType type) {
@@ -104,4 +112,16 @@ void RTCVideoEncoderFactory::DestroyVideoEncoder(
delete encoder;
}
+void RTCVideoEncoderFactory::GetSupportedCodecs(base::WaitableEvent* waiter) {
+ scoped_ptr<media::VideoEncodeAccelerator> video_encoder =
+ gpu_factories_->CreateVideoEncodeAccelerator();
+ if (video_encoder) {
+ std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles =
+ video_encoder->GetSupportedProfiles();
+ for (size_t i = 0; i < profiles.size(); ++i)
+ VEAToWebRTCCodecs(&codecs_, profiles[i]);
+ }
+ waiter->Signal();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698