(Auto)update libjingle 77689511-> 77696841

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7449 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
buildbot@webrtc.org 2014-10-14 20:29:28 +00:00
parent 43336b6b9f
commit 1ecbe45c7e
18 changed files with 113 additions and 52 deletions

View File

@ -90,9 +90,8 @@ class MockWebRtcSession : public webrtc::WebRtcSession {
class MockVideoMediaChannel : public cricket::FakeVideoMediaChannel {
public:
MockVideoMediaChannel()
: cricket::FakeVideoMediaChannel(NULL) {
}
MockVideoMediaChannel() : cricket::FakeVideoMediaChannel(NULL) {}
// MOCK_METHOD0(transport_channel, cricket::TransportChannel*());
MOCK_METHOD2(GetStats, bool(const StatsOptions&, cricket::VideoMediaInfo*));
};

View File

@ -1533,12 +1533,8 @@ bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) {
bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) {
video_channel_.reset(channel_manager_->CreateVideoChannel(
this, content->name, true, voice_channel_.get()));
if (!video_channel_.get())
return false;
video_channel_->SetChannelOptions(video_options_);
return true;
this, content->name, true, video_options_, voice_channel_.get()));
return video_channel_.get() != NULL;
}
bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) {

View File

@ -477,6 +477,7 @@ class FakeVideoMediaChannel : public RtpHelper<VideoMediaChannel> {
sent_intra_frame_(false),
requested_intra_frame_(false),
max_bps_(-1) {}
~FakeVideoMediaChannel();
const std::vector<VideoCodec>& recv_codecs() const { return recv_codecs_; }
@ -885,12 +886,14 @@ class FakeVideoEngine : public FakeBaseEngine {
return default_encoder_config_;
}
VideoMediaChannel* CreateChannel(VoiceMediaChannel* channel) {
VideoMediaChannel* CreateChannel(const VideoOptions& options,
VoiceMediaChannel* channel) {
if (fail_create_channel_) {
return NULL;
}
FakeVideoMediaChannel* ch = new FakeVideoMediaChannel(this);
ch->SetOptions(options);
channels_.push_back(ch);
return ch;
}

View File

@ -88,6 +88,7 @@ VoiceMediaChannel* FileMediaEngine::CreateChannel() {
}
VideoMediaChannel* FileMediaEngine::CreateVideoChannel(
const VideoOptions& options,
VoiceMediaChannel* voice_ch) {
rtc::FileStream* input_file_stream = NULL;
rtc::FileStream* output_file_stream = NULL;
@ -114,8 +115,10 @@ VideoMediaChannel* FileMediaEngine::CreateVideoChannel(
}
}
return new FileVideoChannel(input_file_stream, output_file_stream,
rtp_sender_thread_);
FileVideoChannel* channel = new FileVideoChannel(
input_file_stream, output_file_stream, rtp_sender_thread_);
channel->SetOptions(options);
return channel;
}
///////////////////////////////////////////////////////////////////////////

View File

@ -84,7 +84,8 @@ class FileMediaEngine : public MediaEngineInterface {
virtual void Terminate() {}
virtual int GetCapabilities();
virtual VoiceMediaChannel* CreateChannel();
virtual VideoMediaChannel* CreateVideoChannel(VoiceMediaChannel* voice_ch);
virtual VideoMediaChannel* CreateVideoChannel(const VideoOptions& options,
VoiceMediaChannel* voice_ch);
virtual SoundclipMedia* CreateSoundclip() { return NULL; }
virtual AudioOptions GetAudioOptions() const { return AudioOptions(); }
virtual bool SetAudioOptions(const AudioOptions& options) { return true; }

View File

@ -139,7 +139,7 @@ class FileMediaEngineTest : public testing::Test {
engine_->set_rtp_sender_thread(rtc::Thread::Current());
voice_channel_.reset(engine_->CreateChannel());
video_channel_.reset(engine_->CreateVideoChannel(NULL));
video_channel_.reset(engine_->CreateVideoChannel(VideoOptions(), NULL));
return ret;
}
@ -247,7 +247,7 @@ TEST_F(FileMediaEngineTest, TestBadFilePath) {
engine_->set_voice_input_filename(kFakeFileName);
engine_->set_video_input_filename(kFakeFileName);
EXPECT_TRUE(engine_->CreateChannel() == NULL);
EXPECT_TRUE(engine_->CreateVideoChannel(NULL) == NULL);
EXPECT_TRUE(engine_->CreateVideoChannel(VideoOptions(), NULL) == NULL);
}
TEST_F(FileMediaEngineTest, TestCodecs) {

View File

@ -80,7 +80,8 @@ class MediaEngineInterface {
virtual VoiceMediaChannel *CreateChannel() = 0;
// Creates a video media channel, paired with the specified voice channel.
// Returns NULL on failure.
virtual VideoMediaChannel *CreateVideoChannel(
virtual VideoMediaChannel* CreateVideoChannel(
const VideoOptions& options,
VoiceMediaChannel* voice_media_channel) = 0;
// Creates a soundclip object for playing sounds on. Returns NULL on failure.
@ -198,8 +199,9 @@ class CompositeMediaEngine : public MediaEngineInterface {
virtual VoiceMediaChannel *CreateChannel() {
return voice_.CreateChannel();
}
virtual VideoMediaChannel *CreateVideoChannel(VoiceMediaChannel* channel) {
return video_.CreateChannel(channel);
virtual VideoMediaChannel* CreateVideoChannel(const VideoOptions& options,
VoiceMediaChannel* channel) {
return video_.CreateChannel(options, channel);
}
virtual SoundclipMedia *CreateSoundclip() {
return voice_.CreateSoundclip();

View File

@ -495,7 +495,7 @@ class VideoMediaChannelTest : public testing::Test,
virtual void SetUp() {
cricket::Device device("test", "device");
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_.reset(engine_.CreateChannel(NULL));
channel_.reset(engine_.CreateChannel(cricket::VideoOptions(), NULL));
EXPECT_TRUE(channel_.get() != NULL);
ConnectVideoChannelError();
network_interface_.SetDestination(channel_.get());

View File

@ -1113,11 +1113,21 @@ bool WebRtcVideoEngine::SetDefaultCodec(const VideoCodec& codec) {
WebRtcVideoMediaChannel* WebRtcVideoEngine::CreateChannel(
VoiceMediaChannel* voice_channel) {
return CreateChannel(VideoOptions(), voice_channel);
}
WebRtcVideoMediaChannel* WebRtcVideoEngine::CreateChannel(
const VideoOptions& options,
VoiceMediaChannel* voice_channel) {
WebRtcVideoMediaChannel* channel =
new WebRtcVideoMediaChannel(this, voice_channel);
if (!channel->Init()) {
delete channel;
channel = NULL;
return NULL;
}
if (!channel->SetOptions(options)) {
LOG(LS_WARNING) << "Failed to set options while creating channel.";
}
return channel;
}

View File

@ -110,8 +110,12 @@ class WebRtcVideoEngine : public sigslot::has_slots<>,
bool SetDefaultEncoderConfig(const VideoEncoderConfig& config);
VideoEncoderConfig GetDefaultEncoderConfig() const;
// TODO(pbos): Remove when all call sites use VideoOptions.
virtual WebRtcVideoMediaChannel* CreateChannel(
VoiceMediaChannel* voice_channel);
virtual WebRtcVideoMediaChannel* CreateChannel(
const VideoOptions& options,
VoiceMediaChannel* voice_channel);
const std::vector<VideoCodec>& codecs() const;
const std::vector<RtpHeaderExtension>& rtp_header_extensions() const;

View File

@ -414,6 +414,7 @@ VideoEncoderConfig WebRtcVideoEngine2::GetDefaultEncoderConfig() const {
}
WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel(
const VideoOptions& options,
VoiceMediaChannel* voice_channel) {
assert(initialized_);
LOG(LS_INFO) << "CreateChannel: "
@ -429,6 +430,7 @@ WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel(
delete channel;
return NULL;
}
channel->SetOptions(options);
channel->SetRecvCodecs(video_codecs_);
return channel;
}

View File

@ -147,7 +147,8 @@ class WebRtcVideoEngine2 : public sigslot::has_slots<> {
bool SetDefaultEncoderConfig(const VideoEncoderConfig& config);
VideoEncoderConfig GetDefaultEncoderConfig() const;
WebRtcVideoChannel2* CreateChannel(VoiceMediaChannel* voice_channel);
WebRtcVideoChannel2* CreateChannel(const VideoOptions& options,
VoiceMediaChannel* voice_channel);
const std::vector<VideoCodec>& codecs() const;
const std::vector<RtpHeaderExtension>& rtp_header_extensions() const;

View File

@ -427,7 +427,8 @@ TEST_F(WebRtcVideoEngine2Test, SupportsAbsoluteSenderTimeHeaderExtension) {
TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) {
engine_.Init(rtc::Thread::Current());
rtc::scoped_ptr<VideoMediaChannel> channel(engine_.CreateChannel(NULL));
rtc::scoped_ptr<VideoMediaChannel> channel(
engine_.CreateChannel(cricket::VideoOptions(), NULL));
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123)));
@ -439,7 +440,8 @@ TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) {
TEST_F(WebRtcVideoEngine2Test, GetStatsWithoutSendCodecsSetDoesNotCrash) {
engine_.Init(rtc::Thread::Current());
rtc::scoped_ptr<VideoMediaChannel> channel(engine_.CreateChannel(NULL));
rtc::scoped_ptr<VideoMediaChannel> channel(
engine_.CreateChannel(cricket::VideoOptions(), NULL));
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123)));
VideoMediaInfo info;
channel->GetStats(&info);
@ -483,7 +485,8 @@ VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory(
engine_.SetExternalEncoderFactory(encoder_factory);
engine_.Init(rtc::Thread::Current());
VideoMediaChannel* channel = engine_.CreateChannel(NULL);
VideoMediaChannel* channel =
engine_.CreateChannel(cricket::VideoOptions(), NULL);
EXPECT_TRUE(channel->SetSendCodecs(codecs));
return channel;
@ -685,7 +688,7 @@ class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test,
virtual void SetUp() OVERRIDE {
engine_.SetCallFactory(this);
engine_.Init(rtc::Thread::Current());
channel_.reset(engine_.CreateChannel(NULL));
channel_.reset(engine_.CreateChannel(cricket::VideoOptions(), NULL));
ASSERT_TRUE(fake_call_ != NULL) << "Call not created through factory.";
last_ssrc_ = 123;
ASSERT_TRUE(channel_->SetSendCodecs(engine_.codecs()));

View File

@ -101,7 +101,7 @@ class WebRtcVideoEngineTestFake : public testing::Test,
bool SetupEngine() {
bool result = engine_.Init(rtc::Thread::Current());
if (result) {
channel_ = engine_.CreateChannel(voice_channel_);
channel_ = engine_.CreateChannel(cricket::VideoOptions(), voice_channel_);
channel_->SignalMediaError.connect(this,
&WebRtcVideoEngineTestFake::OnMediaError);
result = (channel_ != NULL);
@ -342,7 +342,7 @@ TEST_F(WebRtcVideoEngineTest, WebRtcShouldNotLog) {
// Tests that we can create and destroy a channel.
TEST_F(WebRtcVideoEngineTestFake, CreateChannel) {
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel(voice_channel_);
channel_ = engine_.CreateChannel(cricket::VideoOptions(), voice_channel_);
EXPECT_TRUE(channel_ != NULL);
EXPECT_EQ(1, engine_.GetNumOfChannels());
delete channel_;
@ -354,7 +354,7 @@ TEST_F(WebRtcVideoEngineTestFake, CreateChannel) {
TEST_F(WebRtcVideoEngineTestFake, CreateChannelFail) {
vie_.set_fail_create_channel(true);
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel(voice_channel_);
channel_ = engine_.CreateChannel(cricket::VideoOptions(), voice_channel_);
EXPECT_TRUE(channel_ == NULL);
}
@ -362,7 +362,7 @@ TEST_F(WebRtcVideoEngineTestFake, CreateChannelFail) {
TEST_F(WebRtcVideoEngineTestFake, AllocateExternalCaptureDeviceFail) {
vie_.set_fail_alloc_capturer(true);
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel(voice_channel_);
channel_ = engine_.CreateChannel(cricket::VideoOptions(), voice_channel_);
EXPECT_TRUE(channel_ == NULL);
}
@ -2311,7 +2311,8 @@ TEST_F(WebRtcVideoEngineTest, DISABLED_CheckCoInitialize) {
TEST_F(WebRtcVideoEngineTest, CreateChannel) {
EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL);
cricket::VideoMediaChannel* channel =
engine_.CreateChannel(cricket::VideoOptions(), NULL);
EXPECT_TRUE(channel != NULL);
delete channel;
}

View File

@ -282,7 +282,11 @@ bool Call::AddSession(Session* session, const SessionDescription* offer) {
if (has_video_ && succeeded) {
media_session.video_channel =
session_client_->channel_manager()->CreateVideoChannel(
session, video_offer->name, true, media_session.voice_channel);
session,
video_offer->name,
true,
VideoOptions(),
media_session.voice_channel);
// video_channel can be NULL in case of NullVideoEngine.
if (media_session.video_channel) {
media_session.video_channel->SignalMediaMonitor.connect(

View File

@ -362,22 +362,48 @@ void ChannelManager::DestroyVoiceChannel_w(VoiceChannel* voice_channel) {
}
VideoChannel* ChannelManager::CreateVideoChannel(
BaseSession* session, const std::string& content_name, bool rtcp,
BaseSession* session,
const std::string& content_name,
bool rtcp,
VoiceChannel* voice_channel) {
return worker_thread_->Invoke<VideoChannel*>(
Bind(&ChannelManager::CreateVideoChannel_w, this, session,
content_name, rtcp, voice_channel));
Bind(&ChannelManager::CreateVideoChannel_w,
this,
session,
content_name,
rtcp,
VideoOptions(),
voice_channel));
}
VideoChannel* ChannelManager::CreateVideoChannel(
BaseSession* session,
const std::string& content_name,
bool rtcp,
const VideoOptions& options,
VoiceChannel* voice_channel) {
return worker_thread_->Invoke<VideoChannel*>(
Bind(&ChannelManager::CreateVideoChannel_w,
this,
session,
content_name,
rtcp,
options,
voice_channel));
}
VideoChannel* ChannelManager::CreateVideoChannel_w(
BaseSession* session, const std::string& content_name, bool rtcp,
BaseSession* session,
const std::string& content_name,
bool rtcp,
const VideoOptions& options,
VoiceChannel* voice_channel) {
// This is ok to alloc from a thread other than the worker thread
ASSERT(initialized_);
VideoMediaChannel* media_channel =
// voice_channel can be NULL in case of NullVoiceEngine.
media_engine_->CreateVideoChannel(voice_channel ?
voice_channel->media_channel() : NULL);
media_engine_->CreateVideoChannel(
options, voice_channel ? voice_channel->media_channel() : NULL);
if (media_channel == NULL)
return NULL;

View File

@ -113,11 +113,18 @@ class ChannelManager : public rtc::MessageHandler,
BaseSession* session, const std::string& content_name, bool rtcp);
// Destroys a voice channel created with the Create API.
void DestroyVoiceChannel(VoiceChannel* voice_channel);
// TODO(pbos): Remove as soon as all call sites specify VideoOptions.
VideoChannel* CreateVideoChannel(BaseSession* session,
const std::string& content_name,
bool rtcp,
VoiceChannel* voice_channel);
// Creates a video channel, synced with the specified voice channel, and
// associated with the specified session.
VideoChannel* CreateVideoChannel(
BaseSession* session, const std::string& content_name, bool rtcp,
VoiceChannel* voice_channel);
VideoChannel* CreateVideoChannel(BaseSession* session,
const std::string& content_name,
bool rtcp,
const VideoOptions& options,
VoiceChannel* voice_channel);
// Destroys a video channel created with the Create API.
void DestroyVideoChannel(VideoChannel* video_channel);
DataChannel* CreateDataChannel(
@ -261,9 +268,11 @@ class ChannelManager : public rtc::MessageHandler,
VoiceChannel* CreateVoiceChannel_w(
BaseSession* session, const std::string& content_name, bool rtcp);
void DestroyVoiceChannel_w(VoiceChannel* voice_channel);
VideoChannel* CreateVideoChannel_w(
BaseSession* session, const std::string& content_name, bool rtcp,
VoiceChannel* voice_channel);
VideoChannel* CreateVideoChannel_w(BaseSession* session,
const std::string& content_name,
bool rtcp,
const VideoOptions& options,
VoiceChannel* voice_channel);
void DestroyVideoChannel_w(VideoChannel* video_channel);
DataChannel* CreateDataChannel_w(
BaseSession* session, const std::string& content_name,

View File

@ -127,9 +127,8 @@ TEST_F(ChannelManagerTest, CreateDestroyChannels) {
cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel(
session_, cricket::CN_AUDIO, false);
EXPECT_TRUE(voice_channel != NULL);
cricket::VideoChannel* video_channel =
cm_->CreateVideoChannel(session_, cricket::CN_VIDEO,
false, voice_channel);
cricket::VideoChannel* video_channel = cm_->CreateVideoChannel(
session_, cricket::CN_VIDEO, false, VideoOptions(), voice_channel);
EXPECT_TRUE(video_channel != NULL);
cricket::DataChannel* data_channel =
cm_->CreateDataChannel(session_, cricket::CN_DATA,
@ -151,9 +150,8 @@ TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) {
cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel(
session_, cricket::CN_AUDIO, false);
EXPECT_TRUE(voice_channel != NULL);
cricket::VideoChannel* video_channel =
cm_->CreateVideoChannel(session_, cricket::CN_VIDEO,
false, voice_channel);
cricket::VideoChannel* video_channel = cm_->CreateVideoChannel(
session_, cricket::CN_VIDEO, false, VideoOptions(), voice_channel);
EXPECT_TRUE(video_channel != NULL);
cricket::DataChannel* data_channel =
cm_->CreateDataChannel(session_, cricket::CN_DATA,
@ -178,9 +176,8 @@ TEST_F(ChannelManagerTest, NoTransportChannelTest) {
cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel(
session_, cricket::CN_AUDIO, false);
EXPECT_TRUE(voice_channel == NULL);
cricket::VideoChannel* video_channel =
cm_->CreateVideoChannel(session_, cricket::CN_VIDEO,
false, voice_channel);
cricket::VideoChannel* video_channel = cm_->CreateVideoChannel(
session_, cricket::CN_VIDEO, false, VideoOptions(), voice_channel);
EXPECT_TRUE(video_channel == NULL);
cricket::DataChannel* data_channel =
cm_->CreateDataChannel(session_, cricket::CN_DATA,