(Auto)update libjingle 69617317-> 69623266

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6508 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
buildbot@webrtc.org 2014-06-20 14:58:56 +00:00
parent 75ce92086c
commit bb2d65895b
8 changed files with 246 additions and 223 deletions

View File

@ -239,14 +239,14 @@ bool PeerConnectionFactory::Initialize_s() {
new cricket::DummyDeviceManager());
// TODO: Need to make sure only one VoE is created inside
// WebRtcMediaEngine.
cricket::MediaEngineInterface* media_engine(
cricket::WebRtcMediaEngineFactory::Create(default_adm_.get(),
NULL, // No secondary adm.
video_encoder_factory_.get(),
video_decoder_factory_.get()));
cricket::WebRtcMediaEngine* webrtc_media_engine(
new cricket::WebRtcMediaEngine(default_adm_.get(),
NULL, // No secondary adm.
video_encoder_factory_.get(),
video_decoder_factory_.get()));
channel_manager_.reset(new cricket::ChannelManager(
media_engine, device_manager, worker_thread_));
webrtc_media_engine, device_manager, worker_thread_));
channel_manager_->SetVideoRtxEnabled(true);
if (!channel_manager_->Init()) {
return false;

View File

@ -908,7 +908,6 @@
'media/webrtc/webrtcexport.h',
'media/webrtc/webrtcmediaengine.cc',
'media/webrtc/webrtcmediaengine.h',
'media/webrtc/webrtcmediaengine.cc',
'media/webrtc/webrtcpassthroughrender.cc',
'media/webrtc/webrtcpassthroughrender.h',
'media/webrtc/webrtctexturevideoframe.cc',

View File

@ -27,39 +27,90 @@
#include "talk/media/base/mediaengine.h"
namespace cricket {
const int MediaEngineInterface::kDefaultAudioDelayOffset = 0;
}
#if !defined(DISABLE_MEDIA_ENGINE_FACTORY)
#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO)
#include "talk/media/webrtc/webrtcmediaengine.h"
#endif // HAVE_WEBRTC_VOICE && HAVE_WEBRTC_VIDEO
#if defined(HAVE_LINPHONE)
#include "talk/media/other/linphonemediaengine.h"
#endif // HAVE_LINPHONE
#if defined(HAVE_WEBRTC_VOICE)
#include "talk/media/webrtc/webrtcvoiceengine.h"
#endif // HAVE_WEBRTC_VOICE
#if defined(HAVE_WEBRTC_VIDEO)
#include "talk/media/webrtc/webrtcvideoengine.h"
#endif // HAVE_WEBRTC_VIDEO
#if defined(HAVE_LMI)
#include "talk/media/base/hybridvideoengine.h"
#include "talk/media/lmi/lmimediaengine.h"
#endif // HAVE_LMI
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG
namespace cricket {
MediaEngineInterface* CreateNullMediaEngine() {
return new NullMediaEngine();
}
#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO)
MediaEngineFactory::MediaEngineCreateFunction
MediaEngineFactory::create_function_ = WebRtcMediaEngineFactory::Create;
#if defined(HAVE_WEBRTC_VOICE)
#define AUDIO_ENG_NAME WebRtcVoiceEngine
#else
MediaEngineFactory::MediaEngineCreateFunction
MediaEngineFactory::create_function_ = CreateNullMediaEngine;
#endif // HAVE_WEBRTC_VIDEO && HAVE_WEBRTC_VOICE
#define AUDIO_ENG_NAME NullVoiceEngine
#endif
#if defined(HAVE_WEBRTC_VIDEO)
#if !defined(HAVE_LMI)
template<>
CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine>::
CompositeMediaEngine() {
video_.SetVoiceEngine(&voice_);
}
#define VIDEO_ENG_NAME WebRtcVideoEngine
#else
// If we have both WebRtcVideoEngine and LmiVideoEngine, enable dual-stack.
// This small class here allows us to hook the WebRtcVideoChannel up to
// the capturer owned by the LMI engine, without infecting the rest of the
// HybridVideoEngine classes with this abstraction violation.
class WebRtcLmiHybridVideoEngine
: public HybridVideoEngine<WebRtcVideoEngine, LmiVideoEngine> {
public:
void SetVoiceEngine(WebRtcVoiceEngine* engine) {
video1_.SetVoiceEngine(engine);
}
};
template<>
CompositeMediaEngine<WebRtcVoiceEngine, WebRtcLmiHybridVideoEngine>::
CompositeMediaEngine() {
video_.SetVoiceEngine(&voice_);
}
#define VIDEO_ENG_NAME WebRtcLmiHybridVideoEngine
#endif
#elif defined(HAVE_LMI)
#define VIDEO_ENG_NAME LmiVideoEngine
#else
#define VIDEO_ENG_NAME NullVideoEngine
#endif
MediaEngineFactory::MediaEngineCreateFunction
MediaEngineFactory::create_function_ = NULL;
MediaEngineFactory::MediaEngineCreateFunction
MediaEngineFactory::SetCreateFunction(MediaEngineCreateFunction function) {
MediaEngineCreateFunction old_function = create_function_;
create_function_ = function;
return old_function;
}
};
MediaEngineInterface* MediaEngineFactory::Create() {
return create_function_();
if (create_function_) {
return create_function_();
} else {
#if defined(HAVE_LINPHONE)
return new LinphoneMediaEngine("", "");
#elif defined(AUDIO_ENG_NAME) && defined(VIDEO_ENG_NAME)
return new CompositeMediaEngine<AUDIO_ENG_NAME, VIDEO_ENG_NAME>();
#else
return new NullMediaEngine();
#endif
}
}
}; // namespace cricket

