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

Unified Diff: webrtc/media/engine/webrtcmediaengine.cc

Issue 3008043002: Simplify passing video codec factories in media engine (Closed)
Patch Set: Created 3 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
« no previous file with comments | « webrtc/media/engine/nullwebrtcvideoengine_unittest.cc ('k') | webrtc/media/engine/webrtcvideoengine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcmediaengine.cc
diff --git a/webrtc/media/engine/webrtcmediaengine.cc b/webrtc/media/engine/webrtcmediaengine.cc
index 774b6b7f905948697e4d8750896427d127ea5758..3a61ad73bb6c9057970052d6dfa6917b5bd0aa44 100644
--- a/webrtc/media/engine/webrtcmediaengine.cc
+++ b/webrtc/media/engine/webrtcmediaengine.cc
@@ -24,65 +24,33 @@
namespace cricket {
-class WebRtcMediaEngine2
-#ifdef HAVE_WEBRTC_VIDEO
- : public CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine> {
-#else
- : public CompositeMediaEngine<WebRtcVoiceEngine, NullWebRtcVideoEngine> {
-#endif
- public:
- WebRtcMediaEngine2(
- webrtc::AudioDeviceModule* adm,
- const rtc::scoped_refptr<webrtc::AudioEncoderFactory>&
- audio_encoder_factory,
- const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
- audio_decoder_factory,
- WebRtcVideoEncoderFactory* video_encoder_factory,
- WebRtcVideoDecoderFactory* video_decoder_factory,
- rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
- rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing)
-#ifdef HAVE_WEBRTC_VIDEO
- : CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine>(
- adm,
- audio_encoder_factory,
- audio_decoder_factory,
- audio_mixer,
- audio_processing){
-#else
- : CompositeMediaEngine<WebRtcVoiceEngine, NullWebRtcVideoEngine>(
- adm,
- audio_encoder_factory,
- audio_decoder_factory,
- audio_mixer,
- audio_processing) {
-#endif
- video_.SetExternalDecoderFactory(video_decoder_factory);
- video_.SetExternalEncoderFactory(video_encoder_factory);
- }
-};
-
-} // namespace cricket
+namespace {
-cricket::MediaEngineInterface* CreateWebRtcMediaEngine(
+MediaEngineInterface* CreateWebRtcMediaEngine(
webrtc::AudioDeviceModule* adm,
const rtc::scoped_refptr<webrtc::AudioEncoderFactory>&
audio_encoder_factory,
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
audio_decoder_factory,
- cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
- cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
+ WebRtcVideoEncoderFactory* video_encoder_factory,
+ WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing) {
- return new cricket::WebRtcMediaEngine2(
- adm, audio_encoder_factory, audio_decoder_factory, video_encoder_factory,
- video_decoder_factory, audio_mixer, audio_processing);
-}
-
-void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) {
- delete media_engine;
+#ifdef HAVE_WEBRTC_VIDEO
+ typedef WebRtcVideoEngine VideoEngine;
+ std::tuple<WebRtcVideoEncoderFactory*, WebRtcVideoDecoderFactory*> video_args(
+ video_encoder_factory, video_decoder_factory);
+#else
+ typedef NullWebRtcVideoEngine VideoEngine;
+ std::tuple<> video_args;
+#endif
+ return new CompositeMediaEngine<WebRtcVoiceEngine, VideoEngine>(
+ std::forward_as_tuple(adm, audio_encoder_factory, audio_decoder_factory,
+ audio_mixer, audio_processing),
+ std::move(video_args));
}
-namespace cricket {
+} // namespace
// TODO(ossu): Backwards-compatible interface. Will be deprecated once the
// audio decoder factory is fully plumbed and used throughout WebRTC.
« no previous file with comments | « webrtc/media/engine/nullwebrtcvideoengine_unittest.cc ('k') | webrtc/media/engine/webrtcvideoengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698