pbos@webrtc.org | 87e1f97 | 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 | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 29 | #include <vector> |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 30 | |
| 31 | #include "talk/base/gunit.h" |
| 32 | #include "talk/media/base/testutils.h" |
| 33 | #include "talk/media/base/videoengine_unittest.h" |
| 34 | #include "talk/media/webrtc/webrtcvideoengine2.h" |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 35 | #include "talk/media/webrtc/webrtcvideoengine2_unittest.h" |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 36 | #include "talk/media/webrtc/webrtcvideochannelfactory.h" |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 37 | |
| 38 | namespace { |
| 39 | static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30, 0); |
| 40 | static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0); |
| 41 | static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30, 0); |
| 42 | static const cricket::VideoCodec kVp8Codec180p(100, "VP8", 320, 180, 30, 0); |
| 43 | |
| 44 | static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 400, 30, 0); |
| 45 | static const cricket::VideoCodec kVp9Codec(101, "VP9", 640, 400, 30, 0); |
| 46 | static const cricket::VideoCodec kRedCodec(116, "red", 0, 0, 0, 0); |
| 47 | static const cricket::VideoCodec kUlpfecCodec(117, "ulpfec", 0, 0, 0, 0); |
| 48 | |
| 49 | static const uint32 kSsrcs1[] = {1}; |
| 50 | static const uint32 kRtxSsrcs1[] = {4}; |
| 51 | } // namespace |
| 52 | |
| 53 | namespace cricket { |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 54 | FakeVideoSendStream::FakeVideoSendStream( |
| 55 | const webrtc::VideoSendStream::Config& config, |
| 56 | const std::vector<webrtc::VideoStream>& video_streams) |
| 57 | : sending_(false), config_(config), video_streams_(video_streams) { |
| 58 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 59 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 60 | webrtc::VideoSendStream::Config FakeVideoSendStream::GetConfig() { |
| 61 | return config_; |
| 62 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 63 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 64 | std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { |
| 65 | return video_streams_; |
| 66 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 67 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 68 | bool FakeVideoSendStream::IsSending() { |
| 69 | return sending_; |
| 70 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 71 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 72 | webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() const { |
| 73 | return webrtc::VideoSendStream::Stats(); |
| 74 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 75 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 76 | bool FakeVideoSendStream::ReconfigureVideoEncoder( |
| 77 | const std::vector<webrtc::VideoStream>& streams, |
| 78 | const void* encoder_specific) { |
| 79 | video_streams_ = streams; |
| 80 | return true; |
| 81 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 82 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 83 | webrtc::VideoSendStreamInput* FakeVideoSendStream::Input() { |
| 84 | // TODO(pbos): Fix. |
| 85 | return NULL; |
| 86 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 87 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 88 | void FakeVideoSendStream::Start() { |
| 89 | sending_ = true; |
| 90 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 91 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 92 | void FakeVideoSendStream::Stop() { |
| 93 | sending_ = false; |
| 94 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 95 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 96 | FakeVideoReceiveStream::FakeVideoReceiveStream( |
| 97 | const webrtc::VideoReceiveStream::Config& config) |
| 98 | : config_(config), receiving_(false) { |
| 99 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 100 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 101 | webrtc::VideoReceiveStream::Config FakeVideoReceiveStream::GetConfig() { |
| 102 | return config_; |
| 103 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 104 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 105 | webrtc::VideoReceiveStream::Stats FakeVideoReceiveStream::GetStats() const { |
| 106 | return webrtc::VideoReceiveStream::Stats(); |
| 107 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 108 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 109 | void FakeVideoReceiveStream::Start() { |
| 110 | receiving_ = true; |
| 111 | } |
| 112 | void FakeVideoReceiveStream::Stop() { |
| 113 | receiving_ = false; |
| 114 | } |
| 115 | void FakeVideoReceiveStream::GetCurrentReceiveCodec(webrtc::VideoCodec* codec) { |
| 116 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 117 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 118 | FakeCall::FakeCall() { SetVideoCodecs(GetDefaultVideoCodecs()); } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 119 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 120 | FakeCall::~FakeCall() { |
| 121 | EXPECT_EQ(0u, video_send_streams_.size()); |
| 122 | EXPECT_EQ(0u, video_receive_streams_.size()); |
| 123 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 124 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 125 | void FakeCall::SetVideoCodecs(const std::vector<webrtc::VideoCodec> codecs) { |
| 126 | codecs_ = codecs; |
| 127 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 128 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 129 | std::vector<FakeVideoSendStream*> FakeCall::GetVideoSendStreams() { |
| 130 | return video_send_streams_; |
| 131 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 132 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 133 | std::vector<FakeVideoReceiveStream*> FakeCall::GetVideoReceiveStreams() { |
| 134 | return video_receive_streams_; |
| 135 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 136 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 137 | webrtc::VideoCodec FakeCall::GetEmptyVideoCodec() { |
| 138 | webrtc::VideoCodec codec; |
| 139 | codec.minBitrate = 300; |
| 140 | codec.startBitrate = 800; |
| 141 | codec.maxBitrate = 1500; |
| 142 | codec.maxFramerate = 10; |
| 143 | codec.width = 640; |
| 144 | codec.height = 480; |
| 145 | codec.qpMax = 56; |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 146 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 147 | return codec; |
| 148 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 149 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 150 | webrtc::VideoCodec FakeCall::GetVideoCodecVp8() { |
| 151 | webrtc::VideoCodec vp8_codec = GetEmptyVideoCodec(); |
| 152 | vp8_codec.codecType = webrtc::kVideoCodecVP8; |
| 153 | strcpy(vp8_codec.plName, kVp8Codec.name.c_str()); |
| 154 | vp8_codec.plType = kVp8Codec.id; |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 155 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 156 | return vp8_codec; |
| 157 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 158 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 159 | webrtc::VideoCodec FakeCall::GetVideoCodecVp9() { |
| 160 | webrtc::VideoCodec vp9_codec = GetEmptyVideoCodec(); |
| 161 | // TODO(pbos): Add a correct codecType when webrtc has one. |
| 162 | vp9_codec.codecType = webrtc::kVideoCodecVP8; |
| 163 | strcpy(vp9_codec.plName, kVp9Codec.name.c_str()); |
| 164 | vp9_codec.plType = kVp9Codec.id; |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 165 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 166 | return vp9_codec; |
| 167 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 168 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 169 | std::vector<webrtc::VideoCodec> FakeCall::GetDefaultVideoCodecs() { |
| 170 | std::vector<webrtc::VideoCodec> codecs; |
| 171 | codecs.push_back(GetVideoCodecVp8()); |
| 172 | // codecs.push_back(GetVideoCodecVp9()); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 173 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 174 | return codecs; |
| 175 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 176 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 177 | webrtc::VideoSendStream::Config FakeCall::GetDefaultSendConfig() { |
| 178 | webrtc::VideoSendStream::Config config; |
| 179 | // TODO(pbos): Encoder settings. |
| 180 | // config.codec = GetVideoCodecVp8(); |
| 181 | return config; |
| 182 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 183 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 184 | webrtc::VideoSendStream* FakeCall::CreateVideoSendStream( |
| 185 | const webrtc::VideoSendStream::Config& config, |
| 186 | const std::vector<webrtc::VideoStream>& video_streams, |
| 187 | const void* encoder_settings) { |
| 188 | FakeVideoSendStream* fake_stream = |
| 189 | new FakeVideoSendStream(config, video_streams); |
| 190 | video_send_streams_.push_back(fake_stream); |
| 191 | return fake_stream; |
| 192 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 193 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 194 | void FakeCall::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { |
| 195 | FakeVideoSendStream* fake_stream = |
| 196 | static_cast<FakeVideoSendStream*>(send_stream); |
| 197 | for (size_t i = 0; i < video_send_streams_.size(); ++i) { |
| 198 | if (video_send_streams_[i] == fake_stream) { |
| 199 | delete video_send_streams_[i]; |
| 200 | video_send_streams_.erase(video_send_streams_.begin() + i); |
| 201 | return; |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 202 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 203 | } |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 204 | ADD_FAILURE() << "DestroyVideoSendStream called with unknown paramter."; |
| 205 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 206 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 207 | webrtc::VideoReceiveStream::Config FakeCall::GetDefaultReceiveConfig() { |
| 208 | return webrtc::VideoReceiveStream::Config(); |
| 209 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 210 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 211 | webrtc::VideoReceiveStream* FakeCall::CreateVideoReceiveStream( |
| 212 | const webrtc::VideoReceiveStream::Config& config) { |
| 213 | video_receive_streams_.push_back(new FakeVideoReceiveStream(config)); |
| 214 | return video_receive_streams_[video_receive_streams_.size() - 1]; |
| 215 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 216 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 217 | void FakeCall::DestroyVideoReceiveStream( |
| 218 | webrtc::VideoReceiveStream* receive_stream) { |
| 219 | FakeVideoReceiveStream* fake_stream = |
| 220 | static_cast<FakeVideoReceiveStream*>(receive_stream); |
| 221 | for (size_t i = 0; i < video_receive_streams_.size(); ++i) { |
| 222 | if (video_receive_streams_[i] == fake_stream) { |
| 223 | delete video_receive_streams_[i]; |
| 224 | video_receive_streams_.erase(video_receive_streams_.begin() + i); |
| 225 | return; |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 226 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 227 | } |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 228 | ADD_FAILURE() << "DestroyVideoReceiveStream called with unknown paramter."; |
| 229 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 230 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 231 | webrtc::PacketReceiver* FakeCall::Receiver() { |
| 232 | // TODO(pbos): Fix this. |
| 233 | return NULL; |
| 234 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 235 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 236 | uint32_t FakeCall::SendBitrateEstimate() { |
| 237 | return 0; |
| 238 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 239 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 240 | uint32_t FakeCall::ReceiveBitrateEstimate() { |
| 241 | return 0; |
| 242 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 243 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 244 | FakeWebRtcVideoChannel2::FakeWebRtcVideoChannel2( |
| 245 | FakeCall* call, |
| 246 | WebRtcVideoEngine2* engine, |
| 247 | VoiceMediaChannel* voice_channel) |
| 248 | : WebRtcVideoChannel2(call, engine, engine->GetVideoEncoderFactory()), |
| 249 | fake_call_(call), |
| 250 | voice_channel_(voice_channel) { |
| 251 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 252 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 253 | FakeWebRtcVideoChannel2::~FakeWebRtcVideoChannel2() { |
| 254 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 255 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 256 | VoiceMediaChannel* FakeWebRtcVideoChannel2::GetVoiceChannel() { |
| 257 | return voice_channel_; |
| 258 | } |
| 259 | FakeCall* FakeWebRtcVideoChannel2::GetFakeCall() { |
| 260 | return fake_call_; |
| 261 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 262 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 263 | FakeWebRtcVideoChannel2* FakeWebRtcVideoMediaChannelFactory::GetFakeChannel( |
| 264 | VideoMediaChannel* channel) { |
| 265 | return channel_map_[channel]; |
| 266 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 267 | |
pbos@webrtc.org | 1ef658d | 2014-06-10 08:53:05 +0000 | [diff] [blame] | 268 | WebRtcVideoChannel2* FakeWebRtcVideoMediaChannelFactory::Create( |
| 269 | WebRtcVideoEngine2* engine, |
| 270 | VoiceMediaChannel* voice_channel) { |
| 271 | FakeWebRtcVideoChannel2* channel = |
| 272 | new FakeWebRtcVideoChannel2(new FakeCall(), engine, voice_channel); |
| 273 | channel_map_[channel] = channel; |
| 274 | return channel; |
| 275 | } |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 276 | |
| 277 | class WebRtcVideoEngine2Test : public testing::Test { |
| 278 | public: |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 279 | WebRtcVideoEngine2Test() : engine_(&factory_) { |
| 280 | std::vector<VideoCodec> engine_codecs = engine_.codecs(); |
| 281 | assert(!engine_codecs.empty()); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 282 | bool codec_set = false; |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 283 | for (size_t i = 0; i < engine_codecs.size(); ++i) { |
| 284 | if (engine_codecs[i].name == "red") { |
| 285 | default_red_codec_ = engine_codecs[i]; |
| 286 | } else if (engine_codecs[i].name == "ulpfec") { |
| 287 | default_ulpfec_codec_ = engine_codecs[i]; |
| 288 | } else if (engine_codecs[i].name == "rtx") { |
| 289 | default_rtx_codec_ = engine_codecs[i]; |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 290 | } else if (!codec_set) { |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 291 | default_codec_ = engine_codecs[i]; |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 292 | codec_set = true; |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | assert(codec_set); |
| 297 | } |
| 298 | |
| 299 | protected: |
| 300 | FakeWebRtcVideoMediaChannelFactory factory_; |
| 301 | WebRtcVideoEngine2 engine_; |
| 302 | VideoCodec default_codec_; |
| 303 | VideoCodec default_red_codec_; |
| 304 | VideoCodec default_ulpfec_codec_; |
| 305 | VideoCodec default_rtx_codec_; |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 306 | }; |
| 307 | |
| 308 | TEST_F(WebRtcVideoEngine2Test, CreateChannel) { |
| 309 | talk_base::scoped_ptr<VideoMediaChannel> channel(engine_.CreateChannel(NULL)); |
| 310 | ASSERT_TRUE(channel.get() != NULL) << "Could not create channel."; |
| 311 | EXPECT_TRUE(factory_.GetFakeChannel(channel.get()) != NULL) |
| 312 | << "Channel not created through factory."; |
| 313 | } |
| 314 | |
| 315 | TEST_F(WebRtcVideoEngine2Test, CreateChannelWithVoiceEngine) { |
| 316 | VoiceMediaChannel* voice_channel = reinterpret_cast<VoiceMediaChannel*>(0x42); |
| 317 | talk_base::scoped_ptr<VideoMediaChannel> channel( |
| 318 | engine_.CreateChannel(voice_channel)); |
| 319 | ASSERT_TRUE(channel.get() != NULL) << "Could not create channel."; |
| 320 | |
| 321 | FakeWebRtcVideoChannel2* fake_channel = |
| 322 | factory_.GetFakeChannel(channel.get()); |
| 323 | ASSERT_TRUE(fake_channel != NULL) << "Channel not created through factory."; |
| 324 | |
| 325 | EXPECT_TRUE(fake_channel->GetVoiceChannel() != NULL) |
| 326 | << "VoiceChannel not set."; |
| 327 | EXPECT_EQ(voice_channel, fake_channel->GetVoiceChannel()) |
| 328 | << "Different VoiceChannel set than the provided one."; |
| 329 | } |
| 330 | |
pbos@webrtc.org | 2352cb3 | 2014-06-13 11:47:28 +0000 | [diff] [blame^] | 331 | TEST_F(WebRtcVideoEngine2Test, FindCodec) { |
| 332 | const std::vector<cricket::VideoCodec>& c = engine_.codecs(); |
| 333 | EXPECT_EQ(4U, c.size()); |
| 334 | |
| 335 | cricket::VideoCodec vp8(104, "VP8", 320, 200, 30, 0); |
| 336 | EXPECT_TRUE(engine_.FindCodec(vp8)); |
| 337 | |
| 338 | cricket::VideoCodec vp8_ci(104, "vp8", 320, 200, 30, 0); |
| 339 | EXPECT_TRUE(engine_.FindCodec(vp8)); |
| 340 | |
| 341 | cricket::VideoCodec vp8_diff_fr_diff_pref(104, "VP8", 320, 200, 50, 50); |
| 342 | EXPECT_TRUE(engine_.FindCodec(vp8_diff_fr_diff_pref)); |
| 343 | |
| 344 | cricket::VideoCodec vp8_diff_id(95, "VP8", 320, 200, 30, 0); |
| 345 | EXPECT_FALSE(engine_.FindCodec(vp8_diff_id)); |
| 346 | vp8_diff_id.id = 97; |
| 347 | EXPECT_TRUE(engine_.FindCodec(vp8_diff_id)); |
| 348 | |
| 349 | cricket::VideoCodec vp8_diff_res(104, "VP8", 320, 111, 30, 0); |
| 350 | EXPECT_FALSE(engine_.FindCodec(vp8_diff_res)); |
| 351 | |
| 352 | // PeerConnection doesn't negotiate the resolution at this point. |
| 353 | // Test that FindCodec can handle the case when width/height is 0. |
| 354 | cricket::VideoCodec vp8_zero_res(104, "VP8", 0, 0, 30, 0); |
| 355 | EXPECT_TRUE(engine_.FindCodec(vp8_zero_res)); |
| 356 | |
| 357 | cricket::VideoCodec red(101, "RED", 0, 0, 30, 0); |
| 358 | EXPECT_TRUE(engine_.FindCodec(red)); |
| 359 | |
| 360 | cricket::VideoCodec red_ci(101, "red", 0, 0, 30, 0); |
| 361 | EXPECT_TRUE(engine_.FindCodec(red)); |
| 362 | |
| 363 | cricket::VideoCodec fec(102, "ULPFEC", 0, 0, 30, 0); |
| 364 | EXPECT_TRUE(engine_.FindCodec(fec)); |
| 365 | |
| 366 | cricket::VideoCodec fec_ci(102, "ulpfec", 0, 0, 30, 0); |
| 367 | EXPECT_TRUE(engine_.FindCodec(fec)); |
| 368 | |
| 369 | cricket::VideoCodec rtx(96, "rtx", 0, 0, 30, 0); |
| 370 | EXPECT_TRUE(engine_.FindCodec(rtx)); |
| 371 | } |
| 372 | |
| 373 | TEST_F(WebRtcVideoEngine2Test, DefaultRtxCodecHasAssociatedPayloadTypeSet) { |
| 374 | std::vector<VideoCodec> engine_codecs = engine_.codecs(); |
| 375 | for (size_t i = 0; i < engine_codecs.size(); ++i) { |
| 376 | if (engine_codecs[i].name != kRtxCodecName) |
| 377 | continue; |
| 378 | int associated_payload_type; |
| 379 | EXPECT_TRUE(engine_codecs[i].GetParam(kCodecParamAssociatedPayloadType, |
| 380 | &associated_payload_type)); |
| 381 | EXPECT_EQ(default_codec_.id, associated_payload_type); |
| 382 | return; |
| 383 | } |
| 384 | FAIL() << "No RTX codec found among default codecs."; |
| 385 | } |
| 386 | |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 387 | class WebRtcVideoChannel2BaseTest |
| 388 | : public VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> { |
| 389 | protected: |
| 390 | virtual cricket::VideoCodec DefaultCodec() OVERRIDE { return kVp8Codec; } |
| 391 | typedef VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> Base; |
| 392 | }; |
| 393 | |
| 394 | // TODO(pbos): Fix WebRtcVideoEngine2BaseTest, where we want CheckCoInitialize. |
| 395 | #if 0 |
| 396 | // TODO(juberti): Figure out why ViE is munging the COM refcount. |
| 397 | #ifdef WIN32 |
| 398 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_CheckCoInitialize) { |
| 399 | Base::CheckCoInitialize(); |
| 400 | } |
| 401 | #endif |
| 402 | #endif |
| 403 | |
| 404 | TEST_F(WebRtcVideoChannel2BaseTest, SetSend) { Base::SetSend(); } |
| 405 | |
| 406 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendWithoutCodecs) { |
| 407 | Base::SetSendWithoutCodecs(); |
| 408 | } |
| 409 | |
| 410 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendSetsTransportBufferSizes) { |
| 411 | Base::SetSendSetsTransportBufferSizes(); |
| 412 | } |
| 413 | |
| 414 | // TODO(juberti): Fix this test to tolerate missing stats. |
| 415 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStats) { Base::GetStats(); } |
| 416 | |
| 417 | // TODO(juberti): Fix this test to tolerate missing stats. |
| 418 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStatsMultipleRecvStreams) { |
| 419 | Base::GetStatsMultipleRecvStreams(); |
| 420 | } |
| 421 | |
| 422 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStatsMultipleSendStreams) { |
| 423 | Base::GetStatsMultipleSendStreams(); |
| 424 | } |
| 425 | |
| 426 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendBandwidth) { |
| 427 | Base::SetSendBandwidth(); |
| 428 | } |
| 429 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendSsrc) { Base::SetSendSsrc(); } |
| 430 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendSsrcAfterSetCodecs) { |
| 431 | Base::SetSendSsrcAfterSetCodecs(); |
| 432 | } |
| 433 | |
| 434 | TEST_F(WebRtcVideoChannel2BaseTest, SetRenderer) { Base::SetRenderer(); } |
| 435 | |
| 436 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveRecvStreams) { |
| 437 | Base::AddRemoveRecvStreams(); |
| 438 | } |
| 439 | |
| 440 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AddRemoveRecvStreamAndRender) { |
| 441 | Base::AddRemoveRecvStreamAndRender(); |
| 442 | } |
| 443 | |
| 444 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveRecvStreamsNoConference) { |
| 445 | Base::AddRemoveRecvStreamsNoConference(); |
| 446 | } |
| 447 | |
| 448 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveSendStreams) { |
| 449 | Base::AddRemoveSendStreams(); |
| 450 | } |
| 451 | |
| 452 | TEST_F(WebRtcVideoChannel2BaseTest, SimulateConference) { |
| 453 | Base::SimulateConference(); |
| 454 | } |
| 455 | |
| 456 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveCapturer) { |
| 457 | Base::AddRemoveCapturer(); |
| 458 | } |
| 459 | |
| 460 | TEST_F(WebRtcVideoChannel2BaseTest, RemoveCapturerWithoutAdd) { |
| 461 | Base::RemoveCapturerWithoutAdd(); |
| 462 | } |
| 463 | |
| 464 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveCapturerMultipleSources) { |
| 465 | Base::AddRemoveCapturerMultipleSources(); |
| 466 | } |
| 467 | |
| 468 | // TODO(pbos): Figure out why this fails so often. |
| 469 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_HighAspectHighHeightCapturer) { |
| 470 | Base::HighAspectHighHeightCapturer(); |
| 471 | } |
| 472 | |
| 473 | TEST_F(WebRtcVideoChannel2BaseTest, RejectEmptyStreamParams) { |
| 474 | Base::RejectEmptyStreamParams(); |
| 475 | } |
| 476 | |
| 477 | TEST_F(WebRtcVideoChannel2BaseTest, AdaptResolution16x10) { |
| 478 | Base::AdaptResolution16x10(); |
| 479 | } |
| 480 | |
| 481 | TEST_F(WebRtcVideoChannel2BaseTest, AdaptResolution4x3) { |
| 482 | Base::AdaptResolution4x3(); |
| 483 | } |
| 484 | |
| 485 | TEST_F(WebRtcVideoChannel2BaseTest, MuteStream) { Base::MuteStream(); } |
| 486 | |
| 487 | TEST_F(WebRtcVideoChannel2BaseTest, MultipleSendStreams) { |
| 488 | Base::MultipleSendStreams(); |
| 489 | } |
| 490 | |
| 491 | // TODO(juberti): Restore this test once we support sending 0 fps. |
| 492 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AdaptDropAllFrames) { |
| 493 | Base::AdaptDropAllFrames(); |
| 494 | } |
| 495 | // TODO(juberti): Understand why we get decode errors on this test. |
| 496 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AdaptFramerate) { |
| 497 | Base::AdaptFramerate(); |
| 498 | } |
| 499 | |
| 500 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendStreamFormat0x0) { |
| 501 | Base::SetSendStreamFormat0x0(); |
| 502 | } |
| 503 | |
| 504 | // TODO(zhurunz): Fix the flakey test. |
| 505 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_SetSendStreamFormat) { |
| 506 | Base::SetSendStreamFormat(); |
| 507 | } |
| 508 | |
| 509 | TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsSendAndReceive) { |
| 510 | Base::TwoStreamsSendAndReceive(kVp8Codec); |
| 511 | } |
| 512 | |
| 513 | TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsReUseFirstStream) { |
| 514 | Base::TwoStreamsReUseFirstStream(kVp8Codec); |
| 515 | } |
| 516 | |
| 517 | class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { |
| 518 | public: |
| 519 | virtual void SetUp() OVERRIDE { |
| 520 | channel_.reset(engine_.CreateChannel(NULL)); |
| 521 | fake_channel_ = factory_.GetFakeChannel(channel_.get()); |
| 522 | last_ssrc_ = 123; |
| 523 | ASSERT_TRUE(fake_channel_ != NULL) |
| 524 | << "Channel not created through factory."; |
| 525 | } |
| 526 | |
| 527 | protected: |
| 528 | FakeVideoSendStream* AddSendStream() { |
| 529 | return AddSendStream(StreamParams::CreateLegacy(last_ssrc_++)); |
| 530 | } |
| 531 | |
| 532 | FakeVideoSendStream* AddSendStream(const StreamParams& sp) { |
| 533 | size_t num_streams = |
| 534 | fake_channel_->GetFakeCall()->GetVideoSendStreams().size(); |
| 535 | EXPECT_TRUE(channel_->AddSendStream(sp)); |
| 536 | std::vector<FakeVideoSendStream*> streams = |
| 537 | fake_channel_->GetFakeCall()->GetVideoSendStreams(); |
| 538 | EXPECT_EQ(num_streams + 1, streams.size()); |
| 539 | return streams[streams.size() - 1]; |
| 540 | } |
| 541 | |
| 542 | std::vector<FakeVideoSendStream*> GetFakeSendStreams() { |
| 543 | return fake_channel_->GetFakeCall()->GetVideoSendStreams(); |
| 544 | } |
| 545 | |
| 546 | FakeVideoReceiveStream* AddRecvStream() { |
| 547 | return AddRecvStream(StreamParams::CreateLegacy(last_ssrc_++)); |
| 548 | } |
| 549 | |
| 550 | FakeVideoReceiveStream* AddRecvStream(const StreamParams& sp) { |
| 551 | size_t num_streams = |
| 552 | fake_channel_->GetFakeCall()->GetVideoReceiveStreams().size(); |
| 553 | EXPECT_TRUE(channel_->AddRecvStream(sp)); |
| 554 | std::vector<FakeVideoReceiveStream*> streams = |
| 555 | fake_channel_->GetFakeCall()->GetVideoReceiveStreams(); |
| 556 | EXPECT_EQ(num_streams + 1, streams.size()); |
| 557 | return streams[streams.size() - 1]; |
| 558 | } |
| 559 | |
| 560 | void SetSendCodecsShouldWorkForBitrates(const char* min_bitrate, |
| 561 | const char* max_bitrate) { |
| 562 | std::vector<VideoCodec> codecs; |
| 563 | codecs.push_back(kVp8Codec); |
| 564 | codecs[0].params[kCodecParamMinBitrate] = min_bitrate; |
| 565 | codecs[0].params[kCodecParamMaxBitrate] = max_bitrate; |
| 566 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)); |
| 567 | |
| 568 | FakeVideoSendStream* stream = AddSendStream(); |
| 569 | |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 570 | std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams(); |
| 571 | ASSERT_EQ(1u, video_streams.size()); |
| 572 | EXPECT_EQ(atoi(min_bitrate), video_streams.back().min_bitrate_bps / 1000); |
| 573 | EXPECT_EQ(atoi(max_bitrate), video_streams.back().max_bitrate_bps / 1000); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 574 | |
| 575 | VideoCodec codec; |
| 576 | EXPECT_TRUE(channel_->GetSendCodec(&codec)); |
| 577 | EXPECT_EQ(min_bitrate, codec.params[kCodecParamMinBitrate]); |
| 578 | EXPECT_EQ(max_bitrate, codec.params[kCodecParamMaxBitrate]); |
| 579 | } |
| 580 | |
| 581 | void ExpectEqualCodecs(const VideoCodec video_codec, |
| 582 | const webrtc::VideoCodec& webrtc_codec) { |
| 583 | EXPECT_STREQ(video_codec.name.c_str(), webrtc_codec.plName); |
| 584 | EXPECT_EQ(video_codec.id, webrtc_codec.plType); |
| 585 | EXPECT_EQ(video_codec.width, webrtc_codec.width); |
| 586 | EXPECT_EQ(video_codec.height, webrtc_codec.height); |
| 587 | EXPECT_EQ(video_codec.framerate, webrtc_codec.maxFramerate); |
| 588 | } |
| 589 | talk_base::scoped_ptr<VideoMediaChannel> channel_; |
| 590 | FakeWebRtcVideoChannel2* fake_channel_; |
| 591 | uint32 last_ssrc_; |
| 592 | }; |
| 593 | |
| 594 | TEST_F(WebRtcVideoChannel2Test, DISABLED_MaxBitrateResetsWithConferenceMode) { |
| 595 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 596 | } |
| 597 | |
| 598 | TEST_F(WebRtcVideoChannel2Test, DISABLED_StartSendBitrate) { |
| 599 | // TODO(pbos): Is this test testing vie_ ? this is confusing. No API to set |
| 600 | // start send bitrate from outside? Add defaults here that should be kept? |
| 601 | std::vector<cricket::VideoCodec> codec_list; |
| 602 | codec_list.push_back(kVp8Codec); |
| 603 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 604 | const unsigned int kVideoMinSendBitrateKbps = 50; |
| 605 | const unsigned int kVideoTargetSendBitrateKbps = 300; |
| 606 | const unsigned int kVideoMaxSendBitrateKbps = 2000; |
| 607 | FakeVideoSendStream* stream = AddSendStream(); |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 608 | std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams(); |
| 609 | ASSERT_EQ(1u, video_streams.size()); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 610 | EXPECT_EQ(kVideoMinSendBitrateKbps, |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 611 | video_streams.back().min_bitrate_bps / 1000); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 612 | EXPECT_EQ(kVideoTargetSendBitrateKbps, |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 613 | video_streams.back().target_bitrate_bps / 1000); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 614 | EXPECT_EQ(kVideoMaxSendBitrateKbps, |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 615 | video_streams.back().max_bitrate_bps / 1000); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 616 | #if 0 |
| 617 | // TODO(pbos): un-#if |
| 618 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 619 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 620 | kVideoDefaultStartSendBitrateKbps); |
| 621 | EXPECT_EQ(0, vie_.StartSend(send_channel)); |
| 622 | |
| 623 | // Increase the send bitrate and verify it is used as start bitrate. |
| 624 | const unsigned int kVideoSendBitrateBps = 768000; |
| 625 | vie_.SetSendBitrates(send_channel, kVideoSendBitrateBps, 0, 0); |
| 626 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 627 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 628 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 629 | kVideoSendBitrateBps / 1000); |
| 630 | |
| 631 | // Never set a start bitrate higher than the max bitrate. |
| 632 | vie_.SetSendBitrates(send_channel, kVideoMaxSendBitrateKbps + 500, 0, 0); |
| 633 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 634 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 635 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 636 | kVideoDefaultStartSendBitrateKbps); |
| 637 | |
| 638 | // Use the default start bitrate if the send bitrate is lower. |
| 639 | vie_.SetSendBitrates(send_channel, kVideoDefaultStartSendBitrateKbps - 50, 0, |
| 640 | 0); |
| 641 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 642 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 643 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 644 | kVideoDefaultStartSendBitrateKbps); |
| 645 | #endif |
| 646 | } |
| 647 | |
| 648 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RtcpEnabled) { |
| 649 | // Note(pbos): This is a receiver-side setting, dumbo. |
| 650 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 651 | } |
| 652 | |
| 653 | TEST_F(WebRtcVideoChannel2Test, DISABLED_KeyFrameRequestEnabled) { |
| 654 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 655 | } |
| 656 | |
| 657 | TEST_F(WebRtcVideoChannel2Test, RembIsEnabledByDefault) { |
| 658 | FakeVideoReceiveStream* stream = AddRecvStream(); |
| 659 | EXPECT_TRUE(stream->GetConfig().rtp.remb); |
| 660 | } |
| 661 | |
| 662 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RembEnabledOnReceiveChannels) { |
| 663 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 664 | } |
| 665 | |
pbos@webrtc.org | 2352cb3 | 2014-06-13 11:47:28 +0000 | [diff] [blame^] | 666 | TEST_F(WebRtcVideoChannel2Test, RecvStreamWithSimAndRtx) { |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 667 | EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
| 668 | EXPECT_TRUE(channel_->SetSend(true)); |
| 669 | cricket::VideoOptions options; |
| 670 | options.conference_mode.Set(true); |
| 671 | EXPECT_TRUE(channel_->SetOptions(options)); |
| 672 | |
| 673 | // Send side. |
| 674 | const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); |
| 675 | const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
| 676 | FakeVideoSendStream* send_stream = AddSendStream( |
| 677 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 678 | |
| 679 | ASSERT_EQ(rtx_ssrcs.size(), send_stream->GetConfig().rtp.rtx.ssrcs.size()); |
| 680 | for (size_t i = 0; i < rtx_ssrcs.size(); ++i) |
| 681 | EXPECT_EQ(rtx_ssrcs[i], send_stream->GetConfig().rtp.rtx.ssrcs[i]); |
| 682 | |
| 683 | // Receiver side. |
| 684 | FakeVideoReceiveStream* recv_stream = AddRecvStream( |
| 685 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 686 | ASSERT_GT(recv_stream->GetConfig().rtp.rtx.size(), 0u) |
| 687 | << "No SSRCs for RTX configured by AddRecvStream."; |
| 688 | ASSERT_EQ(1u, recv_stream->GetConfig().rtp.rtx.size()) |
| 689 | << "This test only works with one receive codec. Please update the test."; |
| 690 | EXPECT_EQ(rtx_ssrcs[0], |
| 691 | recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc); |
| 692 | // TODO(pbos): Make sure we set the RTX for correct payloads etc. |
| 693 | } |
| 694 | |
pbos@webrtc.org | 2352cb3 | 2014-06-13 11:47:28 +0000 | [diff] [blame^] | 695 | TEST_F(WebRtcVideoChannel2Test, RecvStreamWithRtx) { |
| 696 | // Setup one channel with an associated RTX stream. |
| 697 | cricket::StreamParams params = |
| 698 | cricket::StreamParams::CreateLegacy(kSsrcs1[0]); |
| 699 | params.AddFidSsrc(kSsrcs1[0], kRtxSsrcs1[0]); |
| 700 | FakeVideoReceiveStream* recv_stream = AddRecvStream(params); |
| 701 | ASSERT_EQ(1u, recv_stream->GetConfig().rtp.rtx.size()); |
| 702 | EXPECT_EQ(kRtxSsrcs1[0], |
| 703 | recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 704 | } |
| 705 | |
pbos@webrtc.org | 2352cb3 | 2014-06-13 11:47:28 +0000 | [diff] [blame^] | 706 | TEST_F(WebRtcVideoChannel2Test, RecvStreamNoRtx) { |
| 707 | // Setup one channel without an associated RTX stream. |
| 708 | cricket::StreamParams params = |
| 709 | cricket::StreamParams::CreateLegacy(kSsrcs1[0]); |
| 710 | FakeVideoReceiveStream* recv_stream = AddRecvStream(params); |
| 711 | ASSERT_TRUE(recv_stream->GetConfig().rtp.rtx.empty()); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 712 | } |
| 713 | |
| 714 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RtpTimestampOffsetHeaderExtensions) { |
| 715 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 716 | } |
| 717 | |
| 718 | TEST_F(WebRtcVideoChannel2Test, DISABLED_AbsoluteSendTimeHeaderExtensions) { |
| 719 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 720 | } |
| 721 | |
| 722 | TEST_F(WebRtcVideoChannel2Test, DISABLED_LeakyBucketTest) { |
| 723 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 724 | } |
| 725 | |
| 726 | TEST_F(WebRtcVideoChannel2Test, DISABLED_BufferedModeLatency) { |
| 727 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 728 | } |
| 729 | |
| 730 | TEST_F(WebRtcVideoChannel2Test, DISABLED_AdditiveVideoOptions) { |
| 731 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 732 | } |
| 733 | |
| 734 | TEST_F(WebRtcVideoChannel2Test, AddRecvStreamOnlyUsesOneReceiveStream) { |
| 735 | EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); |
| 736 | EXPECT_EQ(1u, fake_channel_->GetFakeCall()->GetVideoReceiveStreams().size()); |
| 737 | } |
| 738 | |
| 739 | TEST_F(WebRtcVideoChannel2Test, DISABLED_NoRembChangeAfterAddRecvStream) { |
| 740 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 741 | } |
| 742 | |
| 743 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RembOnOff) { |
| 744 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 745 | } |
| 746 | |
pbos@webrtc.org | 84f5e34 | 2014-05-30 07:35:47 +0000 | [diff] [blame] | 747 | TEST_F(WebRtcVideoChannel2Test, NackIsEnabled) { |
| 748 | EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
| 749 | EXPECT_TRUE(channel_->SetSend(true)); |
| 750 | |
| 751 | // Send side. |
| 752 | FakeVideoSendStream* send_stream = |
| 753 | AddSendStream(cricket::StreamParams::CreateLegacy(1)); |
| 754 | EXPECT_GT(send_stream->GetConfig().rtp.nack.rtp_history_ms, 0); |
| 755 | |
| 756 | // Receiver side. |
| 757 | FakeVideoReceiveStream* recv_stream = |
| 758 | AddRecvStream(cricket::StreamParams::CreateLegacy(1)); |
| 759 | EXPECT_GT(recv_stream->GetConfig().rtp.nack.rtp_history_ms, 0); |
| 760 | |
| 761 | // Nack history size should match between sender and receiver. |
| 762 | EXPECT_EQ(send_stream->GetConfig().rtp.nack.rtp_history_ms, |
| 763 | recv_stream->GetConfig().rtp.nack.rtp_history_ms); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 764 | } |
| 765 | |
| 766 | TEST_F(WebRtcVideoChannel2Test, DISABLED_VideoProtectionInterop) { |
| 767 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 768 | } |
| 769 | |
| 770 | TEST_F(WebRtcVideoChannel2Test, DISABLED_VideoProtectionInteropReversed) { |
| 771 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 772 | } |
| 773 | |
| 774 | TEST_F(WebRtcVideoChannel2Test, DISABLED_HybridNackFecConference) { |
| 775 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 776 | } |
| 777 | |
| 778 | TEST_F(WebRtcVideoChannel2Test, DISABLED_AddRemoveRecvStreamConference) { |
| 779 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 780 | } |
| 781 | |
| 782 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetRender) { |
| 783 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 784 | } |
| 785 | |
| 786 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthAuto) { |
| 787 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 788 | } |
| 789 | |
| 790 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthAutoCapped) { |
| 791 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 792 | } |
| 793 | |
| 794 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthFixed) { |
| 795 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 796 | } |
| 797 | |
| 798 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthInConference) { |
| 799 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 800 | } |
| 801 | |
| 802 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthScreencast) { |
| 803 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 804 | } |
| 805 | |
| 806 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetSendSsrcAndCname) { |
| 807 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 808 | } |
| 809 | |
| 810 | TEST_F(WebRtcVideoChannel2Test, |
| 811 | DISABLED_SetSendSsrcAfterCreatingReceiveChannel) { |
| 812 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 813 | } |
| 814 | |
| 815 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithDenoising) { |
| 816 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 817 | } |
| 818 | |
| 819 | TEST_F(WebRtcVideoChannel2Test, DISABLED_MultipleSendStreamsWithOneCapturer) { |
| 820 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 821 | } |
| 822 | |
| 823 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DISABLED_SendReceiveBitratesStats) { |
| 824 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 825 | } |
| 826 | |
| 827 | TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetAdaptInputToCpuUsage) { |
| 828 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 829 | } |
| 830 | |
| 831 | TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetCpuThreshold) { |
| 832 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 833 | } |
| 834 | |
| 835 | TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetInvalidCpuThreshold) { |
| 836 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 837 | } |
| 838 | |
| 839 | TEST_F(WebRtcVideoChannel2Test, DISABLED_WebRtcShouldLog) { |
| 840 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 841 | } |
| 842 | |
| 843 | TEST_F(WebRtcVideoChannel2Test, DISABLED_WebRtcShouldNotLog) { |
| 844 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 845 | } |
| 846 | |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 847 | TEST_F(WebRtcVideoChannel2Test, SetDefaultSendCodecs) { |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 848 | ASSERT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 849 | |
| 850 | VideoCodec codec; |
| 851 | EXPECT_TRUE(channel_->GetSendCodec(&codec)); |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 852 | EXPECT_TRUE(codec.Matches(engine_.codecs()[0])); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 853 | |
| 854 | // Using a RTX setup to verify that the default RTX payload type is good. |
| 855 | const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); |
| 856 | const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
| 857 | FakeVideoSendStream* stream = AddSendStream( |
| 858 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 859 | webrtc::VideoSendStream::Config config = stream->GetConfig(); |
| 860 | // TODO(pbos): Replace ExpectEqualCodecs. |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 861 | // ExpectEqualCodecs(engine_.codecs()[0], config.codec); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 862 | |
| 863 | // Make sure NACK and FEC are enabled on the correct payload types. |
| 864 | EXPECT_EQ(1000, config.rtp.nack.rtp_history_ms); |
| 865 | EXPECT_EQ(default_ulpfec_codec_.id, config.rtp.fec.ulpfec_payload_type); |
| 866 | EXPECT_EQ(default_red_codec_.id, config.rtp.fec.red_payload_type); |
| 867 | // TODO(pbos): Verify that the rtx ssrc is set, correct, not taken by anything |
| 868 | // else. |
| 869 | // ASSERT_EQ(1u, config.rtp.rtx.ssrcs.size()); |
| 870 | EXPECT_EQ(static_cast<int>(default_rtx_codec_.id), |
| 871 | config.rtp.rtx.payload_type); |
| 872 | // TODO(juberti): Check RTCP, PLI, TMMBR. |
| 873 | } |
| 874 | |
| 875 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) { |
| 876 | std::vector<VideoCodec> codecs; |
| 877 | codecs.push_back(kVp8Codec); |
| 878 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
| 879 | |
| 880 | FakeVideoSendStream* stream = AddSendStream(); |
| 881 | webrtc::VideoSendStream::Config config = stream->GetConfig(); |
| 882 | |
| 883 | EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type); |
| 884 | EXPECT_EQ(-1, config.rtp.fec.red_payload_type); |
| 885 | } |
| 886 | |
| 887 | TEST_F(WebRtcVideoChannel2Test, |
| 888 | DISABLED_SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { |
| 889 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 890 | } |
| 891 | |
| 892 | TEST_F(WebRtcVideoChannel2Test, |
| 893 | DISABLED_SetSendCodecRejectsRtxWithoutMatchingVideoCodec) { |
| 894 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 895 | } |
| 896 | |
| 897 | TEST_F(WebRtcVideoChannel2Test, |
| 898 | DISABLED_SetCodecsWithoutFecDisablesCurrentFec) { |
| 899 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 900 | } |
| 901 | |
| 902 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetSendCodecsChangesExistingStreams) { |
| 903 | FAIL(); // TODO(pbos): Implement, make sure that it's changing running |
| 904 | // streams. Should it? |
| 905 | } |
| 906 | |
| 907 | TEST_F(WebRtcVideoChannel2Test, |
| 908 | DISABLED_ConstrainsSetCodecsAccordingToEncoderConfig) { |
| 909 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 910 | } |
| 911 | |
| 912 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMinMaxBitrate) { |
| 913 | SetSendCodecsShouldWorkForBitrates("10", "20"); |
| 914 | } |
| 915 | |
| 916 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectsMaxLessThanMinBitrate) { |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame] | 917 | std::vector<VideoCodec> video_codecs = engine_.codecs(); |
| 918 | video_codecs[0].params[kCodecParamMinBitrate] = "30"; |
| 919 | video_codecs[0].params[kCodecParamMaxBitrate] = "20"; |
| 920 | EXPECT_FALSE(channel_->SetSendCodecs(video_codecs)); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 921 | } |
| 922 | |
| 923 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptLargeMinMaxBitrate) { |
| 924 | SetSendCodecsShouldWorkForBitrates("1000", "2000"); |
| 925 | } |
| 926 | |
| 927 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) { |
| 928 | static const char* kMaxQuantization = "21"; |
| 929 | std::vector<VideoCodec> codecs; |
| 930 | codecs.push_back(kVp8Codec); |
| 931 | codecs[0].params[kCodecParamMaxQuantization] = kMaxQuantization; |
| 932 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)); |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 933 | EXPECT_EQ(static_cast<unsigned int>(atoi(kMaxQuantization)), |
| 934 | AddSendStream()->GetVideoStreams().back().max_qp); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 935 | |
| 936 | VideoCodec codec; |
| 937 | EXPECT_TRUE(channel_->GetSendCodec(&codec)); |
| 938 | EXPECT_EQ(kMaxQuantization, codec.params[kCodecParamMaxQuantization]); |
| 939 | } |
| 940 | |
| 941 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectBadDimensions) { |
| 942 | std::vector<cricket::VideoCodec> codecs; |
| 943 | codecs.push_back(kVp8Codec); |
| 944 | |
| 945 | codecs[0].width = 0; |
| 946 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 947 | << "Codec set though codec width is zero."; |
| 948 | |
| 949 | codecs[0].width = kVp8Codec.width; |
| 950 | codecs[0].height = 0; |
| 951 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 952 | << "Codec set though codec height is zero."; |
| 953 | } |
| 954 | |
| 955 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectBadPayloadTypes) { |
| 956 | // TODO(pbos): Should we only allow the dynamic range? |
| 957 | static const size_t kNumIncorrectPayloads = 4; |
| 958 | static const int kIncorrectPayloads[kNumIncorrectPayloads] = {-2, -1, 128, |
| 959 | 129}; |
| 960 | std::vector<cricket::VideoCodec> codecs; |
| 961 | codecs.push_back(kVp8Codec); |
| 962 | for (size_t i = 0; i < kNumIncorrectPayloads; ++i) { |
| 963 | int payload_type = kIncorrectPayloads[i]; |
| 964 | codecs[0].id = payload_type; |
| 965 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 966 | << "Bad payload type '" << payload_type << "' accepted."; |
| 967 | } |
| 968 | } |
| 969 | |
| 970 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptAllValidPayloadTypes) { |
| 971 | std::vector<cricket::VideoCodec> codecs; |
| 972 | codecs.push_back(kVp8Codec); |
| 973 | for (int payload_type = 0; payload_type <= 127; ++payload_type) { |
| 974 | codecs[0].id = payload_type; |
| 975 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)) |
| 976 | << "Payload type '" << payload_type << "' rejected."; |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ResetVieSendCodecOnNewFrameSize) { |
| 981 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 982 | } |
| 983 | |
| 984 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithOnlyVp8) { |
| 985 | std::vector<cricket::VideoCodec> codecs; |
| 986 | codecs.push_back(kVp8Codec); |
| 987 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 988 | } |
| 989 | |
pbos@webrtc.org | 2352cb3 | 2014-06-13 11:47:28 +0000 | [diff] [blame^] | 990 | // Test that we set our inbound RTX codecs properly. |
| 991 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithRtx) { |
| 992 | std::vector<cricket::VideoCodec> codecs; |
| 993 | codecs.push_back(kVp8Codec); |
| 994 | cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0); |
| 995 | codecs.push_back(rtx_codec); |
| 996 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)) |
| 997 | << "RTX codec without associated payload should be rejected."; |
| 998 | |
| 999 | codecs[1].SetParam("apt", kVp8Codec.id + 1); |
| 1000 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)) |
| 1001 | << "RTX codec with invalid associated payload type should be rejected."; |
| 1002 | |
| 1003 | codecs[1].SetParam("apt", kVp8Codec.id); |
| 1004 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1005 | |
| 1006 | cricket::VideoCodec rtx_codec2(97, "rtx", 0, 0, 0, 0); |
| 1007 | rtx_codec2.SetParam("apt", rtx_codec.id); |
| 1008 | codecs.push_back(rtx_codec2); |
| 1009 | |
| 1010 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)) << "RTX codec with another RTX " |
| 1011 | "as associated payload type " |
| 1012 | "should be rejected."; |
| 1013 | } |
| 1014 | |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 1015 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsDifferentPayloadType) { |
| 1016 | std::vector<cricket::VideoCodec> codecs; |
| 1017 | codecs.push_back(kVp8Codec); |
| 1018 | codecs[0].id = 99; |
| 1019 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1020 | } |
| 1021 | |
| 1022 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetRecvCodecsAcceptDefaultCodecs) { |
| 1023 | EXPECT_TRUE(channel_->SetRecvCodecs(engine_.codecs())); |
| 1024 | // (I've added this one.) Make sure they propagate down to VideoReceiveStream! |
| 1025 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1026 | } |
| 1027 | |
| 1028 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) { |
| 1029 | std::vector<VideoCodec> codecs; |
| 1030 | codecs.push_back(kVp8Codec); |
| 1031 | codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30, 0)); |
| 1032 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)); |
| 1033 | } |
| 1034 | |
| 1035 | // TODO(pbos): Enable VP9 through external codec support |
| 1036 | TEST_F(WebRtcVideoChannel2Test, |
| 1037 | DISABLED_SetRecvCodecsAcceptsMultipleVideoCodecs) { |
| 1038 | std::vector<VideoCodec> codecs; |
| 1039 | codecs.push_back(kVp8Codec); |
| 1040 | codecs.push_back(kVp9Codec); |
| 1041 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1042 | } |
| 1043 | |
| 1044 | TEST_F(WebRtcVideoChannel2Test, |
| 1045 | DISABLED_SetRecvCodecsSetsFecForAllVideoCodecs) { |
| 1046 | std::vector<VideoCodec> codecs; |
| 1047 | codecs.push_back(kVp8Codec); |
| 1048 | codecs.push_back(kVp9Codec); |
| 1049 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1050 | FAIL(); // TODO(pbos): Verify that the FEC parameters are set for all codecs. |
| 1051 | } |
| 1052 | |
| 1053 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) { |
| 1054 | std::vector<VideoCodec> codecs; |
| 1055 | codecs.push_back(kVp8Codec); |
| 1056 | codecs.push_back(kRedCodec); |
| 1057 | codecs[1].id = codecs[0].id; |
| 1058 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)); |
| 1059 | } |
| 1060 | |
| 1061 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectDuplicateCodecPayloads) { |
| 1062 | std::vector<VideoCodec> codecs; |
| 1063 | codecs.push_back(kVp8Codec); |
| 1064 | codecs.push_back(kVp9Codec); |
| 1065 | codecs[1].id = codecs[0].id; |
| 1066 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)); |
| 1067 | } |
| 1068 | |
| 1069 | TEST_F(WebRtcVideoChannel2Test, |
| 1070 | SetRecvCodecsAcceptSameCodecOnMultiplePayloadTypes) { |
| 1071 | std::vector<VideoCodec> codecs; |
| 1072 | codecs.push_back(kVp8Codec); |
| 1073 | codecs.push_back(kVp8Codec); |
| 1074 | codecs[1].id += 1; |
| 1075 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1076 | } |
| 1077 | |
| 1078 | TEST_F(WebRtcVideoChannel2Test, SendStreamNotSendingByDefault) { |
| 1079 | EXPECT_FALSE(AddSendStream()->IsSending()); |
| 1080 | } |
| 1081 | |
| 1082 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ReceiveStreamReceivingByDefault) { |
| 1083 | // Is this test correct though? Auto-receive? Enable receive on first packet? |
| 1084 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1085 | } |
| 1086 | |
| 1087 | TEST_F(WebRtcVideoChannel2Test, SetSend) { |
| 1088 | AddSendStream(); |
| 1089 | EXPECT_FALSE(channel_->SetSend(true)) |
| 1090 | << "Channel should not start without codecs."; |
| 1091 | EXPECT_TRUE(channel_->SetSend(false)) |
| 1092 | << "Channel should be stoppable even without set codecs."; |
| 1093 | |
| 1094 | std::vector<cricket::VideoCodec> codecs; |
| 1095 | codecs.push_back(kVp8Codec); |
| 1096 | channel_->SetSendCodecs(codecs); |
| 1097 | std::vector<FakeVideoSendStream*> streams = GetFakeSendStreams(); |
| 1098 | ASSERT_EQ(1u, streams.size()); |
| 1099 | FakeVideoSendStream* stream = streams.back(); |
| 1100 | |
| 1101 | EXPECT_FALSE(stream->IsSending()); |
| 1102 | |
| 1103 | // false->true |
| 1104 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1105 | EXPECT_TRUE(stream->IsSending()); |
| 1106 | // true->true |
| 1107 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1108 | EXPECT_TRUE(stream->IsSending()); |
| 1109 | // true->false |
| 1110 | EXPECT_TRUE(channel_->SetSend(false)); |
| 1111 | EXPECT_FALSE(stream->IsSending()); |
| 1112 | // false->false |
| 1113 | EXPECT_TRUE(channel_->SetSend(false)); |
| 1114 | EXPECT_FALSE(stream->IsSending()); |
| 1115 | |
| 1116 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1117 | FakeVideoSendStream* new_stream = AddSendStream(); |
| 1118 | EXPECT_TRUE(new_stream->IsSending()) |
| 1119 | << "Send stream created after SetSend(true) not sending initially."; |
| 1120 | } |
| 1121 | |
| 1122 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Vga) { |
| 1123 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1124 | } |
| 1125 | |
| 1126 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Qvga) { |
| 1127 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1128 | } |
| 1129 | |
| 1130 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveH264SvcQqvga) { |
| 1131 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1132 | } |
| 1133 | |
| 1134 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendManyResizeOnce) { |
| 1135 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1136 | } |
| 1137 | |
| 1138 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendVp8HdAndReceiveAdaptedVp8Vga) { |
| 1139 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1140 | } |
| 1141 | |
| 1142 | TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetDscpOptions) { |
| 1143 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1144 | } |
| 1145 | |
| 1146 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithMaxBitrate) { |
| 1147 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1148 | } |
| 1149 | |
| 1150 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithLoweredBitrate) { |
| 1151 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1152 | } |
| 1153 | |
| 1154 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsSucceedsWhenSending) { |
| 1155 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1156 | } |
| 1157 | |
| 1158 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ResetCodecOnScreencast) { |
| 1159 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1160 | } |
| 1161 | |
| 1162 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontResetCodecOnSendFrame) { |
| 1163 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1164 | } |
| 1165 | |
| 1166 | TEST_F(WebRtcVideoChannel2Test, |
| 1167 | DISABLED_DontRegisterDecoderIfFactoryIsNotGiven) { |
| 1168 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1169 | } |
| 1170 | |
| 1171 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RegisterDecoderIfFactoryIsGiven) { |
| 1172 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1173 | } |
| 1174 | |
| 1175 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterDecoderMultipleTimes) { |
| 1176 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1177 | } |
| 1178 | |
| 1179 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterDecoderForNonVP8) { |
| 1180 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1181 | } |
| 1182 | |
| 1183 | TEST_F(WebRtcVideoChannel2Test, |
| 1184 | DISABLED_DontRegisterEncoderIfFactoryIsNotGiven) { |
| 1185 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1186 | } |
| 1187 | |
| 1188 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RegisterEncoderIfFactoryIsGiven) { |
| 1189 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1190 | } |
| 1191 | |
| 1192 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterEncoderMultipleTimes) { |
| 1193 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1194 | } |
| 1195 | |
| 1196 | TEST_F(WebRtcVideoChannel2Test, |
| 1197 | DISABLED_RegisterEncoderWithMultipleSendStreams) { |
| 1198 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1199 | } |
| 1200 | |
| 1201 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterEncoderForNonVP8) { |
| 1202 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1203 | } |
| 1204 | |
| 1205 | TEST_F(WebRtcVideoChannel2Test, DISABLED_FeedbackParamsForNonVP8) { |
| 1206 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1207 | } |
| 1208 | |
| 1209 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ExternalCodecAddedToTheEnd) { |
| 1210 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1211 | } |
| 1212 | |
| 1213 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ExternalCodecIgnored) { |
| 1214 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1215 | } |
| 1216 | |
| 1217 | TEST_F(WebRtcVideoChannel2Test, DISABLED_UpdateEncoderCodecsAfterSetFactory) { |
| 1218 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1219 | } |
| 1220 | |
| 1221 | TEST_F(WebRtcVideoChannel2Test, DISABLED_OnReadyToSend) { |
| 1222 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1223 | } |
| 1224 | |
| 1225 | TEST_F(WebRtcVideoChannel2Test, DISABLED_CaptureFrameTimestampToNtpTimestamp) { |
| 1226 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1227 | } |
| 1228 | } // namespace cricket |