View File

@ -26,49 +26,7 @@
*/
#include "talk/media/webrtc/webrtcmediaengine.h"
#include "talk/media/webrtc/webrtcvideoengine.h"
#ifdef WEBRTC_CHROMIUM_BUILD
#include "talk/media/webrtc/webrtcvideoengine2.h"
#endif
#include "talk/media/webrtc/webrtcvoiceengine.h"
#ifdef WEBRTC_CHROMIUM_BUILD
#include "webrtc/system_wrappers/interface/field_trial.h"
#endif
namespace cricket {
class WebRtcMediaEngine :
public CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine> {
public:
WebRtcMediaEngine() {}
WebRtcMediaEngine(webrtc::AudioDeviceModule* adm,
webrtc::AudioDeviceModule* adm_sc,
WebRtcVideoEncoderFactory* encoder_factory,
WebRtcVideoDecoderFactory* decoder_factory) {
voice_.SetAudioDeviceModule(adm, adm_sc);
video_.SetVoiceEngine(&voice_);
video_.EnableTimedRender();
video_.SetExternalEncoderFactory(encoder_factory);
video_.SetExternalDecoderFactory(decoder_factory);
}
};
#ifdef WEBRTC_CHROMIUM_BUILD
class WebRtcMediaEngine2 :
public CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine2> {
public:
WebRtcMediaEngine2(webrtc::AudioDeviceModule* adm,
webrtc::AudioDeviceModule* adm_sc,
WebRtcVideoEncoderFactory* encoder_factory,
WebRtcVideoDecoderFactory* decoder_factory) {
voice_.SetAudioDeviceModule(adm, adm_sc);
video_.SetVoiceEngine(&voice_);
video_.EnableTimedRender();
}
};
#endif // WEBRTC_CHROMIUM_BUILD
} // namespace cricket
WRME_EXPORT
cricket::MediaEngineInterface* CreateWebRtcMediaEngine(
@ -88,147 +46,13 @@ cricket::MediaEngineInterface* CreateWebRtcMediaEngine(
WRME_EXPORT
void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) {
delete media_engine;
#ifdef WEBRTC_CHROMIUM_BUILD
if (webrtc::field_trial::FindFullName("WebRTC-NewVideoAPI") == "Enabled") {
delete static_cast<cricket::WebRtcMediaEngine2*>(media_engine);
} else {
#endif // WEBRTC_CHROMIUM_BUILD
delete static_cast<cricket::WebRtcMediaEngine*>(media_engine);
#ifdef WEBRTC_CHROMIUM_BUILD
}
#endif // WEBRTC_CHROMIUM_BUILD
}
namespace cricket {
class DelegatingWebRtcMediaEngine : public cricket::MediaEngineInterface {
public:
DelegatingWebRtcMediaEngine(
webrtc::AudioDeviceModule* adm,
webrtc::AudioDeviceModule* adm_sc,
WebRtcVideoEncoderFactory* encoder_factory,
WebRtcVideoDecoderFactory* decoder_factory)
: delegate_(CreateWebRtcMediaEngine(
adm, adm_sc, encoder_factory, decoder_factory)) {
}
virtual ~DelegatingWebRtcMediaEngine() {
DestroyWebRtcMediaEngine(delegate_);
}
virtual bool Init(talk_base::Thread* worker_thread) OVERRIDE {
return delegate_->Init(worker_thread);
}
virtual void Terminate() OVERRIDE {
delegate_->Terminate();
}
virtual int GetCapabilities() OVERRIDE {
return delegate_->GetCapabilities();
}
virtual VoiceMediaChannel* CreateChannel() OVERRIDE {
return delegate_->CreateChannel();
}
virtual VideoMediaChannel* CreateVideoChannel(
VoiceMediaChannel* voice_media_channel) OVERRIDE {
return delegate_->CreateVideoChannel(voice_media_channel);
}
virtual SoundclipMedia* CreateSoundclip() OVERRIDE {
return delegate_->CreateSoundclip();
}
virtual AudioOptions GetAudioOptions() const OVERRIDE {
return delegate_->GetAudioOptions();
}
virtual bool SetAudioOptions(const AudioOptions& options) OVERRIDE {
return delegate_->SetAudioOptions(options);
}
virtual bool SetVideoOptions(const VideoOptions& options) OVERRIDE {
return delegate_->SetVideoOptions(options);
}
virtual bool SetAudioDelayOffset(int offset) OVERRIDE {
return delegate_->SetAudioDelayOffset(offset);
}
virtual bool SetDefaultVideoEncoderConfig(
const VideoEncoderConfig& config) OVERRIDE {
return delegate_->SetDefaultVideoEncoderConfig(config);
}
virtual VideoEncoderConfig GetDefaultVideoEncoderConfig() const OVERRIDE {
return delegate_->GetDefaultVideoEncoderConfig();
}
virtual bool SetSoundDevices(
const Device* in_device, const Device* out_device) OVERRIDE {
return delegate_->SetSoundDevices(in_device, out_device);
}
virtual bool GetOutputVolume(int* level) OVERRIDE {
return delegate_->GetOutputVolume(level);
}
virtual bool SetOutputVolume(int level) OVERRIDE {
return delegate_->SetOutputVolume(level);
}
virtual int GetInputLevel() OVERRIDE {
return delegate_->GetInputLevel();
}
virtual bool SetLocalMonitor(bool enable) OVERRIDE {
return delegate_->SetLocalMonitor(enable);
}
virtual bool SetLocalRenderer(VideoRenderer* renderer) OVERRIDE {
return delegate_->SetLocalRenderer(renderer);
}
virtual const std::vector<AudioCodec>& audio_codecs() OVERRIDE {
return delegate_->audio_codecs();
}
virtual const std::vector<RtpHeaderExtension>&
audio_rtp_header_extensions() OVERRIDE {
return delegate_->audio_rtp_header_extensions();
}
virtual const std::vector<VideoCodec>& video_codecs() OVERRIDE {
return delegate_->video_codecs();
}
virtual const std::vector<RtpHeaderExtension>&
video_rtp_header_extensions() OVERRIDE {
return delegate_->video_rtp_header_extensions();
}
virtual void SetVoiceLogging(int min_sev, const char* filter) OVERRIDE {
delegate_->SetVoiceLogging(min_sev, filter);
}
virtual void SetVideoLogging(int min_sev, const char* filter) OVERRIDE {
delegate_->SetVideoLogging(min_sev, filter);
}
virtual bool StartAecDump(talk_base::PlatformFile file) OVERRIDE {
return delegate_->StartAecDump(file);
}
virtual bool RegisterVoiceProcessor(
uint32 ssrc, VoiceProcessor* video_processor,
MediaProcessorDirection direction) OVERRIDE {
return delegate_->RegisterVoiceProcessor(ssrc, video_processor, direction);
}
virtual bool UnregisterVoiceProcessor(
uint32 ssrc, VoiceProcessor* video_processor,
MediaProcessorDirection direction) OVERRIDE {
return delegate_->UnregisterVoiceProcessor(ssrc, video_processor,
direction);
}
virtual VideoFormat GetStartCaptureFormat() const OVERRIDE {
return delegate_->GetStartCaptureFormat();
}
virtual sigslot::repeater2<VideoCapturer*, CaptureState>&
SignalVideoCaptureStateChange() {
return delegate_->SignalVideoCaptureStateChange();
}
private:
cricket::MediaEngineInterface* delegate_;
};
#ifndef DISABLE_DEFAULT_MEDIA_ENGINE
MediaEngineInterface* WebRtcMediaEngineFactory::Create() {
return new cricket::WebRtcMediaEngine();
}
MediaEngineInterface* WebRtcMediaEngineFactory::Create(
webrtc::AudioDeviceModule* adm,
webrtc::AudioDeviceModule* adm_sc,
WebRtcVideoEncoderFactory* encoder_factory,
WebRtcVideoDecoderFactory* decoder_factory) {
#if !defined(LIBPEERCONNECTION_LIB) && \
!defined(LIBPEERCONNECTION_IMPLEMENTATION)
return new cricket::DelegatingWebRtcMediaEngine();
#else
return CreateWebRtcMediaEngine(adm, adm_sc, encoder_factory, decoder_factory);
#endif // !defined(LIBPEERCONNECTION_LIB) &&
// !defined(LIBPEERCONNECTION_IMPLEMENTATION)
}
#endif // DISABLE_DEFAULT_MEDIA_ENGINE
} // namespace cricket

View File

@ -40,6 +40,7 @@ class WebRtcVideoDecoderFactory;
class WebRtcVideoEncoderFactory;
}
#if !defined(LIBPEERCONNECTION_LIB) && \
!defined(LIBPEERCONNECTION_IMPLEMENTATION)
@ -52,21 +53,171 @@ cricket::MediaEngineInterface* CreateWebRtcMediaEngine(
WRME_EXPORT
void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine);
#endif // !defined(LIBPEERCONNECTION_LIB) &&
// !defined(LIBPEERCONNECTION_IMPLEMENTATION)
namespace cricket {
class WebRtcMediaEngineFactory {
class WebRtcMediaEngine : public cricket::MediaEngineInterface {
public:
static MediaEngineInterface* Create();
static MediaEngineInterface* Create(
WebRtcMediaEngine(
webrtc::AudioDeviceModule* adm,
webrtc::AudioDeviceModule* adm_sc,
WebRtcVideoEncoderFactory* encoder_factory,
WebRtcVideoDecoderFactory* decoder_factory);
cricket::WebRtcVideoEncoderFactory* encoder_factory,
cricket::WebRtcVideoDecoderFactory* decoder_factory)
: delegate_(CreateWebRtcMediaEngine(
adm, adm_sc, encoder_factory, decoder_factory)) {
}
virtual ~WebRtcMediaEngine() {
DestroyWebRtcMediaEngine(delegate_);
}
virtual bool Init(talk_base::Thread* worker_thread) OVERRIDE {
return delegate_->Init(worker_thread);
}
virtual void Terminate() OVERRIDE {
delegate_->Terminate();
}
virtual int GetCapabilities() OVERRIDE {
return delegate_->GetCapabilities();
}
virtual VoiceMediaChannel* CreateChannel() OVERRIDE {
return delegate_->CreateChannel();
}
virtual VideoMediaChannel* CreateVideoChannel(
VoiceMediaChannel* voice_media_channel) OVERRIDE {
return delegate_->CreateVideoChannel(voice_media_channel);
}
virtual SoundclipMedia* CreateSoundclip() OVERRIDE {
return delegate_->CreateSoundclip();
}
virtual AudioOptions GetAudioOptions() const OVERRIDE {
return delegate_->GetAudioOptions();
}
virtual bool SetAudioOptions(const AudioOptions& options) OVERRIDE {
return delegate_->SetAudioOptions(options);
}
virtual bool SetVideoOptions(const VideoOptions& options) OVERRIDE {
return delegate_->SetVideoOptions(options);
}
virtual bool SetAudioDelayOffset(int offset) OVERRIDE {
return delegate_->SetAudioDelayOffset(offset);
}
virtual bool SetDefaultVideoEncoderConfig(
const VideoEncoderConfig& config) OVERRIDE {
return delegate_->SetDefaultVideoEncoderConfig(config);
}
virtual VideoEncoderConfig GetDefaultVideoEncoderConfig() const OVERRIDE {
return delegate_->GetDefaultVideoEncoderConfig();
}
virtual bool SetSoundDevices(
const Device* in_device, const Device* out_device) OVERRIDE {
return delegate_->SetSoundDevices(in_device, out_device);
}
virtual bool GetOutputVolume(int* level) OVERRIDE {
return delegate_->GetOutputVolume(level);
}
virtual bool SetOutputVolume(int level) OVERRIDE {
return delegate_->SetOutputVolume(level);
}
virtual int GetInputLevel() OVERRIDE {
return delegate_->GetInputLevel();
}
virtual bool SetLocalMonitor(bool enable) OVERRIDE {
return delegate_->SetLocalMonitor(enable);
}
virtual bool SetLocalRenderer(VideoRenderer* renderer) OVERRIDE {
return delegate_->SetLocalRenderer(renderer);
}
virtual const std::vector<AudioCodec>& audio_codecs() OVERRIDE {
return delegate_->audio_codecs();
}
virtual const std::vector<RtpHeaderExtension>&
audio_rtp_header_extensions() OVERRIDE {
return delegate_->audio_rtp_header_extensions();
}
virtual const std::vector<VideoCodec>& video_codecs() OVERRIDE {
return delegate_->video_codecs();
}
virtual const std::vector<RtpHeaderExtension>&
video_rtp_header_extensions() OVERRIDE {
return delegate_->video_rtp_header_extensions();
}
virtual void SetVoiceLogging(int min_sev, const char* filter) OVERRIDE {
delegate_->SetVoiceLogging(min_sev, filter);
}
virtual void SetVideoLogging(int min_sev, const char* filter) OVERRIDE {
delegate_->SetVideoLogging(min_sev, filter);
}
virtual bool StartAecDump(talk_base::PlatformFile file) OVERRIDE {
return delegate_->StartAecDump(file);
}
virtual bool RegisterVoiceProcessor(
uint32 ssrc, VoiceProcessor* video_processor,
MediaProcessorDirection direction) OVERRIDE {
return delegate_->RegisterVoiceProcessor(ssrc, video_processor, direction);
}
virtual bool UnregisterVoiceProcessor(
uint32 ssrc, VoiceProcessor* video_processor,
MediaProcessorDirection direction) OVERRIDE {
return delegate_->UnregisterVoiceProcessor(ssrc, video_processor,
direction);
}
virtual VideoFormat GetStartCaptureFormat() const OVERRIDE {
return delegate_->GetStartCaptureFormat();
}
virtual sigslot::repeater2<VideoCapturer*, CaptureState>&
SignalVideoCaptureStateChange() {
return delegate_->SignalVideoCaptureStateChange();
}
private:
cricket::MediaEngineInterface* delegate_;
};
} // namespace cricket
#else
#include "talk/media/webrtc/webrtcvideoengine.h"
#ifdef WEBRTC_CHROMIUM_BUILD
#include "talk/media/webrtc/webrtcvideoengine2.h"
#endif
#include "talk/media/webrtc/webrtcvoiceengine.h"
namespace cricket {
typedef CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine>
WebRtcCompositeMediaEngine;
class WebRtcMediaEngine : public WebRtcCompositeMediaEngine {
public:
WebRtcMediaEngine(webrtc::AudioDeviceModule* adm,
webrtc::AudioDeviceModule* adm_sc,
WebRtcVideoEncoderFactory* encoder_factory,
WebRtcVideoDecoderFactory* decoder_factory) {
voice_.SetAudioDeviceModule(adm, adm_sc);
video_.SetVoiceEngine(&voice_);
video_.EnableTimedRender();
video_.SetExternalEncoderFactory(encoder_factory);
video_.SetExternalDecoderFactory(decoder_factory);
}
};
#ifdef WEBRTC_CHROMIUM_BUILD
typedef CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine2>
WebRtcCompositeMediaEngine2;
class WebRtcMediaEngine2 : public WebRtcCompositeMediaEngine2 {
public:
WebRtcMediaEngine2(webrtc::AudioDeviceModule* adm,
webrtc::AudioDeviceModule* adm_sc,
WebRtcVideoEncoderFactory* encoder_factory,
WebRtcVideoDecoderFactory* decoder_factory) {
voice_.SetAudioDeviceModule(adm, adm_sc);
video_.SetVoiceEngine(&voice_);
video_.EnableTimedRender();
}
};
#endif
} // namespace cricket
#endif // !defined(LIBPEERCONNECTION_LIB) &&
// !defined(LIBPEERCONNECTION_IMPLEMENTATION)
#endif // TALK_MEDIA_WEBRTCMEDIAENGINE_H_

View File

@ -120,7 +120,7 @@ void ChannelManager::Construct(MediaEngineInterface* me,
audio_options_ = media_engine_->GetAudioOptions();
audio_in_device_ = DeviceManagerInterface::kDefaultDeviceName;
audio_out_device_ = DeviceManagerInterface::kDefaultDeviceName;
audio_delay_offset_ = kDefaultAudioDelayOffset;
audio_delay_offset_ = MediaEngineInterface::kDefaultAudioDelayOffset;
audio_output_volume_ = kNotSetOutputVolume;
local_renderer_ = NULL;
capturing_ = false;

View File

@ -42,8 +42,6 @@
namespace cricket {
const int kDefaultAudioDelayOffset = 0;
class Soundclip;
class VideoProcessor;
class VoiceChannel;

View File

@ -276,7 +276,7 @@ TEST_F(ChannelManagerTest, SetAudioOptionsBeforeInit) {
EXPECT_EQ(options, set_options);
// At this point, the media engine should also be initialized.
EXPECT_EQ(options, fme_->audio_options());
EXPECT_EQ(cricket::kDefaultAudioDelayOffset,
EXPECT_EQ(cricket::MediaEngineInterface::kDefaultAudioDelayOffset,
fme_->audio_delay_offset());
}
@ -303,7 +303,7 @@ TEST_F(ChannelManagerTest, SetAudioOptions) {
fme_->audio_in_device());
EXPECT_EQ(std::string(cricket::DeviceManagerInterface::kDefaultDeviceName),
fme_->audio_out_device());
EXPECT_EQ(cricket::kDefaultAudioDelayOffset,
EXPECT_EQ(cricket::MediaEngineInterface::kDefaultAudioDelayOffset,
fme_->audio_delay_offset());
// Test setting specific values.
AudioOptions options;
@ -315,7 +315,7 @@ TEST_F(ChannelManagerTest, SetAudioOptions) {
EXPECT_TRUE(
fme_->audio_options().auto_gain_control.Get(&auto_gain_control));
EXPECT_TRUE(auto_gain_control);
EXPECT_EQ(cricket::kDefaultAudioDelayOffset,
EXPECT_EQ(cricket::MediaEngineInterface::kDefaultAudioDelayOffset,
fme_->audio_delay_offset());
// Test setting bad values.
EXPECT_FALSE(cm_->SetAudioOptions("audio-in9", "audio-out2", options));