diff --git a/talk/media/webrtc/webrtcvideoengine.cc b/talk/media/webrtc/webrtcvideoengine.cc index e9edf73dc..ed40911df 100644 --- a/talk/media/webrtc/webrtcvideoengine.cc +++ b/talk/media/webrtc/webrtcvideoengine.cc @@ -2208,6 +2208,9 @@ bool WebRtcVideoMediaChannel::GetSendChannelSsrcKey(uint32 local_ssrc, return true; } if (!GetSendChannelBySsrcKey(local_ssrc)) { + // If a stream has multiple ssrcs, the local_ssrc could be any of + // them, but we use the first one (StreamParams::first_ssrc()) as + // the key. for (SendChannelMap::iterator iter = send_channels_.begin(); iter != send_channels_.end(); ++iter) { WebRtcVideoChannelSendInfo* send_channel = iter->second; diff --git a/talk/media/webrtc/webrtcvideoengine.h b/talk/media/webrtc/webrtcvideoengine.h index dac1aa46a..4e41809c7 100644 --- a/talk/media/webrtc/webrtcvideoengine.h +++ b/talk/media/webrtc/webrtcvideoengine.h @@ -42,6 +42,9 @@ #if !defined(LIBPEERCONNECTION_LIB) && \ !defined(LIBPEERCONNECTION_IMPLEMENTATION) +// If you hit this, then you've tried to include this header from outside +// a shared library. An instance of this class must only be created from +// within the library that actually implements it. #error "Bogus include." #endif @@ -109,7 +112,8 @@ class WebRtcVideoEngine : public sigslot::has_slots<>, bool SetDefaultEncoderConfig(const VideoEncoderConfig& config); VideoEncoderConfig GetDefaultEncoderConfig() const; - WebRtcVideoMediaChannel* CreateChannel(VoiceMediaChannel* voice_channel); + virtual WebRtcVideoMediaChannel* CreateChannel( + VoiceMediaChannel* voice_channel); const std::vector& codecs() const; const std::vector& rtp_header_extensions() const; @@ -214,6 +218,9 @@ class WebRtcVideoEngine : public sigslot::has_slots<>, WebRtcVoiceEngine* voice_engine_; rtc::scoped_ptr render_module_; WebRtcVideoEncoderFactory* encoder_factory_; + // If the engine owns the encoder factory, set it here so it will be + // deleted. + rtc::scoped_ptr owned_encoder_factory_; WebRtcVideoDecoderFactory* decoder_factory_; std::vector video_codecs_; std::vector rtp_header_extensions_; @@ -367,9 +374,10 @@ class WebRtcVideoMediaChannel : public rtc::MessageHandler, // Returns the ssrc key corresponding to the provided local SSRC in // |ssrc_key|. The return value is true upon success. If the local // ssrc correspond to that of the default channel the key is - // kDefaultChannelSsrcKey. - // For all other channels the returned ssrc key will be the same as - // the local ssrc. + // kDefaultChannelSsrcKey. For all other channels the returned ssrc + // key will be the same as the local ssrc. If a stream has more + // than one ssrc, the first (corresponding to + // StreamParams::first_ssrc()) is used as the key. bool GetSendChannelSsrcKey(uint32 local_ssrc, uint32* ssrc_key); WebRtcVideoChannelSendInfo* GetDefaultSendChannel(); WebRtcVideoChannelSendInfo* GetSendChannelBySsrcKey(uint32 ssrc_key); diff --git a/talk/media/webrtc/webrtcvideoengine_unittest.cc b/talk/media/webrtc/webrtcvideoengine_unittest.cc index 11edd05b6..c621d6dee 100644 --- a/talk/media/webrtc/webrtcvideoengine_unittest.cc +++ b/talk/media/webrtc/webrtcvideoengine_unittest.cc @@ -26,22 +26,16 @@ */ #include "talk/media/base/constants.h" -#include "talk/media/base/fakemediaprocessor.h" #include "talk/media/base/fakenetworkinterface.h" -#include "talk/media/base/fakevideorenderer.h" #include "talk/media/base/mediachannel.h" #include "talk/media/base/testutils.h" -#include "talk/media/base/videoadapter.h" #include "talk/media/base/videoengine_unittest.h" -#include "talk/media/webrtc/fakewebrtcvideocapturemodule.h" #include "talk/media/webrtc/fakewebrtcvideoengine.h" -#include "talk/media/webrtc/fakewebrtcvoiceengine.h" #include "webrtc/base/fakecpumonitor.h" #include "webrtc/base/gunit.h" #include "webrtc/base/logging.h" #include "webrtc/base/scoped_ptr.h" #include "webrtc/base/stream.h" -#include "talk/media/webrtc/webrtcvideocapturer.h" #include "talk/media/webrtc/webrtcvideoengine.h" #include "talk/media/webrtc/webrtcvideoframe.h" #include "talk/media/webrtc/webrtcvoiceengine.h" @@ -54,9 +48,6 @@ using cricket::kRtpTimestampOffsetHeaderExtension; using cricket::kRtpAbsoluteSenderTimeHeaderExtension; static const cricket::VideoCodec kVP8Codec720p(100, "VP8", 1280, 720, 30, 0); -static const cricket::VideoCodec kVP8Codec360p(100, "VP8", 640, 360, 30, 0); -static const cricket::VideoCodec kVP8Codec270p(100, "VP8", 480, 270, 30, 0); -static const cricket::VideoCodec kVP8Codec180p(100, "VP8", 320, 180, 30, 0); static const cricket::VideoCodec kVP8Codec(100, "VP8", 640, 400, 30, 0); static const cricket::VideoCodec kH264Codec(127, "H264", 640, 400, 30, 0); @@ -78,7 +69,6 @@ static const uint32 kSsrcs3[] = {1, 2, 3}; static const uint32 kRtxSsrcs1[] = {4}; static const uint32 kRtxSsrcs3[] = {4, 5, 6}; - class FakeViEWrapper : public cricket::ViEWrapper { public: explicit FakeViEWrapper(cricket::FakeWebRtcVideoEngine* engine) @@ -1556,7 +1546,6 @@ TEST_F(WebRtcVideoEngineTestFake, SetBandwidthInConference) { 768, kMinBandwidthKbps, kStartBandwidthKbps); } - // Test that sending screencast frames doesn't change bitrate. TEST_F(WebRtcVideoEngineTestFake, SetBandwidthScreencast) { EXPECT_TRUE(SetupEngine()); @@ -1576,7 +1565,6 @@ TEST_F(WebRtcVideoEngineTestFake, SetBandwidthScreencast) { VerifyVP8SendCodec(channel_num, kVP8Codec.width, kVP8Codec.height, 0, 111); } - // Test SetSendSsrc. TEST_F(WebRtcVideoEngineTestFake, SetSendSsrcAndCname) { EXPECT_TRUE(SetupEngine()); @@ -1597,7 +1585,6 @@ TEST_F(WebRtcVideoEngineTestFake, SetSendSsrcAndCname) { EXPECT_STREQ("cname", rtcp_cname); } - // Test that the local SSRC is the same on sending and receiving channels if the // receive channel is created before the send channel. TEST_F(WebRtcVideoEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) { @@ -1618,7 +1605,6 @@ TEST_F(WebRtcVideoEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) { EXPECT_EQ(1, vie_.GetNumSsrcs(receive_channel_num)); } - // Test SetOptions with denoising flag. TEST_F(WebRtcVideoEngineTestFake, SetOptionsWithDenoising) { EXPECT_TRUE(SetupEngine()); @@ -1707,7 +1693,6 @@ TEST_F(WebRtcVideoEngineTestFake, MultipleSendStreamsWithOneCapturer) { EXPECT_EQ(-1, vie_.GetIncomingFrameNum(channel1)); } - TEST_F(WebRtcVideoEngineTestFake, SendReceiveBitratesStats) { EXPECT_TRUE(SetupEngine()); cricket::VideoOptions options; @@ -1839,7 +1824,6 @@ TEST_F(WebRtcVideoEngineTestFake, TestSetInvalidCpuThreshold) { EXPECT_EQ(high, 1.0f); } - TEST_F(WebRtcVideoEngineTestFake, ResetCodecOnScreencast) { EXPECT_TRUE(SetupEngine()); cricket::VideoOptions options; @@ -1870,7 +1854,6 @@ TEST_F(WebRtcVideoEngineTestFake, ResetCodecOnScreencast) { EXPECT_FALSE(gcodec.codecSpecific.VP8.denoisingOn); } - TEST_F(WebRtcVideoEngineTestFake, DontRegisterDecoderIfFactoryIsNotGiven) { engine_.SetExternalDecoderFactory(NULL); EXPECT_TRUE(SetupEngine()); @@ -2574,7 +2557,6 @@ TEST_F(WebRtcVideoMediaChannelTest, RejectEmptyStreamParams) { Base::RejectEmptyStreamParams(); } - TEST_F(WebRtcVideoMediaChannelTest, AdaptResolution16x10) { Base::AdaptResolution16x10(); }