pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1 | /* |
| 2 | * libjingle |
| 3 | * Copyright 2004 Google Inc. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright notice, |
| 9 | * this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer in the documentation |
| 12 | * and/or other materials provided with the distribution. |
| 13 | * 3. The name of the author may not be used to endorse or promote products |
| 14 | * derived from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
| 19 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | #include <map> |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 29 | #include <vector> |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 30 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 31 | #include "talk/media/base/testutils.h" |
| 32 | #include "talk/media/base/videoengine_unittest.h" |
pbos@webrtc.org | 7fe1e03 | 2014-10-14 04:25:33 +0000 | [diff] [blame] | 33 | #include "talk/media/webrtc/fakewebrtcvideoengine.h" |
buildbot@webrtc.org | a09a999 | 2014-08-13 17:26:08 +0000 | [diff] [blame] | 34 | #include "talk/media/webrtc/webrtcvideochannelfactory.h" |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 35 | #include "talk/media/webrtc/webrtcvideoengine2.h" |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 36 | #include "talk/media/webrtc/webrtcvideoengine2_unittest.h" |
buildbot@webrtc.org | a09a999 | 2014-08-13 17:26:08 +0000 | [diff] [blame] | 37 | #include "webrtc/base/gunit.h" |
| 38 | #include "webrtc/base/stringutils.h" |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 39 | #include "webrtc/video_encoder.h" |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 40 | |
| 41 | namespace { |
| 42 | static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30, 0); |
| 43 | static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 44 | |
| 45 | static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 400, 30, 0); |
| 46 | static const cricket::VideoCodec kVp9Codec(101, "VP9", 640, 400, 30, 0); |
pbos@webrtc.org | 7fe1e03 | 2014-10-14 04:25:33 +0000 | [diff] [blame] | 47 | static const cricket::VideoCodec kH264Codec(102, "H264", 640, 400, 30, 0); |
| 48 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 49 | static const cricket::VideoCodec kRedCodec(116, "red", 0, 0, 0, 0); |
| 50 | static const cricket::VideoCodec kUlpfecCodec(117, "ulpfec", 0, 0, 0, 0); |
| 51 | |
| 52 | static const uint32 kSsrcs1[] = {1}; |
| 53 | static const uint32 kRtxSsrcs1[] = {4}; |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 54 | static const char kUnsupportedExtensionName[] = |
| 55 | "urn:ietf:params:rtp-hdrext:unsupported"; |
pbos@webrtc.org | f99c2f2 | 2014-06-13 12:27:38 +0000 | [diff] [blame] | 56 | |
| 57 | void VerifyCodecHasDefaultFeedbackParams(const cricket::VideoCodec& codec) { |
| 58 | EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
| 59 | cricket::kRtcpFbParamNack, cricket::kParamValueEmpty))); |
| 60 | EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
| 61 | cricket::kRtcpFbParamNack, cricket::kRtcpFbNackParamPli))); |
| 62 | EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
| 63 | cricket::kRtcpFbParamRemb, cricket::kParamValueEmpty))); |
| 64 | EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
| 65 | cricket::kRtcpFbParamCcm, cricket::kRtcpFbCcmParamFir))); |
| 66 | } |
| 67 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 68 | } // namespace |
| 69 | |
| 70 | namespace cricket { |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 71 | FakeVideoSendStream::FakeVideoSendStream( |
| 72 | const webrtc::VideoSendStream::Config& config, |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 73 | const webrtc::VideoEncoderConfig& encoder_config) |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 74 | : sending_(false), |
| 75 | config_(config), |
| 76 | codec_settings_set_(false), |
| 77 | num_swapped_frames_(0) { |
pbos@webrtc.org | 6f48f1b | 2014-07-22 16:29:54 +0000 | [diff] [blame] | 78 | assert(config.encoder_settings.encoder != NULL); |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 79 | ReconfigureVideoEncoder(encoder_config); |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 80 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 81 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 82 | webrtc::VideoSendStream::Config FakeVideoSendStream::GetConfig() { |
| 83 | return config_; |
| 84 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 85 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 86 | std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 87 | return encoder_config_.streams; |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 88 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 89 | |
pbos@webrtc.org | 85f4294 | 2014-07-22 09:14:58 +0000 | [diff] [blame] | 90 | bool FakeVideoSendStream::IsSending() const { |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 91 | return sending_; |
| 92 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 93 | |
pbos@webrtc.org | 6f48f1b | 2014-07-22 16:29:54 +0000 | [diff] [blame] | 94 | bool FakeVideoSendStream::GetVp8Settings( |
| 95 | webrtc::VideoCodecVP8* settings) const { |
| 96 | if (!codec_settings_set_) { |
| 97 | return false; |
| 98 | } |
| 99 | |
| 100 | *settings = vp8_settings_; |
| 101 | return true; |
| 102 | } |
| 103 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 104 | int FakeVideoSendStream::GetNumberOfSwappedFrames() const { |
| 105 | return num_swapped_frames_; |
| 106 | } |
| 107 | |
| 108 | int FakeVideoSendStream::GetLastWidth() const { |
| 109 | return last_frame_.width(); |
| 110 | } |
| 111 | |
| 112 | int FakeVideoSendStream::GetLastHeight() const { |
| 113 | return last_frame_.height(); |
| 114 | } |
| 115 | |
| 116 | void FakeVideoSendStream::SwapFrame(webrtc::I420VideoFrame* frame) { |
| 117 | ++num_swapped_frames_; |
| 118 | last_frame_.SwapFrame(frame); |
| 119 | } |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 120 | webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() const { |
| 121 | return webrtc::VideoSendStream::Stats(); |
| 122 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 123 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 124 | bool FakeVideoSendStream::ReconfigureVideoEncoder( |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 125 | const webrtc::VideoEncoderConfig& config) { |
| 126 | encoder_config_ = config; |
| 127 | if (config.encoder_specific_settings != NULL) { |
pbos@webrtc.org | 6f48f1b | 2014-07-22 16:29:54 +0000 | [diff] [blame] | 128 | assert(config_.encoder_settings.payload_name == "VP8"); |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 129 | vp8_settings_ = *reinterpret_cast<const webrtc::VideoCodecVP8*>( |
| 130 | config.encoder_specific_settings); |
pbos@webrtc.org | 6f48f1b | 2014-07-22 16:29:54 +0000 | [diff] [blame] | 131 | } |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 132 | codec_settings_set_ = config.encoder_specific_settings != NULL; |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 133 | return true; |
| 134 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 135 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 136 | webrtc::VideoSendStreamInput* FakeVideoSendStream::Input() { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 137 | return this; |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 138 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 139 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 140 | void FakeVideoSendStream::Start() { |
| 141 | sending_ = true; |
| 142 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 143 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 144 | void FakeVideoSendStream::Stop() { |
| 145 | sending_ = false; |
| 146 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 147 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 148 | FakeVideoReceiveStream::FakeVideoReceiveStream( |
| 149 | const webrtc::VideoReceiveStream::Config& config) |
| 150 | : config_(config), receiving_(false) { |
| 151 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 152 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 153 | webrtc::VideoReceiveStream::Config FakeVideoReceiveStream::GetConfig() { |
| 154 | return config_; |
| 155 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 156 | |
pbos@webrtc.org | 85f4294 | 2014-07-22 09:14:58 +0000 | [diff] [blame] | 157 | bool FakeVideoReceiveStream::IsReceiving() const { |
| 158 | return receiving_; |
| 159 | } |
| 160 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 161 | webrtc::VideoReceiveStream::Stats FakeVideoReceiveStream::GetStats() const { |
| 162 | return webrtc::VideoReceiveStream::Stats(); |
| 163 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 164 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 165 | void FakeVideoReceiveStream::Start() { |
| 166 | receiving_ = true; |
| 167 | } |
pbos@webrtc.org | 85f4294 | 2014-07-22 09:14:58 +0000 | [diff] [blame] | 168 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 169 | void FakeVideoReceiveStream::Stop() { |
| 170 | receiving_ = false; |
| 171 | } |
pbos@webrtc.org | 85f4294 | 2014-07-22 09:14:58 +0000 | [diff] [blame] | 172 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 173 | void FakeVideoReceiveStream::GetCurrentReceiveCodec(webrtc::VideoCodec* codec) { |
| 174 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 175 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 176 | FakeCall::FakeCall(const webrtc::Call::Config& config) |
| 177 | : config_(config), network_state_(kNetworkUp) { |
pbos@webrtc.org | 26c0c41 | 2014-09-03 16:17:12 +0000 | [diff] [blame] | 178 | SetVideoCodecs(GetDefaultVideoCodecs()); |
| 179 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 180 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 181 | FakeCall::~FakeCall() { |
| 182 | EXPECT_EQ(0u, video_send_streams_.size()); |
| 183 | EXPECT_EQ(0u, video_receive_streams_.size()); |
| 184 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 185 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 186 | void FakeCall::SetVideoCodecs(const std::vector<webrtc::VideoCodec> codecs) { |
| 187 | codecs_ = codecs; |
| 188 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 189 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 190 | webrtc::Call::Config FakeCall::GetConfig() const { |
| 191 | return config_; |
| 192 | } |
| 193 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 194 | std::vector<FakeVideoSendStream*> FakeCall::GetVideoSendStreams() { |
| 195 | return video_send_streams_; |
| 196 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 197 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 198 | std::vector<FakeVideoReceiveStream*> FakeCall::GetVideoReceiveStreams() { |
| 199 | return video_receive_streams_; |
| 200 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 201 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 202 | webrtc::VideoCodec FakeCall::GetEmptyVideoCodec() { |
| 203 | webrtc::VideoCodec codec; |
| 204 | codec.minBitrate = 300; |
| 205 | codec.startBitrate = 800; |
| 206 | codec.maxBitrate = 1500; |
| 207 | codec.maxFramerate = 10; |
| 208 | codec.width = 640; |
| 209 | codec.height = 480; |
| 210 | codec.qpMax = 56; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 211 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 212 | return codec; |
| 213 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 214 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 215 | webrtc::VideoCodec FakeCall::GetVideoCodecVp8() { |
| 216 | webrtc::VideoCodec vp8_codec = GetEmptyVideoCodec(); |
| 217 | vp8_codec.codecType = webrtc::kVideoCodecVP8; |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 218 | rtc::strcpyn( |
| 219 | vp8_codec.plName, ARRAY_SIZE(vp8_codec.plName), kVp8Codec.name.c_str()); |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 220 | vp8_codec.plType = kVp8Codec.id; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 221 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 222 | return vp8_codec; |
| 223 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 224 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 225 | webrtc::VideoCodec FakeCall::GetVideoCodecVp9() { |
| 226 | webrtc::VideoCodec vp9_codec = GetEmptyVideoCodec(); |
| 227 | // TODO(pbos): Add a correct codecType when webrtc has one. |
| 228 | vp9_codec.codecType = webrtc::kVideoCodecVP8; |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 229 | rtc::strcpyn( |
| 230 | vp9_codec.plName, ARRAY_SIZE(vp9_codec.plName), kVp9Codec.name.c_str()); |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 231 | vp9_codec.plType = kVp9Codec.id; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 232 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 233 | return vp9_codec; |
| 234 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 235 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 236 | std::vector<webrtc::VideoCodec> FakeCall::GetDefaultVideoCodecs() { |
| 237 | std::vector<webrtc::VideoCodec> codecs; |
| 238 | codecs.push_back(GetVideoCodecVp8()); |
| 239 | // codecs.push_back(GetVideoCodecVp9()); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 240 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 241 | return codecs; |
| 242 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 243 | |
pbos@webrtc.org | 26c0c41 | 2014-09-03 16:17:12 +0000 | [diff] [blame] | 244 | webrtc::Call::NetworkState FakeCall::GetNetworkState() const { |
| 245 | return network_state_; |
| 246 | } |
| 247 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 248 | webrtc::VideoSendStream* FakeCall::CreateVideoSendStream( |
| 249 | const webrtc::VideoSendStream::Config& config, |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 250 | const webrtc::VideoEncoderConfig& encoder_config) { |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 251 | FakeVideoSendStream* fake_stream = |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 252 | new FakeVideoSendStream(config, encoder_config); |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 253 | video_send_streams_.push_back(fake_stream); |
| 254 | return fake_stream; |
| 255 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 256 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 257 | void FakeCall::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { |
| 258 | FakeVideoSendStream* fake_stream = |
| 259 | static_cast<FakeVideoSendStream*>(send_stream); |
| 260 | for (size_t i = 0; i < video_send_streams_.size(); ++i) { |
| 261 | if (video_send_streams_[i] == fake_stream) { |
| 262 | delete video_send_streams_[i]; |
| 263 | video_send_streams_.erase(video_send_streams_.begin() + i); |
| 264 | return; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 265 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 266 | } |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 267 | ADD_FAILURE() << "DestroyVideoSendStream called with unknown paramter."; |
| 268 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 269 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 270 | webrtc::VideoReceiveStream* FakeCall::CreateVideoReceiveStream( |
| 271 | const webrtc::VideoReceiveStream::Config& config) { |
| 272 | video_receive_streams_.push_back(new FakeVideoReceiveStream(config)); |
| 273 | return video_receive_streams_[video_receive_streams_.size() - 1]; |
| 274 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 275 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 276 | void FakeCall::DestroyVideoReceiveStream( |
| 277 | webrtc::VideoReceiveStream* receive_stream) { |
| 278 | FakeVideoReceiveStream* fake_stream = |
| 279 | static_cast<FakeVideoReceiveStream*>(receive_stream); |
| 280 | for (size_t i = 0; i < video_receive_streams_.size(); ++i) { |
| 281 | if (video_receive_streams_[i] == fake_stream) { |
| 282 | delete video_receive_streams_[i]; |
| 283 | video_receive_streams_.erase(video_receive_streams_.begin() + i); |
| 284 | return; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 285 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 286 | } |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 287 | ADD_FAILURE() << "DestroyVideoReceiveStream called with unknown paramter."; |
| 288 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 289 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 290 | webrtc::PacketReceiver* FakeCall::Receiver() { |
| 291 | // TODO(pbos): Fix this. |
| 292 | return NULL; |
| 293 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 294 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 295 | uint32_t FakeCall::SendBitrateEstimate() { |
| 296 | return 0; |
| 297 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 298 | |
pbos@webrtc.org | 86f613d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 299 | uint32_t FakeCall::ReceiveBitrateEstimate() { |
| 300 | return 0; |
| 301 | } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 302 | |
pbos@webrtc.org | 26c0c41 | 2014-09-03 16:17:12 +0000 | [diff] [blame] | 303 | void FakeCall::SignalNetworkState(webrtc::Call::NetworkState state) { |
| 304 | network_state_ = state; |
| 305 | } |
| 306 | |
pbos@webrtc.org | 7fe1e03 | 2014-10-14 04:25:33 +0000 | [diff] [blame] | 307 | class WebRtcVideoEngine2Test : public ::testing::Test { |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 308 | public: |
pbos@webrtc.org | b648b9d | 2014-08-26 11:08:06 +0000 | [diff] [blame] | 309 | WebRtcVideoEngine2Test() { |
pbos@webrtc.org | 9fbb717 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 310 | std::vector<VideoCodec> engine_codecs = engine_.codecs(); |
| 311 | assert(!engine_codecs.empty()); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 312 | bool codec_set = false; |
pbos@webrtc.org | 9fbb717 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 313 | for (size_t i = 0; i < engine_codecs.size(); ++i) { |
| 314 | if (engine_codecs[i].name == "red") { |
| 315 | default_red_codec_ = engine_codecs[i]; |
| 316 | } else if (engine_codecs[i].name == "ulpfec") { |
| 317 | default_ulpfec_codec_ = engine_codecs[i]; |
| 318 | } else if (engine_codecs[i].name == "rtx") { |
| 319 | default_rtx_codec_ = engine_codecs[i]; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 320 | } else if (!codec_set) { |
pbos@webrtc.org | 9fbb717 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 321 | default_codec_ = engine_codecs[i]; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 322 | codec_set = true; |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | assert(codec_set); |
| 327 | } |
| 328 | |
| 329 | protected: |
pbos@webrtc.org | 7fe1e03 | 2014-10-14 04:25:33 +0000 | [diff] [blame] | 330 | VideoMediaChannel* SetUpForExternalEncoderFactory( |
| 331 | cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 332 | const std::vector<VideoCodec>& codecs); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 333 | WebRtcVideoEngine2 engine_; |
| 334 | VideoCodec default_codec_; |
| 335 | VideoCodec default_red_codec_; |
| 336 | VideoCodec default_ulpfec_codec_; |
| 337 | VideoCodec default_rtx_codec_; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 338 | }; |
| 339 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 340 | // TODO(pbos): Add test that verifies that sync is configured properly. |
| 341 | TEST_F(WebRtcVideoEngine2Test, DISABLED_CreateChannelWithVoiceEngine) { |
| 342 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 343 | } |
| 344 | |
pbos@webrtc.org | e322a17 | 2014-06-13 11:47:28 +0000 | [diff] [blame] | 345 | TEST_F(WebRtcVideoEngine2Test, FindCodec) { |
| 346 | const std::vector<cricket::VideoCodec>& c = engine_.codecs(); |
| 347 | EXPECT_EQ(4U, c.size()); |
| 348 | |
| 349 | cricket::VideoCodec vp8(104, "VP8", 320, 200, 30, 0); |
| 350 | EXPECT_TRUE(engine_.FindCodec(vp8)); |
| 351 | |
| 352 | cricket::VideoCodec vp8_ci(104, "vp8", 320, 200, 30, 0); |
| 353 | EXPECT_TRUE(engine_.FindCodec(vp8)); |
| 354 | |
| 355 | cricket::VideoCodec vp8_diff_fr_diff_pref(104, "VP8", 320, 200, 50, 50); |
| 356 | EXPECT_TRUE(engine_.FindCodec(vp8_diff_fr_diff_pref)); |
| 357 | |
| 358 | cricket::VideoCodec vp8_diff_id(95, "VP8", 320, 200, 30, 0); |
| 359 | EXPECT_FALSE(engine_.FindCodec(vp8_diff_id)); |
| 360 | vp8_diff_id.id = 97; |
| 361 | EXPECT_TRUE(engine_.FindCodec(vp8_diff_id)); |
| 362 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 363 | // FindCodec ignores the codec size. |
| 364 | // Test that FindCodec can accept uncommon codec size. |
pbos@webrtc.org | e322a17 | 2014-06-13 11:47:28 +0000 | [diff] [blame] | 365 | cricket::VideoCodec vp8_diff_res(104, "VP8", 320, 111, 30, 0); |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 366 | EXPECT_TRUE(engine_.FindCodec(vp8_diff_res)); |
pbos@webrtc.org | e322a17 | 2014-06-13 11:47:28 +0000 | [diff] [blame] | 367 | |
| 368 | // PeerConnection doesn't negotiate the resolution at this point. |
| 369 | // Test that FindCodec can handle the case when width/height is 0. |
| 370 | cricket::VideoCodec vp8_zero_res(104, "VP8", 0, 0, 30, 0); |
| 371 | EXPECT_TRUE(engine_.FindCodec(vp8_zero_res)); |
| 372 | |
| 373 | cricket::VideoCodec red(101, "RED", 0, 0, 30, 0); |
| 374 | EXPECT_TRUE(engine_.FindCodec(red)); |
| 375 | |
| 376 | cricket::VideoCodec red_ci(101, "red", 0, 0, 30, 0); |
| 377 | EXPECT_TRUE(engine_.FindCodec(red)); |
| 378 | |
| 379 | cricket::VideoCodec fec(102, "ULPFEC", 0, 0, 30, 0); |
| 380 | EXPECT_TRUE(engine_.FindCodec(fec)); |
| 381 | |
| 382 | cricket::VideoCodec fec_ci(102, "ulpfec", 0, 0, 30, 0); |
| 383 | EXPECT_TRUE(engine_.FindCodec(fec)); |
| 384 | |
| 385 | cricket::VideoCodec rtx(96, "rtx", 0, 0, 30, 0); |
| 386 | EXPECT_TRUE(engine_.FindCodec(rtx)); |
| 387 | } |
| 388 | |
| 389 | TEST_F(WebRtcVideoEngine2Test, DefaultRtxCodecHasAssociatedPayloadTypeSet) { |
| 390 | std::vector<VideoCodec> engine_codecs = engine_.codecs(); |
| 391 | for (size_t i = 0; i < engine_codecs.size(); ++i) { |
| 392 | if (engine_codecs[i].name != kRtxCodecName) |
| 393 | continue; |
| 394 | int associated_payload_type; |
| 395 | EXPECT_TRUE(engine_codecs[i].GetParam(kCodecParamAssociatedPayloadType, |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 396 | &associated_payload_type)); |
pbos@webrtc.org | e322a17 | 2014-06-13 11:47:28 +0000 | [diff] [blame] | 397 | EXPECT_EQ(default_codec_.id, associated_payload_type); |
| 398 | return; |
| 399 | } |
| 400 | FAIL() << "No RTX codec found among default codecs."; |
| 401 | } |
| 402 | |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 403 | TEST_F(WebRtcVideoEngine2Test, SupportsTimestampOffsetHeaderExtension) { |
| 404 | std::vector<RtpHeaderExtension> extensions = engine_.rtp_header_extensions(); |
| 405 | ASSERT_FALSE(extensions.empty()); |
| 406 | for (size_t i = 0; i < extensions.size(); ++i) { |
| 407 | if (extensions[i].uri == kRtpTimestampOffsetHeaderExtension) { |
| 408 | EXPECT_EQ(kRtpTimestampOffsetHeaderExtensionDefaultId, extensions[i].id); |
| 409 | return; |
| 410 | } |
| 411 | } |
| 412 | FAIL() << "Timestamp offset extension not in header-extension list."; |
| 413 | } |
| 414 | |
| 415 | TEST_F(WebRtcVideoEngine2Test, SupportsAbsoluteSenderTimeHeaderExtension) { |
| 416 | std::vector<RtpHeaderExtension> extensions = engine_.rtp_header_extensions(); |
| 417 | ASSERT_FALSE(extensions.empty()); |
| 418 | for (size_t i = 0; i < extensions.size(); ++i) { |
| 419 | if (extensions[i].uri == kRtpAbsoluteSenderTimeHeaderExtension) { |
| 420 | EXPECT_EQ(kRtpAbsoluteSenderTimeHeaderExtensionDefaultId, |
| 421 | extensions[i].id); |
| 422 | return; |
| 423 | } |
| 424 | } |
| 425 | FAIL() << "Absolute Sender Time extension not in header-extension list."; |
| 426 | } |
| 427 | |
pbos@webrtc.org | 5301b0f | 2014-07-17 08:51:46 +0000 | [diff] [blame] | 428 | TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) { |
pbos@webrtc.org | 7fe1e03 | 2014-10-14 04:25:33 +0000 | [diff] [blame] | 429 | engine_.Init(rtc::Thread::Current()); |
buildbot@webrtc.org | 1ecbe45 | 2014-10-14 20:29:28 +0000 | [diff] [blame^] | 430 | rtc::scoped_ptr<VideoMediaChannel> channel( |
| 431 | engine_.CreateChannel(cricket::VideoOptions(), NULL)); |
pbos@webrtc.org | 5301b0f | 2014-07-17 08:51:46 +0000 | [diff] [blame] | 432 | |
| 433 | EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); |
| 434 | |
| 435 | EXPECT_FALSE(channel->SetSend(true)) |
| 436 | << "Channel should not start without codecs."; |
| 437 | EXPECT_TRUE(channel->SetSend(false)) |
| 438 | << "Channel should be stoppable even without set codecs."; |
| 439 | } |
| 440 | |
pbos@webrtc.org | c3d2bd2 | 2014-08-12 20:55:10 +0000 | [diff] [blame] | 441 | TEST_F(WebRtcVideoEngine2Test, GetStatsWithoutSendCodecsSetDoesNotCrash) { |
pbos@webrtc.org | 7fe1e03 | 2014-10-14 04:25:33 +0000 | [diff] [blame] | 442 | engine_.Init(rtc::Thread::Current()); |
buildbot@webrtc.org | 1ecbe45 | 2014-10-14 20:29:28 +0000 | [diff] [blame^] | 443 | rtc::scoped_ptr<VideoMediaChannel> channel( |
| 444 | engine_.CreateChannel(cricket::VideoOptions(), NULL)); |
pbos@webrtc.org | c3d2bd2 | 2014-08-12 20:55:10 +0000 | [diff] [blame] | 445 | EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); |
| 446 | VideoMediaInfo info; |
| 447 | channel->GetStats(&info); |
| 448 | } |
| 449 | |
pbos@webrtc.org | 7fe1e03 | 2014-10-14 04:25:33 +0000 | [diff] [blame] | 450 | TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) { |
| 451 | cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 452 | encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); |
| 453 | std::vector<cricket::VideoCodec> codecs; |
| 454 | codecs.push_back(kVp8Codec); |
| 455 | |
| 456 | rtc::scoped_ptr<VideoMediaChannel> channel( |
| 457 | SetUpForExternalEncoderFactory(&encoder_factory, codecs)); |
| 458 | |
| 459 | EXPECT_TRUE( |
| 460 | channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
| 461 | ASSERT_EQ(1u, encoder_factory.encoders().size()); |
| 462 | EXPECT_TRUE(channel->SetSend(true)); |
| 463 | |
| 464 | cricket::FakeVideoCapturer capturer; |
| 465 | EXPECT_TRUE(channel->SetCapturer(kSsrc, &capturer)); |
| 466 | EXPECT_EQ(cricket::CS_RUNNING, |
| 467 | capturer.Start(capturer.GetSupportedFormats()->front())); |
| 468 | EXPECT_TRUE(capturer.CaptureFrame()); |
| 469 | |
| 470 | EXPECT_TRUE_WAIT(encoder_factory.encoders()[0]->GetNumEncodedFrames() > 0, |
| 471 | kTimeout); |
| 472 | |
| 473 | // Setting codecs of the same type should not reallocate the encoder. |
| 474 | EXPECT_TRUE(channel->SetSendCodecs(codecs)); |
| 475 | EXPECT_EQ(1, encoder_factory.GetNumCreatedEncoders()); |
| 476 | |
| 477 | // Remove stream previously added to free the external encoder instance. |
| 478 | EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); |
| 479 | EXPECT_EQ(0u, encoder_factory.encoders().size()); |
| 480 | } |
| 481 | |
| 482 | VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( |
| 483 | cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 484 | const std::vector<VideoCodec>& codecs) { |
| 485 | engine_.SetExternalEncoderFactory(encoder_factory); |
| 486 | engine_.Init(rtc::Thread::Current()); |
| 487 | |
buildbot@webrtc.org | 1ecbe45 | 2014-10-14 20:29:28 +0000 | [diff] [blame^] | 488 | VideoMediaChannel* channel = |
| 489 | engine_.CreateChannel(cricket::VideoOptions(), NULL); |
pbos@webrtc.org | 7fe1e03 | 2014-10-14 04:25:33 +0000 | [diff] [blame] | 490 | EXPECT_TRUE(channel->SetSendCodecs(codecs)); |
| 491 | |
| 492 | return channel; |
| 493 | } |
| 494 | |
| 495 | TEST_F(WebRtcVideoEngine2Test, ChannelWithExternalH264CanChangeToInternalVp8) { |
| 496 | cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 497 | encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecH264, "H264"); |
| 498 | std::vector<cricket::VideoCodec> codecs; |
| 499 | codecs.push_back(kH264Codec); |
| 500 | |
| 501 | rtc::scoped_ptr<VideoMediaChannel> channel( |
| 502 | SetUpForExternalEncoderFactory(&encoder_factory, codecs)); |
| 503 | |
| 504 | EXPECT_TRUE( |
| 505 | channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
| 506 | ASSERT_EQ(1u, encoder_factory.encoders().size()); |
| 507 | |
| 508 | codecs.clear(); |
| 509 | codecs.push_back(kVp8Codec); |
| 510 | EXPECT_TRUE(channel->SetSendCodecs(codecs)); |
| 511 | |
| 512 | ASSERT_EQ(0u, encoder_factory.encoders().size()); |
| 513 | } |
| 514 | |
| 515 | TEST_F(WebRtcVideoEngine2Test, |
| 516 | DontUseExternalEncoderFactoryForUnsupportedCodecs) { |
| 517 | cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 518 | encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecH264, "H264"); |
| 519 | std::vector<cricket::VideoCodec> codecs; |
| 520 | codecs.push_back(kVp8Codec); |
| 521 | |
| 522 | rtc::scoped_ptr<VideoMediaChannel> channel( |
| 523 | SetUpForExternalEncoderFactory(&encoder_factory, codecs)); |
| 524 | |
| 525 | EXPECT_TRUE( |
| 526 | channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
| 527 | ASSERT_EQ(0u, encoder_factory.encoders().size()); |
| 528 | } |
| 529 | |
| 530 | // Test external codec with be added to the end of the supported codec list. |
| 531 | TEST_F(WebRtcVideoEngine2Test, ReportSupportedExternalCodecs) { |
| 532 | cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 533 | encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecH264, "H264"); |
| 534 | engine_.SetExternalEncoderFactory(&encoder_factory); |
| 535 | |
| 536 | engine_.Init(rtc::Thread::Current()); |
| 537 | |
| 538 | std::vector<cricket::VideoCodec> codecs(engine_.codecs()); |
| 539 | ASSERT_GE(codecs.size(), 2u); |
| 540 | cricket::VideoCodec internal_codec = codecs.front(); |
| 541 | cricket::VideoCodec external_codec = codecs.back(); |
| 542 | |
| 543 | // The external codec will appear at last. |
| 544 | EXPECT_EQ("VP8", internal_codec.name); |
| 545 | EXPECT_EQ("H264", external_codec.name); |
| 546 | } |
| 547 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 548 | class WebRtcVideoEngine2BaseTest |
| 549 | : public VideoEngineTest<cricket::WebRtcVideoEngine2> { |
| 550 | protected: |
| 551 | typedef VideoEngineTest<cricket::WebRtcVideoEngine2> Base; |
| 552 | }; |
| 553 | |
| 554 | #define WEBRTC_ENGINE_BASE_TEST(test) \ |
| 555 | TEST_F(WebRtcVideoEngine2BaseTest, test) { Base::test##Body(); } |
| 556 | |
| 557 | WEBRTC_ENGINE_BASE_TEST(ConstrainNewCodec2); |
| 558 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 559 | class WebRtcVideoChannel2BaseTest |
| 560 | : public VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> { |
| 561 | protected: |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 562 | typedef VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> Base; |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 563 | |
| 564 | virtual cricket::VideoCodec DefaultCodec() OVERRIDE { return kVp8Codec; } |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 565 | }; |
| 566 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 567 | #define WEBRTC_BASE_TEST(test) \ |
| 568 | TEST_F(WebRtcVideoChannel2BaseTest, test) { Base::test(); } |
| 569 | |
| 570 | #define WEBRTC_DISABLED_BASE_TEST(test) \ |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 571 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_##test) { Base::test(); } |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 572 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 573 | // TODO(pbos): Fix WebRtcVideoEngine2BaseTest, where we want CheckCoInitialize. |
| 574 | #if 0 |
| 575 | // TODO(juberti): Figure out why ViE is munging the COM refcount. |
| 576 | #ifdef WIN32 |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 577 | WEBRTC_DISABLED_BASE_TEST(CheckCoInitialize) { |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 578 | Base::CheckCoInitialize(); |
| 579 | } |
| 580 | #endif |
| 581 | #endif |
| 582 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 583 | WEBRTC_BASE_TEST(SetSend); |
| 584 | WEBRTC_BASE_TEST(SetSendWithoutCodecs); |
| 585 | WEBRTC_BASE_TEST(SetSendSetsTransportBufferSizes); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 586 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 587 | WEBRTC_BASE_TEST(GetStats); |
| 588 | WEBRTC_BASE_TEST(GetStatsMultipleRecvStreams); |
| 589 | WEBRTC_BASE_TEST(GetStatsMultipleSendStreams); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 590 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 591 | WEBRTC_BASE_TEST(SetSendBandwidth); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 592 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 593 | WEBRTC_BASE_TEST(SetSendSsrc); |
| 594 | WEBRTC_BASE_TEST(SetSendSsrcAfterSetCodecs); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 595 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 596 | WEBRTC_BASE_TEST(SetRenderer); |
| 597 | WEBRTC_BASE_TEST(AddRemoveRecvStreams); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 598 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 599 | WEBRTC_DISABLED_BASE_TEST(AddRemoveRecvStreamAndRender); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 600 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 601 | WEBRTC_BASE_TEST(AddRemoveRecvStreamsNoConference); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 602 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 603 | WEBRTC_BASE_TEST(AddRemoveSendStreams); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 604 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 605 | WEBRTC_BASE_TEST(SimulateConference); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 606 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 607 | WEBRTC_BASE_TEST(AddRemoveCapturer); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 608 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 609 | WEBRTC_BASE_TEST(RemoveCapturerWithoutAdd); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 610 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 611 | WEBRTC_BASE_TEST(AddRemoveCapturerMultipleSources); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 612 | |
| 613 | // TODO(pbos): Figure out why this fails so often. |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 614 | WEBRTC_DISABLED_BASE_TEST(HighAspectHighHeightCapturer); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 615 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 616 | WEBRTC_BASE_TEST(RejectEmptyStreamParams); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 617 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 618 | WEBRTC_BASE_TEST(AdaptResolution16x10); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 619 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 620 | WEBRTC_BASE_TEST(AdaptResolution4x3); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 621 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 622 | // TODO(juberti): Restore this test once we support sending 0 fps. |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 623 | WEBRTC_DISABLED_BASE_TEST(AdaptDropAllFrames); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 624 | // TODO(juberti): Understand why we get decode errors on this test. |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 625 | WEBRTC_DISABLED_BASE_TEST(AdaptFramerate); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 626 | |
pbos@webrtc.org | c4175b9 | 2014-09-03 15:25:49 +0000 | [diff] [blame] | 627 | WEBRTC_BASE_TEST(SendsLowerResolutionOnSmallerFrames); |
| 628 | |
| 629 | WEBRTC_BASE_TEST(MuteStream); |
| 630 | |
| 631 | WEBRTC_BASE_TEST(MultipleSendStreams); |
| 632 | |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 633 | WEBRTC_BASE_TEST(SetSendStreamFormat0x0); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 634 | |
| 635 | // TODO(zhurunz): Fix the flakey test. |
pbos@webrtc.org | 8fdeee6 | 2014-07-20 14:40:23 +0000 | [diff] [blame] | 636 | WEBRTC_DISABLED_BASE_TEST(SetSendStreamFormat); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 637 | |
pbos@webrtc.org | 9359cb3 | 2014-07-23 15:44:48 +0000 | [diff] [blame] | 638 | TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Vga) { |
| 639 | SendAndReceive(cricket::VideoCodec(100, "VP8", 640, 400, 30, 0)); |
| 640 | } |
| 641 | |
| 642 | TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Qvga) { |
| 643 | SendAndReceive(cricket::VideoCodec(100, "VP8", 320, 200, 30, 0)); |
| 644 | } |
| 645 | |
| 646 | TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8SvcQqvga) { |
| 647 | SendAndReceive(cricket::VideoCodec(100, "VP8", 160, 100, 30, 0)); |
| 648 | } |
| 649 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 650 | TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsSendAndReceive) { |
| 651 | Base::TwoStreamsSendAndReceive(kVp8Codec); |
| 652 | } |
| 653 | |
| 654 | TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsReUseFirstStream) { |
| 655 | Base::TwoStreamsReUseFirstStream(kVp8Codec); |
| 656 | } |
| 657 | |
pbos@webrtc.org | 9359cb3 | 2014-07-23 15:44:48 +0000 | [diff] [blame] | 658 | WEBRTC_BASE_TEST(SendManyResizeOnce); |
| 659 | |
| 660 | // TODO(pbos): Enable and figure out why this fails (or should work). |
| 661 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_SendVp8HdAndReceiveAdaptedVp8Vga) { |
| 662 | EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL)); |
| 663 | EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); |
| 664 | channel_->UpdateAspectRatio(1280, 720); |
| 665 | video_capturer_.reset(new cricket::FakeVideoCapturer); |
| 666 | const std::vector<cricket::VideoFormat>* formats = |
| 667 | video_capturer_->GetSupportedFormats(); |
| 668 | cricket::VideoFormat capture_format_hd = (*formats)[0]; |
| 669 | EXPECT_EQ(cricket::CS_RUNNING, video_capturer_->Start(capture_format_hd)); |
| 670 | EXPECT_TRUE(channel_->SetCapturer(kSsrc, video_capturer_.get())); |
| 671 | |
| 672 | // Capture format HD -> adapt (OnOutputFormatRequest VGA) -> VGA. |
| 673 | cricket::VideoCodec codec(100, "VP8", 1280, 720, 30, 0); |
| 674 | EXPECT_TRUE(SetOneCodec(codec)); |
| 675 | codec.width /= 2; |
| 676 | codec.height /= 2; |
| 677 | EXPECT_TRUE(SetSend(true)); |
| 678 | EXPECT_TRUE(channel_->SetRender(true)); |
| 679 | EXPECT_EQ(0, renderer_.num_rendered_frames()); |
| 680 | EXPECT_TRUE(SendFrame()); |
| 681 | EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout); |
| 682 | } |
| 683 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 684 | class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test, |
| 685 | public WebRtcCallFactory { |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 686 | public: |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 687 | WebRtcVideoChannel2Test() : fake_call_(NULL) {} |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 688 | virtual void SetUp() OVERRIDE { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 689 | engine_.SetCallFactory(this); |
pbos@webrtc.org | 7fe1e03 | 2014-10-14 04:25:33 +0000 | [diff] [blame] | 690 | engine_.Init(rtc::Thread::Current()); |
buildbot@webrtc.org | 1ecbe45 | 2014-10-14 20:29:28 +0000 | [diff] [blame^] | 691 | channel_.reset(engine_.CreateChannel(cricket::VideoOptions(), NULL)); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 692 | ASSERT_TRUE(fake_call_ != NULL) << "Call not created through factory."; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 693 | last_ssrc_ = 123; |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 694 | ASSERT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | protected: |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 698 | virtual webrtc::Call* CreateCall( |
| 699 | const webrtc::Call::Config& config) OVERRIDE { |
| 700 | assert(fake_call_ == NULL); |
| 701 | fake_call_ = new FakeCall(config); |
| 702 | return fake_call_; |
| 703 | } |
| 704 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 705 | FakeVideoSendStream* AddSendStream() { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 706 | return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 707 | } |
| 708 | |
| 709 | FakeVideoSendStream* AddSendStream(const StreamParams& sp) { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 710 | size_t num_streams = fake_call_->GetVideoSendStreams().size(); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 711 | EXPECT_TRUE(channel_->AddSendStream(sp)); |
| 712 | std::vector<FakeVideoSendStream*> streams = |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 713 | fake_call_->GetVideoSendStreams(); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 714 | EXPECT_EQ(num_streams + 1, streams.size()); |
| 715 | return streams[streams.size() - 1]; |
| 716 | } |
| 717 | |
| 718 | std::vector<FakeVideoSendStream*> GetFakeSendStreams() { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 719 | return fake_call_->GetVideoSendStreams(); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 720 | } |
| 721 | |
| 722 | FakeVideoReceiveStream* AddRecvStream() { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 723 | return AddRecvStream(StreamParams::CreateLegacy(++last_ssrc_)); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 724 | } |
| 725 | |
| 726 | FakeVideoReceiveStream* AddRecvStream(const StreamParams& sp) { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 727 | size_t num_streams = fake_call_->GetVideoReceiveStreams().size(); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 728 | EXPECT_TRUE(channel_->AddRecvStream(sp)); |
| 729 | std::vector<FakeVideoReceiveStream*> streams = |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 730 | fake_call_->GetVideoReceiveStreams(); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 731 | EXPECT_EQ(num_streams + 1, streams.size()); |
| 732 | return streams[streams.size() - 1]; |
| 733 | } |
| 734 | |
| 735 | void SetSendCodecsShouldWorkForBitrates(const char* min_bitrate, |
| 736 | const char* max_bitrate) { |
| 737 | std::vector<VideoCodec> codecs; |
| 738 | codecs.push_back(kVp8Codec); |
| 739 | codecs[0].params[kCodecParamMinBitrate] = min_bitrate; |
| 740 | codecs[0].params[kCodecParamMaxBitrate] = max_bitrate; |
| 741 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)); |
| 742 | |
| 743 | FakeVideoSendStream* stream = AddSendStream(); |
| 744 | |
pbos@webrtc.org | 6ae48c6 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 745 | std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams(); |
| 746 | ASSERT_EQ(1u, video_streams.size()); |
| 747 | EXPECT_EQ(atoi(min_bitrate), video_streams.back().min_bitrate_bps / 1000); |
| 748 | EXPECT_EQ(atoi(max_bitrate), video_streams.back().max_bitrate_bps / 1000); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 749 | |
| 750 | VideoCodec codec; |
| 751 | EXPECT_TRUE(channel_->GetSendCodec(&codec)); |
| 752 | EXPECT_EQ(min_bitrate, codec.params[kCodecParamMinBitrate]); |
| 753 | EXPECT_EQ(max_bitrate, codec.params[kCodecParamMaxBitrate]); |
| 754 | } |
| 755 | |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 756 | void TestSetSendRtpHeaderExtensions(const std::string& cricket_ext, |
| 757 | const std::string& webrtc_ext) { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 758 | FakeCall* call = fake_call_; |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 759 | // Enable extension. |
| 760 | const int id = 1; |
| 761 | std::vector<cricket::RtpHeaderExtension> extensions; |
| 762 | extensions.push_back(cricket::RtpHeaderExtension(cricket_ext, id)); |
| 763 | EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(extensions)); |
| 764 | |
| 765 | FakeVideoSendStream* send_stream = |
| 766 | AddSendStream(cricket::StreamParams::CreateLegacy(123)); |
| 767 | |
| 768 | // Verify the send extension id. |
| 769 | ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size()); |
| 770 | EXPECT_EQ(id, send_stream->GetConfig().rtp.extensions[0].id); |
| 771 | EXPECT_EQ(webrtc_ext, send_stream->GetConfig().rtp.extensions[0].name); |
| 772 | // Verify call with same set of extensions returns true. |
| 773 | EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(extensions)); |
| 774 | // Verify that SetSendRtpHeaderExtensions doesn't implicitly add them for |
| 775 | // receivers. |
| 776 | EXPECT_TRUE(AddRecvStream(cricket::StreamParams::CreateLegacy(123)) |
| 777 | ->GetConfig() |
| 778 | .rtp.extensions.empty()); |
| 779 | |
pbos@webrtc.org | d1ea06b | 2014-07-18 09:35:58 +0000 | [diff] [blame] | 780 | // Verify that existing RTP header extensions can be removed. |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 781 | std::vector<cricket::RtpHeaderExtension> empty_extensions; |
| 782 | EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(empty_extensions)); |
pbos@webrtc.org | d1ea06b | 2014-07-18 09:35:58 +0000 | [diff] [blame] | 783 | ASSERT_EQ(1u, call->GetVideoSendStreams().size()); |
| 784 | send_stream = call->GetVideoSendStreams()[0]; |
| 785 | EXPECT_TRUE(send_stream->GetConfig().rtp.extensions.empty()); |
| 786 | |
| 787 | // Verify that adding receive RTP header extensions adds them for existing |
| 788 | // streams. |
| 789 | EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(extensions)); |
| 790 | send_stream = call->GetVideoSendStreams()[0]; |
| 791 | ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size()); |
| 792 | EXPECT_EQ(id, send_stream->GetConfig().rtp.extensions[0].id); |
| 793 | EXPECT_EQ(webrtc_ext, send_stream->GetConfig().rtp.extensions[0].name); |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 794 | } |
| 795 | |
| 796 | void TestSetRecvRtpHeaderExtensions(const std::string& cricket_ext, |
| 797 | const std::string& webrtc_ext) { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 798 | FakeCall* call = fake_call_; |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 799 | // Enable extension. |
| 800 | const int id = 1; |
| 801 | std::vector<cricket::RtpHeaderExtension> extensions; |
| 802 | extensions.push_back(cricket::RtpHeaderExtension(cricket_ext, id)); |
| 803 | EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions)); |
| 804 | |
| 805 | FakeVideoReceiveStream* recv_stream = |
| 806 | AddRecvStream(cricket::StreamParams::CreateLegacy(123)); |
| 807 | |
| 808 | // Verify the recv extension id. |
| 809 | ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size()); |
| 810 | EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id); |
| 811 | EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name); |
| 812 | // Verify call with same set of extensions returns true. |
| 813 | EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions)); |
pbos@webrtc.org | d1ea06b | 2014-07-18 09:35:58 +0000 | [diff] [blame] | 814 | |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 815 | // Verify that SetRecvRtpHeaderExtensions doesn't implicitly add them for |
| 816 | // senders. |
| 817 | EXPECT_TRUE(AddSendStream(cricket::StreamParams::CreateLegacy(123)) |
| 818 | ->GetConfig() |
| 819 | .rtp.extensions.empty()); |
| 820 | |
pbos@webrtc.org | d1ea06b | 2014-07-18 09:35:58 +0000 | [diff] [blame] | 821 | // Verify that existing RTP header extensions can be removed. |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 822 | std::vector<cricket::RtpHeaderExtension> empty_extensions; |
pbos@webrtc.org | d1ea06b | 2014-07-18 09:35:58 +0000 | [diff] [blame] | 823 | EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(empty_extensions)); |
| 824 | ASSERT_EQ(1u, call->GetVideoReceiveStreams().size()); |
| 825 | recv_stream = call->GetVideoReceiveStreams()[0]; |
| 826 | EXPECT_TRUE(recv_stream->GetConfig().rtp.extensions.empty()); |
| 827 | |
| 828 | // Verify that adding receive RTP header extensions adds them for existing |
| 829 | // streams. |
| 830 | EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions)); |
| 831 | recv_stream = call->GetVideoReceiveStreams()[0]; |
| 832 | ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size()); |
| 833 | EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id); |
| 834 | EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name); |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 835 | } |
| 836 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 837 | void TestCpuAdaptation(bool enable_overuse); |
| 838 | |
| 839 | FakeCall* fake_call_; |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 840 | rtc::scoped_ptr<VideoMediaChannel> channel_; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 841 | uint32 last_ssrc_; |
| 842 | }; |
| 843 | |
| 844 | TEST_F(WebRtcVideoChannel2Test, DISABLED_MaxBitrateResetsWithConferenceMode) { |
| 845 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 846 | } |
| 847 | |
| 848 | TEST_F(WebRtcVideoChannel2Test, DISABLED_StartSendBitrate) { |
| 849 | // TODO(pbos): Is this test testing vie_ ? this is confusing. No API to set |
| 850 | // start send bitrate from outside? Add defaults here that should be kept? |
| 851 | std::vector<cricket::VideoCodec> codec_list; |
| 852 | codec_list.push_back(kVp8Codec); |
| 853 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 854 | const unsigned int kVideoMinSendBitrateKbps = 50; |
| 855 | const unsigned int kVideoTargetSendBitrateKbps = 300; |
| 856 | const unsigned int kVideoMaxSendBitrateKbps = 2000; |
| 857 | FakeVideoSendStream* stream = AddSendStream(); |
pbos@webrtc.org | 6ae48c6 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 858 | std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams(); |
| 859 | ASSERT_EQ(1u, video_streams.size()); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 860 | EXPECT_EQ(kVideoMinSendBitrateKbps, |
pbos@webrtc.org | 6ae48c6 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 861 | video_streams.back().min_bitrate_bps / 1000); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 862 | EXPECT_EQ(kVideoTargetSendBitrateKbps, |
pbos@webrtc.org | 6ae48c6 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 863 | video_streams.back().target_bitrate_bps / 1000); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 864 | EXPECT_EQ(kVideoMaxSendBitrateKbps, |
pbos@webrtc.org | 6ae48c6 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 865 | video_streams.back().max_bitrate_bps / 1000); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 866 | #if 0 |
| 867 | // TODO(pbos): un-#if |
| 868 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 869 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 870 | kVideoDefaultStartSendBitrateKbps); |
| 871 | EXPECT_EQ(0, vie_.StartSend(send_channel)); |
| 872 | |
| 873 | // Increase the send bitrate and verify it is used as start bitrate. |
| 874 | const unsigned int kVideoSendBitrateBps = 768000; |
| 875 | vie_.SetSendBitrates(send_channel, kVideoSendBitrateBps, 0, 0); |
| 876 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 877 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 878 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 879 | kVideoSendBitrateBps / 1000); |
| 880 | |
| 881 | // Never set a start bitrate higher than the max bitrate. |
| 882 | vie_.SetSendBitrates(send_channel, kVideoMaxSendBitrateKbps + 500, 0, 0); |
| 883 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 884 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 885 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 886 | kVideoDefaultStartSendBitrateKbps); |
| 887 | |
| 888 | // Use the default start bitrate if the send bitrate is lower. |
| 889 | vie_.SetSendBitrates(send_channel, kVideoDefaultStartSendBitrateKbps - 50, 0, |
| 890 | 0); |
| 891 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 892 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 893 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 894 | kVideoDefaultStartSendBitrateKbps); |
| 895 | #endif |
| 896 | } |
| 897 | |
pbos@webrtc.org | e322a17 | 2014-06-13 11:47:28 +0000 | [diff] [blame] | 898 | TEST_F(WebRtcVideoChannel2Test, RecvStreamWithSimAndRtx) { |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 899 | EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
| 900 | EXPECT_TRUE(channel_->SetSend(true)); |
| 901 | cricket::VideoOptions options; |
| 902 | options.conference_mode.Set(true); |
| 903 | EXPECT_TRUE(channel_->SetOptions(options)); |
| 904 | |
| 905 | // Send side. |
| 906 | const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); |
| 907 | const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
| 908 | FakeVideoSendStream* send_stream = AddSendStream( |
| 909 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 910 | |
| 911 | ASSERT_EQ(rtx_ssrcs.size(), send_stream->GetConfig().rtp.rtx.ssrcs.size()); |
| 912 | for (size_t i = 0; i < rtx_ssrcs.size(); ++i) |
| 913 | EXPECT_EQ(rtx_ssrcs[i], send_stream->GetConfig().rtp.rtx.ssrcs[i]); |
| 914 | |
| 915 | // Receiver side. |
| 916 | FakeVideoReceiveStream* recv_stream = AddRecvStream( |
| 917 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 918 | ASSERT_GT(recv_stream->GetConfig().rtp.rtx.size(), 0u) |
| 919 | << "No SSRCs for RTX configured by AddRecvStream."; |
| 920 | ASSERT_EQ(1u, recv_stream->GetConfig().rtp.rtx.size()) |
| 921 | << "This test only works with one receive codec. Please update the test."; |
| 922 | EXPECT_EQ(rtx_ssrcs[0], |
| 923 | recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc); |
| 924 | // TODO(pbos): Make sure we set the RTX for correct payloads etc. |
| 925 | } |
| 926 | |
pbos@webrtc.org | e322a17 | 2014-06-13 11:47:28 +0000 | [diff] [blame] | 927 | TEST_F(WebRtcVideoChannel2Test, RecvStreamWithRtx) { |
| 928 | // Setup one channel with an associated RTX stream. |
| 929 | cricket::StreamParams params = |
| 930 | cricket::StreamParams::CreateLegacy(kSsrcs1[0]); |
| 931 | params.AddFidSsrc(kSsrcs1[0], kRtxSsrcs1[0]); |
| 932 | FakeVideoReceiveStream* recv_stream = AddRecvStream(params); |
| 933 | ASSERT_EQ(1u, recv_stream->GetConfig().rtp.rtx.size()); |
| 934 | EXPECT_EQ(kRtxSsrcs1[0], |
| 935 | recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 936 | } |
| 937 | |
pbos@webrtc.org | e322a17 | 2014-06-13 11:47:28 +0000 | [diff] [blame] | 938 | TEST_F(WebRtcVideoChannel2Test, RecvStreamNoRtx) { |
| 939 | // Setup one channel without an associated RTX stream. |
| 940 | cricket::StreamParams params = |
| 941 | cricket::StreamParams::CreateLegacy(kSsrcs1[0]); |
| 942 | FakeVideoReceiveStream* recv_stream = AddRecvStream(params); |
| 943 | ASSERT_TRUE(recv_stream->GetConfig().rtp.rtx.empty()); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 944 | } |
| 945 | |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 946 | TEST_F(WebRtcVideoChannel2Test, NoHeaderExtesionsByDefault) { |
| 947 | FakeVideoSendStream* send_stream = |
| 948 | AddSendStream(cricket::StreamParams::CreateLegacy(kSsrcs1[0])); |
| 949 | ASSERT_TRUE(send_stream->GetConfig().rtp.extensions.empty()); |
| 950 | |
| 951 | FakeVideoReceiveStream* recv_stream = |
| 952 | AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrcs1[0])); |
| 953 | ASSERT_TRUE(recv_stream->GetConfig().rtp.extensions.empty()); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 954 | } |
| 955 | |
pbos@webrtc.org | 587ef60 | 2014-06-16 17:32:02 +0000 | [diff] [blame] | 956 | // Test support for RTP timestamp offset header extension. |
| 957 | TEST_F(WebRtcVideoChannel2Test, SendRtpTimestampOffsetHeaderExtensions) { |
| 958 | TestSetSendRtpHeaderExtensions(kRtpTimestampOffsetHeaderExtension, |
| 959 | webrtc::RtpExtension::kTOffset); |
| 960 | } |
| 961 | TEST_F(WebRtcVideoChannel2Test, RecvRtpTimestampOffsetHeaderExtensions) { |
| 962 | TestSetRecvRtpHeaderExtensions(kRtpTimestampOffsetHeaderExtension, |
| 963 | webrtc::RtpExtension::kTOffset); |
| 964 | } |
| 965 | |
| 966 | // Test support for absolute send time header extension. |
| 967 | TEST_F(WebRtcVideoChannel2Test, SendAbsoluteSendTimeHeaderExtensions) { |
| 968 | TestSetSendRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension, |
| 969 | webrtc::RtpExtension::kAbsSendTime); |
| 970 | } |
| 971 | TEST_F(WebRtcVideoChannel2Test, RecvAbsoluteSendTimeHeaderExtensions) { |
| 972 | TestSetRecvRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension, |
| 973 | webrtc::RtpExtension::kAbsSendTime); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 974 | } |
| 975 | |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 976 | TEST_F(WebRtcVideoChannel2Test, |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 977 | SetSendRtpHeaderExtensionsExcludeUnsupportedExtensions) { |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 978 | const int kUnsupportedId = 1; |
| 979 | const int kTOffsetId = 2; |
| 980 | |
| 981 | std::vector<cricket::RtpHeaderExtension> extensions; |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 982 | extensions.push_back( |
| 983 | cricket::RtpHeaderExtension(kUnsupportedExtensionName, kUnsupportedId)); |
| 984 | extensions.push_back( |
| 985 | cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, kTOffsetId)); |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 986 | EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(extensions)); |
| 987 | FakeVideoSendStream* send_stream = |
| 988 | AddSendStream(cricket::StreamParams::CreateLegacy(123)); |
| 989 | |
| 990 | // Only timestamp offset extension is set to send stream, |
| 991 | // unsupported rtp extension is ignored. |
| 992 | ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size()); |
| 993 | EXPECT_STREQ(webrtc::RtpExtension::kTOffset, |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 994 | send_stream->GetConfig().rtp.extensions[0].name.c_str()); |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 995 | } |
| 996 | |
| 997 | TEST_F(WebRtcVideoChannel2Test, |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 998 | SetRecvRtpHeaderExtensionsExcludeUnsupportedExtensions) { |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 999 | const int kUnsupportedId = 1; |
| 1000 | const int kTOffsetId = 2; |
| 1001 | |
| 1002 | std::vector<cricket::RtpHeaderExtension> extensions; |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1003 | extensions.push_back( |
| 1004 | cricket::RtpHeaderExtension(kUnsupportedExtensionName, kUnsupportedId)); |
| 1005 | extensions.push_back( |
| 1006 | cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, kTOffsetId)); |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1007 | EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions)); |
| 1008 | FakeVideoReceiveStream* recv_stream = |
| 1009 | AddRecvStream(cricket::StreamParams::CreateLegacy(123)); |
| 1010 | |
| 1011 | // Only timestamp offset extension is set to receive stream, |
| 1012 | // unsupported rtp extension is ignored. |
| 1013 | ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size()); |
| 1014 | EXPECT_STREQ(webrtc::RtpExtension::kTOffset, |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1015 | recv_stream->GetConfig().rtp.extensions[0].name.c_str()); |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1016 | } |
| 1017 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1018 | TEST_F(WebRtcVideoChannel2Test, SetSendRtpHeaderExtensionsRejectsIncorrectIds) { |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1019 | const size_t kNumIncorrectIds = 4; |
| 1020 | const int kIncorrectIds[kNumIncorrectIds] = {-2, -1, 15, 16}; |
| 1021 | for (size_t i = 0; i < kNumIncorrectIds; ++i) { |
| 1022 | std::vector<cricket::RtpHeaderExtension> extensions; |
| 1023 | extensions.push_back(cricket::RtpHeaderExtension( |
| 1024 | webrtc::RtpExtension::kTOffset, kIncorrectIds[i])); |
| 1025 | EXPECT_FALSE(channel_->SetSendRtpHeaderExtensions(extensions)) |
| 1026 | << "Bad extension id '" << kIncorrectIds[i] << "' accepted."; |
| 1027 | } |
| 1028 | } |
| 1029 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1030 | TEST_F(WebRtcVideoChannel2Test, SetRecvRtpHeaderExtensionsRejectsIncorrectIds) { |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1031 | const size_t kNumIncorrectIds = 4; |
| 1032 | const int kIncorrectIds[kNumIncorrectIds] = {-2, -1, 15, 16}; |
| 1033 | for (size_t i = 0; i < kNumIncorrectIds; ++i) { |
| 1034 | std::vector<cricket::RtpHeaderExtension> extensions; |
| 1035 | extensions.push_back(cricket::RtpHeaderExtension( |
| 1036 | webrtc::RtpExtension::kTOffset, kIncorrectIds[i])); |
| 1037 | EXPECT_FALSE(channel_->SetRecvRtpHeaderExtensions(extensions)) |
| 1038 | << "Bad extension id '" << kIncorrectIds[i] << "' accepted."; |
| 1039 | } |
| 1040 | } |
| 1041 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1042 | TEST_F(WebRtcVideoChannel2Test, SetSendRtpHeaderExtensionsRejectsDuplicateIds) { |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1043 | const int id = 1; |
| 1044 | std::vector<cricket::RtpHeaderExtension> extensions; |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1045 | extensions.push_back( |
| 1046 | cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, id)); |
| 1047 | extensions.push_back( |
| 1048 | cricket::RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension, id)); |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1049 | EXPECT_FALSE(channel_->SetSendRtpHeaderExtensions(extensions)); |
| 1050 | |
| 1051 | // Duplicate entries are also not supported. |
| 1052 | extensions.clear(); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1053 | extensions.push_back( |
| 1054 | cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, id)); |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1055 | extensions.push_back(extensions.back()); |
| 1056 | EXPECT_FALSE(channel_->SetSendRtpHeaderExtensions(extensions)); |
| 1057 | } |
| 1058 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1059 | TEST_F(WebRtcVideoChannel2Test, SetRecvRtpHeaderExtensionsRejectsDuplicateIds) { |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1060 | const int id = 1; |
| 1061 | std::vector<cricket::RtpHeaderExtension> extensions; |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1062 | extensions.push_back( |
| 1063 | cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, id)); |
| 1064 | extensions.push_back( |
| 1065 | cricket::RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension, id)); |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1066 | EXPECT_FALSE(channel_->SetRecvRtpHeaderExtensions(extensions)); |
| 1067 | |
| 1068 | // Duplicate entries are also not supported. |
| 1069 | extensions.clear(); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1070 | extensions.push_back( |
| 1071 | cricket::RtpHeaderExtension(webrtc::RtpExtension::kTOffset, id)); |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 1072 | extensions.push_back(extensions.back()); |
| 1073 | EXPECT_FALSE(channel_->SetRecvRtpHeaderExtensions(extensions)); |
| 1074 | } |
| 1075 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1076 | TEST_F(WebRtcVideoChannel2Test, DISABLED_LeakyBucketTest) { |
| 1077 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1078 | } |
| 1079 | |
| 1080 | TEST_F(WebRtcVideoChannel2Test, DISABLED_BufferedModeLatency) { |
| 1081 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1082 | } |
| 1083 | |
| 1084 | TEST_F(WebRtcVideoChannel2Test, DISABLED_AdditiveVideoOptions) { |
| 1085 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1086 | } |
| 1087 | |
| 1088 | TEST_F(WebRtcVideoChannel2Test, AddRecvStreamOnlyUsesOneReceiveStream) { |
| 1089 | EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1090 | EXPECT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1091 | } |
| 1092 | |
pbos@webrtc.org | 257e130 | 2014-07-25 19:01:32 +0000 | [diff] [blame] | 1093 | TEST_F(WebRtcVideoChannel2Test, RembIsEnabledByDefault) { |
| 1094 | FakeVideoReceiveStream* stream = AddRecvStream(); |
| 1095 | EXPECT_TRUE(stream->GetConfig().rtp.remb); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1096 | } |
| 1097 | |
pbos@webrtc.org | 257e130 | 2014-07-25 19:01:32 +0000 | [diff] [blame] | 1098 | TEST_F(WebRtcVideoChannel2Test, RembCanBeEnabledAndDisabled) { |
| 1099 | FakeVideoReceiveStream* stream = AddRecvStream(); |
| 1100 | EXPECT_TRUE(stream->GetConfig().rtp.remb); |
| 1101 | |
| 1102 | // Verify that REMB is turned off when codecs without REMB are set. |
| 1103 | std::vector<VideoCodec> codecs; |
| 1104 | codecs.push_back(kVp8Codec); |
| 1105 | EXPECT_TRUE(codecs[0].feedback_params.params().empty()); |
| 1106 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1107 | stream = fake_call_->GetVideoReceiveStreams()[0]; |
pbos@webrtc.org | 257e130 | 2014-07-25 19:01:32 +0000 | [diff] [blame] | 1108 | EXPECT_FALSE(stream->GetConfig().rtp.remb); |
| 1109 | |
| 1110 | // Verify that REMB is turned on when setting default codecs since the |
| 1111 | // default codecs have REMB enabled. |
| 1112 | EXPECT_TRUE(channel_->SetRecvCodecs(engine_.codecs())); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1113 | stream = fake_call_->GetVideoReceiveStreams()[0]; |
pbos@webrtc.org | 257e130 | 2014-07-25 19:01:32 +0000 | [diff] [blame] | 1114 | EXPECT_TRUE(stream->GetConfig().rtp.remb); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1115 | } |
| 1116 | |
pbos@webrtc.org | f99c2f2 | 2014-06-13 12:27:38 +0000 | [diff] [blame] | 1117 | TEST_F(WebRtcVideoChannel2Test, NackIsEnabledByDefault) { |
| 1118 | VerifyCodecHasDefaultFeedbackParams(default_codec_); |
| 1119 | |
pbos@webrtc.org | 1986474 | 2014-05-30 07:35:47 +0000 | [diff] [blame] | 1120 | EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
| 1121 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1122 | |
| 1123 | // Send side. |
| 1124 | FakeVideoSendStream* send_stream = |
| 1125 | AddSendStream(cricket::StreamParams::CreateLegacy(1)); |
| 1126 | EXPECT_GT(send_stream->GetConfig().rtp.nack.rtp_history_ms, 0); |
| 1127 | |
| 1128 | // Receiver side. |
| 1129 | FakeVideoReceiveStream* recv_stream = |
| 1130 | AddRecvStream(cricket::StreamParams::CreateLegacy(1)); |
| 1131 | EXPECT_GT(recv_stream->GetConfig().rtp.nack.rtp_history_ms, 0); |
| 1132 | |
| 1133 | // Nack history size should match between sender and receiver. |
| 1134 | EXPECT_EQ(send_stream->GetConfig().rtp.nack.rtp_history_ms, |
| 1135 | recv_stream->GetConfig().rtp.nack.rtp_history_ms); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1136 | } |
| 1137 | |
pbos@webrtc.org | f99c2f2 | 2014-06-13 12:27:38 +0000 | [diff] [blame] | 1138 | TEST_F(WebRtcVideoChannel2Test, NackCanBeDisabled) { |
| 1139 | std::vector<VideoCodec> codecs; |
| 1140 | codecs.push_back(kVp8Codec); |
| 1141 | |
| 1142 | // Send side. |
| 1143 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
| 1144 | FakeVideoSendStream* send_stream = |
| 1145 | AddSendStream(cricket::StreamParams::CreateLegacy(1)); |
| 1146 | EXPECT_EQ(0, send_stream->GetConfig().rtp.nack.rtp_history_ms); |
| 1147 | |
| 1148 | // Receiver side. |
| 1149 | ASSERT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1150 | FakeVideoReceiveStream* recv_stream = |
| 1151 | AddRecvStream(cricket::StreamParams::CreateLegacy(1)); |
| 1152 | EXPECT_EQ(0, recv_stream->GetConfig().rtp.nack.rtp_history_ms); |
| 1153 | } |
| 1154 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1155 | TEST_F(WebRtcVideoChannel2Test, DISABLED_VideoProtectionInterop) { |
| 1156 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1157 | } |
| 1158 | |
| 1159 | TEST_F(WebRtcVideoChannel2Test, DISABLED_VideoProtectionInteropReversed) { |
| 1160 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1161 | } |
| 1162 | |
| 1163 | TEST_F(WebRtcVideoChannel2Test, DISABLED_HybridNackFecConference) { |
| 1164 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1165 | } |
| 1166 | |
| 1167 | TEST_F(WebRtcVideoChannel2Test, DISABLED_AddRemoveRecvStreamConference) { |
| 1168 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1169 | } |
| 1170 | |
| 1171 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetRender) { |
| 1172 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1173 | } |
| 1174 | |
| 1175 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthAuto) { |
| 1176 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1177 | } |
| 1178 | |
| 1179 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthAutoCapped) { |
| 1180 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1181 | } |
| 1182 | |
| 1183 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthFixed) { |
| 1184 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1185 | } |
| 1186 | |
| 1187 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthInConference) { |
| 1188 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1189 | } |
| 1190 | |
| 1191 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthScreencast) { |
| 1192 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1193 | } |
| 1194 | |
| 1195 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetSendSsrcAndCname) { |
| 1196 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1197 | } |
| 1198 | |
| 1199 | TEST_F(WebRtcVideoChannel2Test, |
| 1200 | DISABLED_SetSendSsrcAfterCreatingReceiveChannel) { |
| 1201 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1202 | } |
| 1203 | |
pbos@webrtc.org | 5ff71ab | 2014-07-23 07:28:56 +0000 | [diff] [blame] | 1204 | TEST_F(WebRtcVideoChannel2Test, SuspendBelowMinBitrateDisabledByDefault) { |
| 1205 | FakeVideoSendStream* stream = AddSendStream(); |
| 1206 | EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); |
| 1207 | } |
| 1208 | |
| 1209 | TEST_F(WebRtcVideoChannel2Test, SetOptionsWithSuspendBelowMinBitrate) { |
| 1210 | VideoOptions options; |
| 1211 | options.suspend_below_min_bitrate.Set(true); |
| 1212 | channel_->SetOptions(options); |
| 1213 | |
| 1214 | FakeVideoSendStream* stream = AddSendStream(); |
| 1215 | EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate); |
| 1216 | |
| 1217 | options.suspend_below_min_bitrate.Set(false); |
| 1218 | channel_->SetOptions(options); |
| 1219 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1220 | stream = fake_call_->GetVideoSendStreams()[0]; |
pbos@webrtc.org | 5ff71ab | 2014-07-23 07:28:56 +0000 | [diff] [blame] | 1221 | EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); |
| 1222 | } |
| 1223 | |
pbos@webrtc.org | 543e589 | 2014-07-23 07:01:31 +0000 | [diff] [blame] | 1224 | TEST_F(WebRtcVideoChannel2Test, RedundantPayloadsDisabledByDefault) { |
| 1225 | const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); |
| 1226 | const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
| 1227 | FakeVideoSendStream* stream = AddSendStream( |
| 1228 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 1229 | EXPECT_FALSE(stream->GetConfig().rtp.rtx.pad_with_redundant_payloads); |
| 1230 | } |
| 1231 | |
| 1232 | TEST_F(WebRtcVideoChannel2Test, SetOptionsWithPayloadPadding) { |
| 1233 | VideoOptions options; |
| 1234 | options.use_payload_padding.Set(true); |
| 1235 | channel_->SetOptions(options); |
| 1236 | |
| 1237 | const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); |
| 1238 | const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
| 1239 | FakeVideoSendStream* stream = AddSendStream( |
| 1240 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 1241 | EXPECT_TRUE(stream->GetConfig().rtp.rtx.pad_with_redundant_payloads); |
| 1242 | |
| 1243 | options.use_payload_padding.Set(false); |
| 1244 | channel_->SetOptions(options); |
| 1245 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1246 | stream = fake_call_->GetVideoSendStreams()[0]; |
pbos@webrtc.org | 543e589 | 2014-07-23 07:01:31 +0000 | [diff] [blame] | 1247 | EXPECT_FALSE(stream->GetConfig().rtp.rtx.pad_with_redundant_payloads); |
| 1248 | } |
| 1249 | |
pbos@webrtc.org | 6f48f1b | 2014-07-22 16:29:54 +0000 | [diff] [blame] | 1250 | TEST_F(WebRtcVideoChannel2Test, Vp8DenoisingEnabledByDefault) { |
| 1251 | FakeVideoSendStream* stream = AddSendStream(); |
| 1252 | webrtc::VideoCodecVP8 vp8_settings; |
| 1253 | ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; |
| 1254 | EXPECT_TRUE(vp8_settings.denoisingOn); |
| 1255 | } |
| 1256 | |
| 1257 | TEST_F(WebRtcVideoChannel2Test, SetOptionsWithDenoising) { |
| 1258 | VideoOptions options; |
| 1259 | options.video_noise_reduction.Set(false); |
| 1260 | channel_->SetOptions(options); |
| 1261 | |
| 1262 | FakeVideoSendStream* stream = AddSendStream(); |
| 1263 | webrtc::VideoCodecVP8 vp8_settings; |
| 1264 | ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; |
| 1265 | EXPECT_FALSE(vp8_settings.denoisingOn); |
| 1266 | |
| 1267 | options.video_noise_reduction.Set(true); |
| 1268 | channel_->SetOptions(options); |
| 1269 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1270 | stream = fake_call_->GetVideoSendStreams()[0]; |
pbos@webrtc.org | 6f48f1b | 2014-07-22 16:29:54 +0000 | [diff] [blame] | 1271 | ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set."; |
| 1272 | EXPECT_TRUE(vp8_settings.denoisingOn); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1273 | } |
| 1274 | |
| 1275 | TEST_F(WebRtcVideoChannel2Test, DISABLED_MultipleSendStreamsWithOneCapturer) { |
| 1276 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1277 | } |
| 1278 | |
pbos@webrtc.org | 8aed945 | 2014-07-26 10:16:49 +0000 | [diff] [blame] | 1279 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendReceiveBitratesStats) { |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1280 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1281 | } |
| 1282 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1283 | TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruse) { |
| 1284 | TestCpuAdaptation(true); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1285 | } |
| 1286 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1287 | TEST_F(WebRtcVideoChannel2Test, DoesNotAdaptOnOveruseWhenDisabled) { |
| 1288 | TestCpuAdaptation(false); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1289 | } |
| 1290 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1291 | void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse) { |
| 1292 | cricket::VideoCodec codec(100, "VP8", 1280, 720, 30, 0); |
| 1293 | std::vector<cricket::VideoCodec> codecs; |
| 1294 | codecs.push_back(codec); |
| 1295 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)); |
| 1296 | |
| 1297 | if (enable_overuse) { |
| 1298 | VideoOptions options; |
| 1299 | options.cpu_overuse_detection.Set(true); |
| 1300 | channel_->SetOptions(options); |
| 1301 | } |
| 1302 | |
| 1303 | AddSendStream(); |
| 1304 | |
| 1305 | cricket::FakeVideoCapturer capturer; |
| 1306 | EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer)); |
| 1307 | EXPECT_EQ(cricket::CS_RUNNING, |
| 1308 | capturer.Start(capturer.GetSupportedFormats()->front())); |
| 1309 | |
| 1310 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1311 | |
| 1312 | // Trigger overuse. |
| 1313 | webrtc::LoadObserver* overuse_callback = |
| 1314 | fake_call_->GetConfig().overuse_callback; |
| 1315 | ASSERT_TRUE(overuse_callback != NULL); |
| 1316 | overuse_callback->OnLoadUpdate(webrtc::LoadObserver::kOveruse); |
| 1317 | |
| 1318 | EXPECT_TRUE(capturer.CaptureFrame()); |
| 1319 | ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); |
| 1320 | FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front(); |
| 1321 | |
| 1322 | EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); |
| 1323 | |
| 1324 | if (enable_overuse) { |
| 1325 | EXPECT_LT(send_stream->GetLastWidth(), codec.width); |
| 1326 | EXPECT_LT(send_stream->GetLastHeight(), codec.height); |
| 1327 | } else { |
| 1328 | EXPECT_EQ(codec.width, send_stream->GetLastWidth()); |
| 1329 | EXPECT_EQ(codec.height, send_stream->GetLastHeight()); |
| 1330 | } |
| 1331 | |
| 1332 | // Trigger underuse which should go back to normal resolution. |
| 1333 | overuse_callback->OnLoadUpdate(webrtc::LoadObserver::kUnderuse); |
| 1334 | EXPECT_TRUE(capturer.CaptureFrame()); |
| 1335 | |
| 1336 | EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames()); |
| 1337 | |
| 1338 | EXPECT_EQ(codec.width, send_stream->GetLastWidth()); |
| 1339 | EXPECT_EQ(codec.height, send_stream->GetLastHeight()); |
| 1340 | |
| 1341 | EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL)); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1342 | } |
| 1343 | |
| 1344 | TEST_F(WebRtcVideoChannel2Test, DISABLED_WebRtcShouldLog) { |
| 1345 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1346 | } |
| 1347 | |
| 1348 | TEST_F(WebRtcVideoChannel2Test, DISABLED_WebRtcShouldNotLog) { |
| 1349 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1350 | } |
| 1351 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1352 | TEST_F(WebRtcVideoChannel2Test, SetDefaultSendCodecs) { |
pbos@webrtc.org | 9fbb717 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 1353 | ASSERT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1354 | |
| 1355 | VideoCodec codec; |
| 1356 | EXPECT_TRUE(channel_->GetSendCodec(&codec)); |
pbos@webrtc.org | 9fbb717 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 1357 | EXPECT_TRUE(codec.Matches(engine_.codecs()[0])); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1358 | |
| 1359 | // Using a RTX setup to verify that the default RTX payload type is good. |
| 1360 | const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); |
| 1361 | const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
| 1362 | FakeVideoSendStream* stream = AddSendStream( |
| 1363 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 1364 | webrtc::VideoSendStream::Config config = stream->GetConfig(); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1365 | |
| 1366 | // Make sure NACK and FEC are enabled on the correct payload types. |
| 1367 | EXPECT_EQ(1000, config.rtp.nack.rtp_history_ms); |
| 1368 | EXPECT_EQ(default_ulpfec_codec_.id, config.rtp.fec.ulpfec_payload_type); |
| 1369 | EXPECT_EQ(default_red_codec_.id, config.rtp.fec.red_payload_type); |
pbos@webrtc.org | 269605c | 2014-06-26 08:49:03 +0000 | [diff] [blame] | 1370 | |
| 1371 | EXPECT_EQ(1u, config.rtp.rtx.ssrcs.size()); |
| 1372 | EXPECT_EQ(kRtxSsrcs1[0], config.rtp.rtx.ssrcs[0]); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1373 | EXPECT_EQ(static_cast<int>(default_rtx_codec_.id), |
| 1374 | config.rtp.rtx.payload_type); |
| 1375 | // TODO(juberti): Check RTCP, PLI, TMMBR. |
| 1376 | } |
| 1377 | |
| 1378 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) { |
| 1379 | std::vector<VideoCodec> codecs; |
| 1380 | codecs.push_back(kVp8Codec); |
| 1381 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
| 1382 | |
| 1383 | FakeVideoSendStream* stream = AddSendStream(); |
| 1384 | webrtc::VideoSendStream::Config config = stream->GetConfig(); |
| 1385 | |
| 1386 | EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type); |
| 1387 | EXPECT_EQ(-1, config.rtp.fec.red_payload_type); |
| 1388 | } |
| 1389 | |
| 1390 | TEST_F(WebRtcVideoChannel2Test, |
pbos@webrtc.org | 269605c | 2014-06-26 08:49:03 +0000 | [diff] [blame] | 1391 | SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { |
| 1392 | std::vector<VideoCodec> codecs; |
| 1393 | cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0); |
| 1394 | codecs.push_back(rtx_codec); |
| 1395 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 1396 | << "RTX codec without associated payload type should be rejected."; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1397 | } |
| 1398 | |
| 1399 | TEST_F(WebRtcVideoChannel2Test, |
pbos@webrtc.org | 269605c | 2014-06-26 08:49:03 +0000 | [diff] [blame] | 1400 | SetSendCodecRejectsRtxWithoutMatchingVideoCodec) { |
| 1401 | std::vector<VideoCodec> codecs; |
| 1402 | cricket::VideoCodec rtx_codec = |
| 1403 | cricket::VideoCodec::CreateRtxCodec(96, kVp8Codec.id); |
| 1404 | codecs.push_back(kVp8Codec); |
| 1405 | codecs.push_back(rtx_codec); |
| 1406 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
| 1407 | |
| 1408 | cricket::VideoCodec rtx_codec2 = |
| 1409 | cricket::VideoCodec::CreateRtxCodec(96, kVp8Codec.id + 1); |
| 1410 | codecs.pop_back(); |
| 1411 | codecs.push_back(rtx_codec2); |
| 1412 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 1413 | << "RTX without matching video codec should be rejected."; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1414 | } |
| 1415 | |
pbos@webrtc.org | 269605c | 2014-06-26 08:49:03 +0000 | [diff] [blame] | 1416 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFecDisablesFec) { |
| 1417 | std::vector<VideoCodec> codecs; |
| 1418 | codecs.push_back(kVp8Codec); |
| 1419 | codecs.push_back(kUlpfecCodec); |
| 1420 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
| 1421 | |
| 1422 | FakeVideoSendStream* stream = AddSendStream(); |
| 1423 | webrtc::VideoSendStream::Config config = stream->GetConfig(); |
| 1424 | |
| 1425 | EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type); |
| 1426 | |
| 1427 | codecs.pop_back(); |
| 1428 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1429 | stream = fake_call_->GetVideoSendStreams()[0]; |
pbos@webrtc.org | 269605c | 2014-06-26 08:49:03 +0000 | [diff] [blame] | 1430 | ASSERT_TRUE(stream != NULL); |
| 1431 | config = stream->GetConfig(); |
| 1432 | EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type) |
| 1433 | << "SetSendCodec without FEC should disable current FEC."; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1434 | } |
| 1435 | |
pbos@webrtc.org | 38ce7d0 | 2014-07-16 08:01:38 +0000 | [diff] [blame] | 1436 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) { |
| 1437 | std::vector<VideoCodec> codecs; |
| 1438 | codecs.push_back(kVp8Codec720p); |
| 1439 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
| 1440 | |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1441 | std::vector<webrtc::VideoStream> streams = AddSendStream()->GetVideoStreams(); |
pbos@webrtc.org | 38ce7d0 | 2014-07-16 08:01:38 +0000 | [diff] [blame] | 1442 | EXPECT_EQ(kVp8Codec720p.width, streams[0].width); |
| 1443 | EXPECT_EQ(kVp8Codec720p.height, streams[0].height); |
| 1444 | |
| 1445 | codecs.clear(); |
| 1446 | codecs.push_back(kVp8Codec360p); |
| 1447 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1448 | streams = fake_call_->GetVideoSendStreams()[0]->GetVideoStreams(); |
pbos@webrtc.org | 38ce7d0 | 2014-07-16 08:01:38 +0000 | [diff] [blame] | 1449 | EXPECT_EQ(kVp8Codec360p.width, streams[0].width); |
| 1450 | EXPECT_EQ(kVp8Codec360p.height, streams[0].height); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1451 | } |
| 1452 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1453 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMinMaxBitrate) { |
| 1454 | SetSendCodecsShouldWorkForBitrates("10", "20"); |
| 1455 | } |
| 1456 | |
| 1457 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectsMaxLessThanMinBitrate) { |
pbos@webrtc.org | 9fbb717 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 1458 | std::vector<VideoCodec> video_codecs = engine_.codecs(); |
| 1459 | video_codecs[0].params[kCodecParamMinBitrate] = "30"; |
| 1460 | video_codecs[0].params[kCodecParamMaxBitrate] = "20"; |
| 1461 | EXPECT_FALSE(channel_->SetSendCodecs(video_codecs)); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1462 | } |
| 1463 | |
| 1464 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptLargeMinMaxBitrate) { |
| 1465 | SetSendCodecsShouldWorkForBitrates("1000", "2000"); |
| 1466 | } |
| 1467 | |
| 1468 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) { |
| 1469 | static const char* kMaxQuantization = "21"; |
| 1470 | std::vector<VideoCodec> codecs; |
| 1471 | codecs.push_back(kVp8Codec); |
| 1472 | codecs[0].params[kCodecParamMaxQuantization] = kMaxQuantization; |
| 1473 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)); |
pbos@webrtc.org | 6ae48c6 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 1474 | EXPECT_EQ(static_cast<unsigned int>(atoi(kMaxQuantization)), |
| 1475 | AddSendStream()->GetVideoStreams().back().max_qp); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1476 | |
| 1477 | VideoCodec codec; |
| 1478 | EXPECT_TRUE(channel_->GetSendCodec(&codec)); |
| 1479 | EXPECT_EQ(kMaxQuantization, codec.params[kCodecParamMaxQuantization]); |
| 1480 | } |
| 1481 | |
| 1482 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectBadDimensions) { |
| 1483 | std::vector<cricket::VideoCodec> codecs; |
| 1484 | codecs.push_back(kVp8Codec); |
| 1485 | |
| 1486 | codecs[0].width = 0; |
| 1487 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 1488 | << "Codec set though codec width is zero."; |
| 1489 | |
| 1490 | codecs[0].width = kVp8Codec.width; |
| 1491 | codecs[0].height = 0; |
| 1492 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 1493 | << "Codec set though codec height is zero."; |
| 1494 | } |
| 1495 | |
| 1496 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectBadPayloadTypes) { |
| 1497 | // TODO(pbos): Should we only allow the dynamic range? |
| 1498 | static const size_t kNumIncorrectPayloads = 4; |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1499 | static const int kIncorrectPayloads[kNumIncorrectPayloads] = { |
| 1500 | -2, -1, 128, 129}; |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1501 | std::vector<cricket::VideoCodec> codecs; |
| 1502 | codecs.push_back(kVp8Codec); |
| 1503 | for (size_t i = 0; i < kNumIncorrectPayloads; ++i) { |
| 1504 | int payload_type = kIncorrectPayloads[i]; |
| 1505 | codecs[0].id = payload_type; |
| 1506 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 1507 | << "Bad payload type '" << payload_type << "' accepted."; |
| 1508 | } |
| 1509 | } |
| 1510 | |
| 1511 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptAllValidPayloadTypes) { |
| 1512 | std::vector<cricket::VideoCodec> codecs; |
| 1513 | codecs.push_back(kVp8Codec); |
| 1514 | for (int payload_type = 0; payload_type <= 127; ++payload_type) { |
| 1515 | codecs[0].id = payload_type; |
| 1516 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)) |
| 1517 | << "Payload type '" << payload_type << "' rejected."; |
| 1518 | } |
| 1519 | } |
| 1520 | |
| 1521 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ResetVieSendCodecOnNewFrameSize) { |
| 1522 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1523 | } |
| 1524 | |
| 1525 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithOnlyVp8) { |
| 1526 | std::vector<cricket::VideoCodec> codecs; |
| 1527 | codecs.push_back(kVp8Codec); |
| 1528 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1529 | } |
| 1530 | |
pbos@webrtc.org | e322a17 | 2014-06-13 11:47:28 +0000 | [diff] [blame] | 1531 | // Test that we set our inbound RTX codecs properly. |
| 1532 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithRtx) { |
| 1533 | std::vector<cricket::VideoCodec> codecs; |
| 1534 | codecs.push_back(kVp8Codec); |
| 1535 | cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0); |
| 1536 | codecs.push_back(rtx_codec); |
| 1537 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)) |
| 1538 | << "RTX codec without associated payload should be rejected."; |
| 1539 | |
| 1540 | codecs[1].SetParam("apt", kVp8Codec.id + 1); |
| 1541 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)) |
| 1542 | << "RTX codec with invalid associated payload type should be rejected."; |
| 1543 | |
| 1544 | codecs[1].SetParam("apt", kVp8Codec.id); |
| 1545 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1546 | |
| 1547 | cricket::VideoCodec rtx_codec2(97, "rtx", 0, 0, 0, 0); |
| 1548 | rtx_codec2.SetParam("apt", rtx_codec.id); |
| 1549 | codecs.push_back(rtx_codec2); |
| 1550 | |
| 1551 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)) << "RTX codec with another RTX " |
| 1552 | "as associated payload type " |
| 1553 | "should be rejected."; |
| 1554 | } |
| 1555 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1556 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsDifferentPayloadType) { |
| 1557 | std::vector<cricket::VideoCodec> codecs; |
| 1558 | codecs.push_back(kVp8Codec); |
| 1559 | codecs[0].id = 99; |
| 1560 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1561 | } |
| 1562 | |
pbos@webrtc.org | ccbed3b | 2014-07-11 13:02:54 +0000 | [diff] [blame] | 1563 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsAcceptDefaultCodecs) { |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1564 | EXPECT_TRUE(channel_->SetRecvCodecs(engine_.codecs())); |
pbos@webrtc.org | ccbed3b | 2014-07-11 13:02:54 +0000 | [diff] [blame] | 1565 | |
| 1566 | FakeVideoReceiveStream* stream = AddRecvStream(); |
| 1567 | webrtc::VideoReceiveStream::Config config = stream->GetConfig(); |
| 1568 | EXPECT_STREQ(engine_.codecs()[0].name.c_str(), config.codecs[0].plName); |
| 1569 | EXPECT_EQ(engine_.codecs()[0].id, config.codecs[0].plType); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1570 | } |
| 1571 | |
| 1572 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) { |
| 1573 | std::vector<VideoCodec> codecs; |
| 1574 | codecs.push_back(kVp8Codec); |
| 1575 | codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30, 0)); |
| 1576 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)); |
| 1577 | } |
| 1578 | |
| 1579 | // TODO(pbos): Enable VP9 through external codec support |
| 1580 | TEST_F(WebRtcVideoChannel2Test, |
| 1581 | DISABLED_SetRecvCodecsAcceptsMultipleVideoCodecs) { |
| 1582 | std::vector<VideoCodec> codecs; |
| 1583 | codecs.push_back(kVp8Codec); |
| 1584 | codecs.push_back(kVp9Codec); |
| 1585 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1586 | } |
| 1587 | |
| 1588 | TEST_F(WebRtcVideoChannel2Test, |
| 1589 | DISABLED_SetRecvCodecsSetsFecForAllVideoCodecs) { |
| 1590 | std::vector<VideoCodec> codecs; |
| 1591 | codecs.push_back(kVp8Codec); |
| 1592 | codecs.push_back(kVp9Codec); |
| 1593 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1594 | FAIL(); // TODO(pbos): Verify that the FEC parameters are set for all codecs. |
| 1595 | } |
| 1596 | |
pbos@webrtc.org | d1ea06b | 2014-07-18 09:35:58 +0000 | [diff] [blame] | 1597 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithoutFecDisablesFec) { |
| 1598 | std::vector<VideoCodec> codecs; |
| 1599 | codecs.push_back(kVp8Codec); |
| 1600 | codecs.push_back(kUlpfecCodec); |
| 1601 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
| 1602 | |
| 1603 | FakeVideoReceiveStream* stream = AddRecvStream(); |
| 1604 | webrtc::VideoReceiveStream::Config config = stream->GetConfig(); |
| 1605 | |
| 1606 | EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type); |
| 1607 | |
| 1608 | codecs.pop_back(); |
| 1609 | ASSERT_TRUE(channel_->SetRecvCodecs(codecs)); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1610 | stream = fake_call_->GetVideoReceiveStreams()[0]; |
pbos@webrtc.org | d1ea06b | 2014-07-18 09:35:58 +0000 | [diff] [blame] | 1611 | ASSERT_TRUE(stream != NULL); |
| 1612 | config = stream->GetConfig(); |
| 1613 | EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type) |
| 1614 | << "SetSendCodec without FEC should disable current FEC."; |
pbos@webrtc.org | 269605c | 2014-06-26 08:49:03 +0000 | [diff] [blame] | 1615 | } |
| 1616 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1617 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) { |
| 1618 | std::vector<VideoCodec> codecs; |
| 1619 | codecs.push_back(kVp8Codec); |
| 1620 | codecs.push_back(kRedCodec); |
| 1621 | codecs[1].id = codecs[0].id; |
| 1622 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)); |
| 1623 | } |
| 1624 | |
| 1625 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectDuplicateCodecPayloads) { |
| 1626 | std::vector<VideoCodec> codecs; |
| 1627 | codecs.push_back(kVp8Codec); |
| 1628 | codecs.push_back(kVp9Codec); |
| 1629 | codecs[1].id = codecs[0].id; |
| 1630 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)); |
| 1631 | } |
| 1632 | |
| 1633 | TEST_F(WebRtcVideoChannel2Test, |
| 1634 | SetRecvCodecsAcceptSameCodecOnMultiplePayloadTypes) { |
| 1635 | std::vector<VideoCodec> codecs; |
| 1636 | codecs.push_back(kVp8Codec); |
| 1637 | codecs.push_back(kVp8Codec); |
| 1638 | codecs[1].id += 1; |
| 1639 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1640 | } |
| 1641 | |
| 1642 | TEST_F(WebRtcVideoChannel2Test, SendStreamNotSendingByDefault) { |
| 1643 | EXPECT_FALSE(AddSendStream()->IsSending()); |
| 1644 | } |
| 1645 | |
pbos@webrtc.org | 85f4294 | 2014-07-22 09:14:58 +0000 | [diff] [blame] | 1646 | TEST_F(WebRtcVideoChannel2Test, ReceiveStreamReceivingByDefault) { |
| 1647 | EXPECT_TRUE(AddRecvStream()->IsReceiving()); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1648 | } |
| 1649 | |
| 1650 | TEST_F(WebRtcVideoChannel2Test, SetSend) { |
pbos@webrtc.org | 5301b0f | 2014-07-17 08:51:46 +0000 | [diff] [blame] | 1651 | FakeVideoSendStream* stream = AddSendStream(); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1652 | EXPECT_FALSE(stream->IsSending()); |
| 1653 | |
| 1654 | // false->true |
| 1655 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1656 | EXPECT_TRUE(stream->IsSending()); |
| 1657 | // true->true |
| 1658 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1659 | EXPECT_TRUE(stream->IsSending()); |
| 1660 | // true->false |
| 1661 | EXPECT_TRUE(channel_->SetSend(false)); |
| 1662 | EXPECT_FALSE(stream->IsSending()); |
| 1663 | // false->false |
| 1664 | EXPECT_TRUE(channel_->SetSend(false)); |
| 1665 | EXPECT_FALSE(stream->IsSending()); |
| 1666 | |
| 1667 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1668 | FakeVideoSendStream* new_stream = AddSendStream(); |
| 1669 | EXPECT_TRUE(new_stream->IsSending()) |
| 1670 | << "Send stream created after SetSend(true) not sending initially."; |
| 1671 | } |
| 1672 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1673 | TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetDscpOptions) { |
| 1674 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1675 | } |
| 1676 | |
| 1677 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithMaxBitrate) { |
| 1678 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1679 | } |
| 1680 | |
| 1681 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithLoweredBitrate) { |
| 1682 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1683 | } |
| 1684 | |
| 1685 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsSucceedsWhenSending) { |
| 1686 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1687 | } |
| 1688 | |
| 1689 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ResetCodecOnScreencast) { |
| 1690 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1691 | } |
| 1692 | |
| 1693 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontResetCodecOnSendFrame) { |
| 1694 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1695 | } |
| 1696 | |
| 1697 | TEST_F(WebRtcVideoChannel2Test, |
| 1698 | DISABLED_DontRegisterDecoderIfFactoryIsNotGiven) { |
| 1699 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1700 | } |
| 1701 | |
| 1702 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RegisterDecoderIfFactoryIsGiven) { |
| 1703 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1704 | } |
| 1705 | |
| 1706 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterDecoderMultipleTimes) { |
| 1707 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1708 | } |
| 1709 | |
| 1710 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterDecoderForNonVP8) { |
| 1711 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1712 | } |
| 1713 | |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1714 | TEST_F(WebRtcVideoChannel2Test, DISABLED_FeedbackParamsForNonVP8) { |
| 1715 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1716 | } |
| 1717 | |
| 1718 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ExternalCodecAddedToTheEnd) { |
| 1719 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1720 | } |
| 1721 | |
| 1722 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ExternalCodecIgnored) { |
| 1723 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1724 | } |
| 1725 | |
| 1726 | TEST_F(WebRtcVideoChannel2Test, DISABLED_UpdateEncoderCodecsAfterSetFactory) { |
| 1727 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1728 | } |
| 1729 | |
pbos@webrtc.org | 26c0c41 | 2014-09-03 16:17:12 +0000 | [diff] [blame] | 1730 | TEST_F(WebRtcVideoChannel2Test, OnReadyToSendSignalsNetworkState) { |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1731 | EXPECT_EQ(webrtc::Call::kNetworkUp, fake_call_->GetNetworkState()); |
pbos@webrtc.org | 26c0c41 | 2014-09-03 16:17:12 +0000 | [diff] [blame] | 1732 | |
| 1733 | channel_->OnReadyToSend(false); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1734 | EXPECT_EQ(webrtc::Call::kNetworkDown, fake_call_->GetNetworkState()); |
pbos@webrtc.org | 26c0c41 | 2014-09-03 16:17:12 +0000 | [diff] [blame] | 1735 | |
| 1736 | channel_->OnReadyToSend(true); |
pbos@webrtc.org | 42684be | 2014-10-03 11:25:45 +0000 | [diff] [blame] | 1737 | EXPECT_EQ(webrtc::Call::kNetworkUp, fake_call_->GetNetworkState()); |
pbos@webrtc.org | b5a22b1 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1738 | } |
| 1739 | |
| 1740 | TEST_F(WebRtcVideoChannel2Test, DISABLED_CaptureFrameTimestampToNtpTimestamp) { |
| 1741 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1742 | } |
| 1743 | } // namespace cricket |