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 | |
| 331 | class WebRtcVideoChannel2BaseTest |
| 332 | : public VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> { |
| 333 | protected: |
| 334 | virtual cricket::VideoCodec DefaultCodec() OVERRIDE { return kVp8Codec; } |
| 335 | typedef VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> Base; |
| 336 | }; |
| 337 | |
| 338 | // TODO(pbos): Fix WebRtcVideoEngine2BaseTest, where we want CheckCoInitialize. |
| 339 | #if 0 |
| 340 | // TODO(juberti): Figure out why ViE is munging the COM refcount. |
| 341 | #ifdef WIN32 |
| 342 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_CheckCoInitialize) { |
| 343 | Base::CheckCoInitialize(); |
| 344 | } |
| 345 | #endif |
| 346 | #endif |
| 347 | |
| 348 | TEST_F(WebRtcVideoChannel2BaseTest, SetSend) { Base::SetSend(); } |
| 349 | |
| 350 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendWithoutCodecs) { |
| 351 | Base::SetSendWithoutCodecs(); |
| 352 | } |
| 353 | |
| 354 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendSetsTransportBufferSizes) { |
| 355 | Base::SetSendSetsTransportBufferSizes(); |
| 356 | } |
| 357 | |
| 358 | // TODO(juberti): Fix this test to tolerate missing stats. |
| 359 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStats) { Base::GetStats(); } |
| 360 | |
| 361 | // TODO(juberti): Fix this test to tolerate missing stats. |
| 362 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStatsMultipleRecvStreams) { |
| 363 | Base::GetStatsMultipleRecvStreams(); |
| 364 | } |
| 365 | |
| 366 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStatsMultipleSendStreams) { |
| 367 | Base::GetStatsMultipleSendStreams(); |
| 368 | } |
| 369 | |
| 370 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendBandwidth) { |
| 371 | Base::SetSendBandwidth(); |
| 372 | } |
| 373 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendSsrc) { Base::SetSendSsrc(); } |
| 374 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendSsrcAfterSetCodecs) { |
| 375 | Base::SetSendSsrcAfterSetCodecs(); |
| 376 | } |
| 377 | |
| 378 | TEST_F(WebRtcVideoChannel2BaseTest, SetRenderer) { Base::SetRenderer(); } |
| 379 | |
| 380 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveRecvStreams) { |
| 381 | Base::AddRemoveRecvStreams(); |
| 382 | } |
| 383 | |
| 384 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AddRemoveRecvStreamAndRender) { |
| 385 | Base::AddRemoveRecvStreamAndRender(); |
| 386 | } |
| 387 | |
| 388 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveRecvStreamsNoConference) { |
| 389 | Base::AddRemoveRecvStreamsNoConference(); |
| 390 | } |
| 391 | |
| 392 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveSendStreams) { |
| 393 | Base::AddRemoveSendStreams(); |
| 394 | } |
| 395 | |
| 396 | TEST_F(WebRtcVideoChannel2BaseTest, SimulateConference) { |
| 397 | Base::SimulateConference(); |
| 398 | } |
| 399 | |
| 400 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveCapturer) { |
| 401 | Base::AddRemoveCapturer(); |
| 402 | } |
| 403 | |
| 404 | TEST_F(WebRtcVideoChannel2BaseTest, RemoveCapturerWithoutAdd) { |
| 405 | Base::RemoveCapturerWithoutAdd(); |
| 406 | } |
| 407 | |
| 408 | TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveCapturerMultipleSources) { |
| 409 | Base::AddRemoveCapturerMultipleSources(); |
| 410 | } |
| 411 | |
| 412 | // TODO(pbos): Figure out why this fails so often. |
| 413 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_HighAspectHighHeightCapturer) { |
| 414 | Base::HighAspectHighHeightCapturer(); |
| 415 | } |
| 416 | |
| 417 | TEST_F(WebRtcVideoChannel2BaseTest, RejectEmptyStreamParams) { |
| 418 | Base::RejectEmptyStreamParams(); |
| 419 | } |
| 420 | |
| 421 | TEST_F(WebRtcVideoChannel2BaseTest, AdaptResolution16x10) { |
| 422 | Base::AdaptResolution16x10(); |
| 423 | } |
| 424 | |
| 425 | TEST_F(WebRtcVideoChannel2BaseTest, AdaptResolution4x3) { |
| 426 | Base::AdaptResolution4x3(); |
| 427 | } |
| 428 | |
| 429 | TEST_F(WebRtcVideoChannel2BaseTest, MuteStream) { Base::MuteStream(); } |
| 430 | |
| 431 | TEST_F(WebRtcVideoChannel2BaseTest, MultipleSendStreams) { |
| 432 | Base::MultipleSendStreams(); |
| 433 | } |
| 434 | |
| 435 | // TODO(juberti): Restore this test once we support sending 0 fps. |
| 436 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AdaptDropAllFrames) { |
| 437 | Base::AdaptDropAllFrames(); |
| 438 | } |
| 439 | // TODO(juberti): Understand why we get decode errors on this test. |
| 440 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AdaptFramerate) { |
| 441 | Base::AdaptFramerate(); |
| 442 | } |
| 443 | |
| 444 | TEST_F(WebRtcVideoChannel2BaseTest, SetSendStreamFormat0x0) { |
| 445 | Base::SetSendStreamFormat0x0(); |
| 446 | } |
| 447 | |
| 448 | // TODO(zhurunz): Fix the flakey test. |
| 449 | TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_SetSendStreamFormat) { |
| 450 | Base::SetSendStreamFormat(); |
| 451 | } |
| 452 | |
| 453 | TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsSendAndReceive) { |
| 454 | Base::TwoStreamsSendAndReceive(kVp8Codec); |
| 455 | } |
| 456 | |
| 457 | TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsReUseFirstStream) { |
| 458 | Base::TwoStreamsReUseFirstStream(kVp8Codec); |
| 459 | } |
| 460 | |
| 461 | class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { |
| 462 | public: |
| 463 | virtual void SetUp() OVERRIDE { |
| 464 | channel_.reset(engine_.CreateChannel(NULL)); |
| 465 | fake_channel_ = factory_.GetFakeChannel(channel_.get()); |
| 466 | last_ssrc_ = 123; |
| 467 | ASSERT_TRUE(fake_channel_ != NULL) |
| 468 | << "Channel not created through factory."; |
| 469 | } |
| 470 | |
| 471 | protected: |
| 472 | FakeVideoSendStream* AddSendStream() { |
| 473 | return AddSendStream(StreamParams::CreateLegacy(last_ssrc_++)); |
| 474 | } |
| 475 | |
| 476 | FakeVideoSendStream* AddSendStream(const StreamParams& sp) { |
| 477 | size_t num_streams = |
| 478 | fake_channel_->GetFakeCall()->GetVideoSendStreams().size(); |
| 479 | EXPECT_TRUE(channel_->AddSendStream(sp)); |
| 480 | std::vector<FakeVideoSendStream*> streams = |
| 481 | fake_channel_->GetFakeCall()->GetVideoSendStreams(); |
| 482 | EXPECT_EQ(num_streams + 1, streams.size()); |
| 483 | return streams[streams.size() - 1]; |
| 484 | } |
| 485 | |
| 486 | std::vector<FakeVideoSendStream*> GetFakeSendStreams() { |
| 487 | return fake_channel_->GetFakeCall()->GetVideoSendStreams(); |
| 488 | } |
| 489 | |
| 490 | FakeVideoReceiveStream* AddRecvStream() { |
| 491 | return AddRecvStream(StreamParams::CreateLegacy(last_ssrc_++)); |
| 492 | } |
| 493 | |
| 494 | FakeVideoReceiveStream* AddRecvStream(const StreamParams& sp) { |
| 495 | size_t num_streams = |
| 496 | fake_channel_->GetFakeCall()->GetVideoReceiveStreams().size(); |
| 497 | EXPECT_TRUE(channel_->AddRecvStream(sp)); |
| 498 | std::vector<FakeVideoReceiveStream*> streams = |
| 499 | fake_channel_->GetFakeCall()->GetVideoReceiveStreams(); |
| 500 | EXPECT_EQ(num_streams + 1, streams.size()); |
| 501 | return streams[streams.size() - 1]; |
| 502 | } |
| 503 | |
| 504 | void SetSendCodecsShouldWorkForBitrates(const char* min_bitrate, |
| 505 | const char* max_bitrate) { |
| 506 | std::vector<VideoCodec> codecs; |
| 507 | codecs.push_back(kVp8Codec); |
| 508 | codecs[0].params[kCodecParamMinBitrate] = min_bitrate; |
| 509 | codecs[0].params[kCodecParamMaxBitrate] = max_bitrate; |
| 510 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)); |
| 511 | |
| 512 | FakeVideoSendStream* stream = AddSendStream(); |
| 513 | |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 514 | std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams(); |
| 515 | ASSERT_EQ(1u, video_streams.size()); |
| 516 | EXPECT_EQ(atoi(min_bitrate), video_streams.back().min_bitrate_bps / 1000); |
| 517 | 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] | 518 | |
| 519 | VideoCodec codec; |
| 520 | EXPECT_TRUE(channel_->GetSendCodec(&codec)); |
| 521 | EXPECT_EQ(min_bitrate, codec.params[kCodecParamMinBitrate]); |
| 522 | EXPECT_EQ(max_bitrate, codec.params[kCodecParamMaxBitrate]); |
| 523 | } |
| 524 | |
| 525 | void ExpectEqualCodecs(const VideoCodec video_codec, |
| 526 | const webrtc::VideoCodec& webrtc_codec) { |
| 527 | EXPECT_STREQ(video_codec.name.c_str(), webrtc_codec.plName); |
| 528 | EXPECT_EQ(video_codec.id, webrtc_codec.plType); |
| 529 | EXPECT_EQ(video_codec.width, webrtc_codec.width); |
| 530 | EXPECT_EQ(video_codec.height, webrtc_codec.height); |
| 531 | EXPECT_EQ(video_codec.framerate, webrtc_codec.maxFramerate); |
| 532 | } |
| 533 | talk_base::scoped_ptr<VideoMediaChannel> channel_; |
| 534 | FakeWebRtcVideoChannel2* fake_channel_; |
| 535 | uint32 last_ssrc_; |
| 536 | }; |
| 537 | |
| 538 | TEST_F(WebRtcVideoChannel2Test, DISABLED_MaxBitrateResetsWithConferenceMode) { |
| 539 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 540 | } |
| 541 | |
| 542 | TEST_F(WebRtcVideoChannel2Test, DISABLED_StartSendBitrate) { |
| 543 | // TODO(pbos): Is this test testing vie_ ? this is confusing. No API to set |
| 544 | // start send bitrate from outside? Add defaults here that should be kept? |
| 545 | std::vector<cricket::VideoCodec> codec_list; |
| 546 | codec_list.push_back(kVp8Codec); |
| 547 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 548 | const unsigned int kVideoMinSendBitrateKbps = 50; |
| 549 | const unsigned int kVideoTargetSendBitrateKbps = 300; |
| 550 | const unsigned int kVideoMaxSendBitrateKbps = 2000; |
| 551 | FakeVideoSendStream* stream = AddSendStream(); |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 552 | std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams(); |
| 553 | ASSERT_EQ(1u, video_streams.size()); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 554 | EXPECT_EQ(kVideoMinSendBitrateKbps, |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 555 | video_streams.back().min_bitrate_bps / 1000); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 556 | EXPECT_EQ(kVideoTargetSendBitrateKbps, |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 557 | video_streams.back().target_bitrate_bps / 1000); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 558 | EXPECT_EQ(kVideoMaxSendBitrateKbps, |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 559 | video_streams.back().max_bitrate_bps / 1000); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 560 | #if 0 |
| 561 | // TODO(pbos): un-#if |
| 562 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 563 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 564 | kVideoDefaultStartSendBitrateKbps); |
| 565 | EXPECT_EQ(0, vie_.StartSend(send_channel)); |
| 566 | |
| 567 | // Increase the send bitrate and verify it is used as start bitrate. |
| 568 | const unsigned int kVideoSendBitrateBps = 768000; |
| 569 | vie_.SetSendBitrates(send_channel, kVideoSendBitrateBps, 0, 0); |
| 570 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 571 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 572 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 573 | kVideoSendBitrateBps / 1000); |
| 574 | |
| 575 | // Never set a start bitrate higher than the max bitrate. |
| 576 | vie_.SetSendBitrates(send_channel, kVideoMaxSendBitrateKbps + 500, 0, 0); |
| 577 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 578 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 579 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 580 | kVideoDefaultStartSendBitrateKbps); |
| 581 | |
| 582 | // Use the default start bitrate if the send bitrate is lower. |
| 583 | vie_.SetSendBitrates(send_channel, kVideoDefaultStartSendBitrateKbps - 50, 0, |
| 584 | 0); |
| 585 | EXPECT_TRUE(channel_->SetSendCodecs(codec_list)); |
| 586 | VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0, |
| 587 | kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps, |
| 588 | kVideoDefaultStartSendBitrateKbps); |
| 589 | #endif |
| 590 | } |
| 591 | |
| 592 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RtcpEnabled) { |
| 593 | // Note(pbos): This is a receiver-side setting, dumbo. |
| 594 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 595 | } |
| 596 | |
| 597 | TEST_F(WebRtcVideoChannel2Test, DISABLED_KeyFrameRequestEnabled) { |
| 598 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 599 | } |
| 600 | |
| 601 | TEST_F(WebRtcVideoChannel2Test, RembIsEnabledByDefault) { |
| 602 | FakeVideoReceiveStream* stream = AddRecvStream(); |
| 603 | EXPECT_TRUE(stream->GetConfig().rtp.remb); |
| 604 | } |
| 605 | |
| 606 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RembEnabledOnReceiveChannels) { |
| 607 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 608 | } |
| 609 | |
| 610 | TEST_F(WebRtcVideoChannel2Test, RecvStreamWithRtx) { |
| 611 | EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
| 612 | EXPECT_TRUE(channel_->SetSend(true)); |
| 613 | cricket::VideoOptions options; |
| 614 | options.conference_mode.Set(true); |
| 615 | EXPECT_TRUE(channel_->SetOptions(options)); |
| 616 | |
| 617 | // Send side. |
| 618 | const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); |
| 619 | const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
| 620 | FakeVideoSendStream* send_stream = AddSendStream( |
| 621 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 622 | |
| 623 | ASSERT_EQ(rtx_ssrcs.size(), send_stream->GetConfig().rtp.rtx.ssrcs.size()); |
| 624 | for (size_t i = 0; i < rtx_ssrcs.size(); ++i) |
| 625 | EXPECT_EQ(rtx_ssrcs[i], send_stream->GetConfig().rtp.rtx.ssrcs[i]); |
| 626 | |
| 627 | // Receiver side. |
| 628 | FakeVideoReceiveStream* recv_stream = AddRecvStream( |
| 629 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 630 | ASSERT_GT(recv_stream->GetConfig().rtp.rtx.size(), 0u) |
| 631 | << "No SSRCs for RTX configured by AddRecvStream."; |
| 632 | ASSERT_EQ(1u, recv_stream->GetConfig().rtp.rtx.size()) |
| 633 | << "This test only works with one receive codec. Please update the test."; |
| 634 | EXPECT_EQ(rtx_ssrcs[0], |
| 635 | recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc); |
| 636 | // TODO(pbos): Make sure we set the RTX for correct payloads etc. |
| 637 | } |
| 638 | |
| 639 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RecvStreamWithRtxOnMultiplePayloads) { |
| 640 | FAIL() << "Not implemented."; |
| 641 | } |
| 642 | |
buildbot@webrtc.org | 50f1b41 | 2014-05-30 07:40:35 +0000 | [diff] [blame] | 643 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RecvStreamNoRtx) { |
| 644 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 645 | } |
| 646 | |
| 647 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RtpTimestampOffsetHeaderExtensions) { |
| 648 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 649 | } |
| 650 | |
| 651 | TEST_F(WebRtcVideoChannel2Test, DISABLED_AbsoluteSendTimeHeaderExtensions) { |
| 652 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 653 | } |
| 654 | |
| 655 | TEST_F(WebRtcVideoChannel2Test, DISABLED_LeakyBucketTest) { |
| 656 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 657 | } |
| 658 | |
| 659 | TEST_F(WebRtcVideoChannel2Test, DISABLED_BufferedModeLatency) { |
| 660 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 661 | } |
| 662 | |
| 663 | TEST_F(WebRtcVideoChannel2Test, DISABLED_AdditiveVideoOptions) { |
| 664 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 665 | } |
| 666 | |
| 667 | TEST_F(WebRtcVideoChannel2Test, AddRecvStreamOnlyUsesOneReceiveStream) { |
| 668 | EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); |
| 669 | EXPECT_EQ(1u, fake_channel_->GetFakeCall()->GetVideoReceiveStreams().size()); |
| 670 | } |
| 671 | |
| 672 | TEST_F(WebRtcVideoChannel2Test, DISABLED_NoRembChangeAfterAddRecvStream) { |
| 673 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 674 | } |
| 675 | |
| 676 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RembOnOff) { |
| 677 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 678 | } |
| 679 | |
pbos@webrtc.org | 84f5e34 | 2014-05-30 07:35:47 +0000 | [diff] [blame] | 680 | TEST_F(WebRtcVideoChannel2Test, NackIsEnabled) { |
| 681 | EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
| 682 | EXPECT_TRUE(channel_->SetSend(true)); |
| 683 | |
| 684 | // Send side. |
| 685 | FakeVideoSendStream* send_stream = |
| 686 | AddSendStream(cricket::StreamParams::CreateLegacy(1)); |
| 687 | EXPECT_GT(send_stream->GetConfig().rtp.nack.rtp_history_ms, 0); |
| 688 | |
| 689 | // Receiver side. |
| 690 | FakeVideoReceiveStream* recv_stream = |
| 691 | AddRecvStream(cricket::StreamParams::CreateLegacy(1)); |
| 692 | EXPECT_GT(recv_stream->GetConfig().rtp.nack.rtp_history_ms, 0); |
| 693 | |
| 694 | // Nack history size should match between sender and receiver. |
| 695 | EXPECT_EQ(send_stream->GetConfig().rtp.nack.rtp_history_ms, |
| 696 | recv_stream->GetConfig().rtp.nack.rtp_history_ms); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | TEST_F(WebRtcVideoChannel2Test, DISABLED_VideoProtectionInterop) { |
| 700 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 701 | } |
| 702 | |
| 703 | TEST_F(WebRtcVideoChannel2Test, DISABLED_VideoProtectionInteropReversed) { |
| 704 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 705 | } |
| 706 | |
| 707 | TEST_F(WebRtcVideoChannel2Test, DISABLED_HybridNackFecConference) { |
| 708 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 709 | } |
| 710 | |
| 711 | TEST_F(WebRtcVideoChannel2Test, DISABLED_AddRemoveRecvStreamConference) { |
| 712 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 713 | } |
| 714 | |
| 715 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetRender) { |
| 716 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 717 | } |
| 718 | |
| 719 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthAuto) { |
| 720 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 721 | } |
| 722 | |
| 723 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthAutoCapped) { |
| 724 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 725 | } |
| 726 | |
| 727 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthFixed) { |
| 728 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 729 | } |
| 730 | |
| 731 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthInConference) { |
| 732 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 733 | } |
| 734 | |
| 735 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthScreencast) { |
| 736 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 737 | } |
| 738 | |
| 739 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetSendSsrcAndCname) { |
| 740 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 741 | } |
| 742 | |
| 743 | TEST_F(WebRtcVideoChannel2Test, |
| 744 | DISABLED_SetSendSsrcAfterCreatingReceiveChannel) { |
| 745 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 746 | } |
| 747 | |
| 748 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithDenoising) { |
| 749 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 750 | } |
| 751 | |
| 752 | TEST_F(WebRtcVideoChannel2Test, DISABLED_MultipleSendStreamsWithOneCapturer) { |
| 753 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 754 | } |
| 755 | |
| 756 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DISABLED_SendReceiveBitratesStats) { |
| 757 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 758 | } |
| 759 | |
| 760 | TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetAdaptInputToCpuUsage) { |
| 761 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 762 | } |
| 763 | |
| 764 | TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetCpuThreshold) { |
| 765 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 766 | } |
| 767 | |
| 768 | TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetInvalidCpuThreshold) { |
| 769 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 770 | } |
| 771 | |
| 772 | TEST_F(WebRtcVideoChannel2Test, DISABLED_WebRtcShouldLog) { |
| 773 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 774 | } |
| 775 | |
| 776 | TEST_F(WebRtcVideoChannel2Test, DISABLED_WebRtcShouldNotLog) { |
| 777 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 778 | } |
| 779 | |
| 780 | TEST_F(WebRtcVideoEngine2Test, FindCodec) { |
| 781 | const std::vector<cricket::VideoCodec>& c = engine_.codecs(); |
| 782 | EXPECT_EQ(4U, c.size()); |
| 783 | |
| 784 | cricket::VideoCodec vp8(104, "VP8", 320, 200, 30, 0); |
| 785 | EXPECT_TRUE(engine_.FindCodec(vp8)); |
| 786 | |
| 787 | cricket::VideoCodec vp8_ci(104, "vp8", 320, 200, 30, 0); |
| 788 | EXPECT_TRUE(engine_.FindCodec(vp8)); |
| 789 | |
| 790 | cricket::VideoCodec vp8_diff_fr_diff_pref(104, "VP8", 320, 200, 50, 50); |
| 791 | EXPECT_TRUE(engine_.FindCodec(vp8_diff_fr_diff_pref)); |
| 792 | |
| 793 | cricket::VideoCodec vp8_diff_id(95, "VP8", 320, 200, 30, 0); |
| 794 | EXPECT_FALSE(engine_.FindCodec(vp8_diff_id)); |
| 795 | vp8_diff_id.id = 97; |
| 796 | EXPECT_TRUE(engine_.FindCodec(vp8_diff_id)); |
| 797 | |
| 798 | cricket::VideoCodec vp8_diff_res(104, "VP8", 320, 111, 30, 0); |
| 799 | EXPECT_FALSE(engine_.FindCodec(vp8_diff_res)); |
| 800 | |
| 801 | // PeerConnection doesn't negotiate the resolution at this point. |
| 802 | // Test that FindCodec can handle the case when width/height is 0. |
| 803 | cricket::VideoCodec vp8_zero_res(104, "VP8", 0, 0, 30, 0); |
| 804 | EXPECT_TRUE(engine_.FindCodec(vp8_zero_res)); |
| 805 | |
| 806 | cricket::VideoCodec red(101, "RED", 0, 0, 30, 0); |
| 807 | EXPECT_TRUE(engine_.FindCodec(red)); |
| 808 | |
| 809 | cricket::VideoCodec red_ci(101, "red", 0, 0, 30, 0); |
| 810 | EXPECT_TRUE(engine_.FindCodec(red)); |
| 811 | |
| 812 | cricket::VideoCodec fec(102, "ULPFEC", 0, 0, 30, 0); |
| 813 | EXPECT_TRUE(engine_.FindCodec(fec)); |
| 814 | |
| 815 | cricket::VideoCodec fec_ci(102, "ulpfec", 0, 0, 30, 0); |
| 816 | EXPECT_TRUE(engine_.FindCodec(fec)); |
| 817 | |
| 818 | cricket::VideoCodec rtx(96, "rtx", 0, 0, 30, 0); |
| 819 | EXPECT_TRUE(engine_.FindCodec(rtx)); |
| 820 | } |
| 821 | |
| 822 | TEST_F(WebRtcVideoEngine2Test, DefaultRtxCodecHasAssociatedPayloadTypeSet) { |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame^] | 823 | for (size_t i = 0; i < engine_.codecs().size(); ++i) { |
| 824 | if (engine_.codecs()[i].name != kRtxCodecName) |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 825 | continue; |
| 826 | int associated_payload_type; |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame^] | 827 | EXPECT_TRUE(engine_.codecs()[i].GetParam(kCodecParamAssociatedPayloadType, |
| 828 | &associated_payload_type)); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 829 | EXPECT_EQ(default_codec_.id, associated_payload_type); |
| 830 | return; |
| 831 | } |
| 832 | FAIL() << "No RTX codec found among default codecs."; |
| 833 | } |
| 834 | |
| 835 | TEST_F(WebRtcVideoChannel2Test, SetDefaultSendCodecs) { |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame^] | 836 | ASSERT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 837 | |
| 838 | VideoCodec codec; |
| 839 | EXPECT_TRUE(channel_->GetSendCodec(&codec)); |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame^] | 840 | EXPECT_TRUE(codec.Matches(engine_.codecs()[0])); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 841 | |
| 842 | // Using a RTX setup to verify that the default RTX payload type is good. |
| 843 | const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); |
| 844 | const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
| 845 | FakeVideoSendStream* stream = AddSendStream( |
| 846 | cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
| 847 | webrtc::VideoSendStream::Config config = stream->GetConfig(); |
| 848 | // TODO(pbos): Replace ExpectEqualCodecs. |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame^] | 849 | // ExpectEqualCodecs(engine_.codecs()[0], config.codec); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 850 | |
| 851 | // Make sure NACK and FEC are enabled on the correct payload types. |
| 852 | EXPECT_EQ(1000, config.rtp.nack.rtp_history_ms); |
| 853 | EXPECT_EQ(default_ulpfec_codec_.id, config.rtp.fec.ulpfec_payload_type); |
| 854 | EXPECT_EQ(default_red_codec_.id, config.rtp.fec.red_payload_type); |
| 855 | // TODO(pbos): Verify that the rtx ssrc is set, correct, not taken by anything |
| 856 | // else. |
| 857 | // ASSERT_EQ(1u, config.rtp.rtx.ssrcs.size()); |
| 858 | EXPECT_EQ(static_cast<int>(default_rtx_codec_.id), |
| 859 | config.rtp.rtx.payload_type); |
| 860 | // TODO(juberti): Check RTCP, PLI, TMMBR. |
| 861 | } |
| 862 | |
| 863 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) { |
| 864 | std::vector<VideoCodec> codecs; |
| 865 | codecs.push_back(kVp8Codec); |
| 866 | ASSERT_TRUE(channel_->SetSendCodecs(codecs)); |
| 867 | |
| 868 | FakeVideoSendStream* stream = AddSendStream(); |
| 869 | webrtc::VideoSendStream::Config config = stream->GetConfig(); |
| 870 | |
| 871 | EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type); |
| 872 | EXPECT_EQ(-1, config.rtp.fec.red_payload_type); |
| 873 | } |
| 874 | |
| 875 | TEST_F(WebRtcVideoChannel2Test, |
| 876 | DISABLED_SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { |
| 877 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 878 | } |
| 879 | |
| 880 | TEST_F(WebRtcVideoChannel2Test, |
| 881 | DISABLED_SetSendCodecRejectsRtxWithoutMatchingVideoCodec) { |
| 882 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 883 | } |
| 884 | |
| 885 | TEST_F(WebRtcVideoChannel2Test, |
| 886 | DISABLED_SetCodecsWithoutFecDisablesCurrentFec) { |
| 887 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 888 | } |
| 889 | |
| 890 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetSendCodecsChangesExistingStreams) { |
| 891 | FAIL(); // TODO(pbos): Implement, make sure that it's changing running |
| 892 | // streams. Should it? |
| 893 | } |
| 894 | |
| 895 | TEST_F(WebRtcVideoChannel2Test, |
| 896 | DISABLED_ConstrainsSetCodecsAccordingToEncoderConfig) { |
| 897 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 898 | } |
| 899 | |
| 900 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMinMaxBitrate) { |
| 901 | SetSendCodecsShouldWorkForBitrates("10", "20"); |
| 902 | } |
| 903 | |
| 904 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectsMaxLessThanMinBitrate) { |
pbos@webrtc.org | 6bb6290 | 2014-06-13 09:34:13 +0000 | [diff] [blame^] | 905 | std::vector<VideoCodec> video_codecs = engine_.codecs(); |
| 906 | video_codecs[0].params[kCodecParamMinBitrate] = "30"; |
| 907 | video_codecs[0].params[kCodecParamMaxBitrate] = "20"; |
| 908 | EXPECT_FALSE(channel_->SetSendCodecs(video_codecs)); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 909 | } |
| 910 | |
| 911 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptLargeMinMaxBitrate) { |
| 912 | SetSendCodecsShouldWorkForBitrates("1000", "2000"); |
| 913 | } |
| 914 | |
| 915 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) { |
| 916 | static const char* kMaxQuantization = "21"; |
| 917 | std::vector<VideoCodec> codecs; |
| 918 | codecs.push_back(kVp8Codec); |
| 919 | codecs[0].params[kCodecParamMaxQuantization] = kMaxQuantization; |
| 920 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)); |
pbos@webrtc.org | 7254487 | 2014-06-06 10:49:19 +0000 | [diff] [blame] | 921 | EXPECT_EQ(static_cast<unsigned int>(atoi(kMaxQuantization)), |
| 922 | AddSendStream()->GetVideoStreams().back().max_qp); |
pbos@webrtc.org | 87e1f97 | 2014-05-13 11:07:01 +0000 | [diff] [blame] | 923 | |
| 924 | VideoCodec codec; |
| 925 | EXPECT_TRUE(channel_->GetSendCodec(&codec)); |
| 926 | EXPECT_EQ(kMaxQuantization, codec.params[kCodecParamMaxQuantization]); |
| 927 | } |
| 928 | |
| 929 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectBadDimensions) { |
| 930 | std::vector<cricket::VideoCodec> codecs; |
| 931 | codecs.push_back(kVp8Codec); |
| 932 | |
| 933 | codecs[0].width = 0; |
| 934 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 935 | << "Codec set though codec width is zero."; |
| 936 | |
| 937 | codecs[0].width = kVp8Codec.width; |
| 938 | codecs[0].height = 0; |
| 939 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 940 | << "Codec set though codec height is zero."; |
| 941 | } |
| 942 | |
| 943 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectBadPayloadTypes) { |
| 944 | // TODO(pbos): Should we only allow the dynamic range? |
| 945 | static const size_t kNumIncorrectPayloads = 4; |
| 946 | static const int kIncorrectPayloads[kNumIncorrectPayloads] = {-2, -1, 128, |
| 947 | 129}; |
| 948 | std::vector<cricket::VideoCodec> codecs; |
| 949 | codecs.push_back(kVp8Codec); |
| 950 | for (size_t i = 0; i < kNumIncorrectPayloads; ++i) { |
| 951 | int payload_type = kIncorrectPayloads[i]; |
| 952 | codecs[0].id = payload_type; |
| 953 | EXPECT_FALSE(channel_->SetSendCodecs(codecs)) |
| 954 | << "Bad payload type '" << payload_type << "' accepted."; |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptAllValidPayloadTypes) { |
| 959 | std::vector<cricket::VideoCodec> codecs; |
| 960 | codecs.push_back(kVp8Codec); |
| 961 | for (int payload_type = 0; payload_type <= 127; ++payload_type) { |
| 962 | codecs[0].id = payload_type; |
| 963 | EXPECT_TRUE(channel_->SetSendCodecs(codecs)) |
| 964 | << "Payload type '" << payload_type << "' rejected."; |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ResetVieSendCodecOnNewFrameSize) { |
| 969 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 970 | } |
| 971 | |
| 972 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithOnlyVp8) { |
| 973 | std::vector<cricket::VideoCodec> codecs; |
| 974 | codecs.push_back(kVp8Codec); |
| 975 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 976 | } |
| 977 | |
| 978 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsDifferentPayloadType) { |
| 979 | std::vector<cricket::VideoCodec> codecs; |
| 980 | codecs.push_back(kVp8Codec); |
| 981 | codecs[0].id = 99; |
| 982 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 983 | } |
| 984 | |
| 985 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetRecvCodecsAcceptDefaultCodecs) { |
| 986 | EXPECT_TRUE(channel_->SetRecvCodecs(engine_.codecs())); |
| 987 | // (I've added this one.) Make sure they propagate down to VideoReceiveStream! |
| 988 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 989 | } |
| 990 | |
| 991 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) { |
| 992 | std::vector<VideoCodec> codecs; |
| 993 | codecs.push_back(kVp8Codec); |
| 994 | codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30, 0)); |
| 995 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)); |
| 996 | } |
| 997 | |
| 998 | // TODO(pbos): Enable VP9 through external codec support |
| 999 | TEST_F(WebRtcVideoChannel2Test, |
| 1000 | DISABLED_SetRecvCodecsAcceptsMultipleVideoCodecs) { |
| 1001 | std::vector<VideoCodec> codecs; |
| 1002 | codecs.push_back(kVp8Codec); |
| 1003 | codecs.push_back(kVp9Codec); |
| 1004 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1005 | } |
| 1006 | |
| 1007 | TEST_F(WebRtcVideoChannel2Test, |
| 1008 | DISABLED_SetRecvCodecsSetsFecForAllVideoCodecs) { |
| 1009 | std::vector<VideoCodec> codecs; |
| 1010 | codecs.push_back(kVp8Codec); |
| 1011 | codecs.push_back(kVp9Codec); |
| 1012 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1013 | FAIL(); // TODO(pbos): Verify that the FEC parameters are set for all codecs. |
| 1014 | } |
| 1015 | |
| 1016 | TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) { |
| 1017 | std::vector<VideoCodec> codecs; |
| 1018 | codecs.push_back(kVp8Codec); |
| 1019 | codecs.push_back(kRedCodec); |
| 1020 | codecs[1].id = codecs[0].id; |
| 1021 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)); |
| 1022 | } |
| 1023 | |
| 1024 | TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectDuplicateCodecPayloads) { |
| 1025 | std::vector<VideoCodec> codecs; |
| 1026 | codecs.push_back(kVp8Codec); |
| 1027 | codecs.push_back(kVp9Codec); |
| 1028 | codecs[1].id = codecs[0].id; |
| 1029 | EXPECT_FALSE(channel_->SetRecvCodecs(codecs)); |
| 1030 | } |
| 1031 | |
| 1032 | TEST_F(WebRtcVideoChannel2Test, |
| 1033 | SetRecvCodecsAcceptSameCodecOnMultiplePayloadTypes) { |
| 1034 | std::vector<VideoCodec> codecs; |
| 1035 | codecs.push_back(kVp8Codec); |
| 1036 | codecs.push_back(kVp8Codec); |
| 1037 | codecs[1].id += 1; |
| 1038 | EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 1039 | } |
| 1040 | |
| 1041 | TEST_F(WebRtcVideoChannel2Test, SendStreamNotSendingByDefault) { |
| 1042 | EXPECT_FALSE(AddSendStream()->IsSending()); |
| 1043 | } |
| 1044 | |
| 1045 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ReceiveStreamReceivingByDefault) { |
| 1046 | // Is this test correct though? Auto-receive? Enable receive on first packet? |
| 1047 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1048 | } |
| 1049 | |
| 1050 | TEST_F(WebRtcVideoChannel2Test, SetSend) { |
| 1051 | AddSendStream(); |
| 1052 | EXPECT_FALSE(channel_->SetSend(true)) |
| 1053 | << "Channel should not start without codecs."; |
| 1054 | EXPECT_TRUE(channel_->SetSend(false)) |
| 1055 | << "Channel should be stoppable even without set codecs."; |
| 1056 | |
| 1057 | std::vector<cricket::VideoCodec> codecs; |
| 1058 | codecs.push_back(kVp8Codec); |
| 1059 | channel_->SetSendCodecs(codecs); |
| 1060 | std::vector<FakeVideoSendStream*> streams = GetFakeSendStreams(); |
| 1061 | ASSERT_EQ(1u, streams.size()); |
| 1062 | FakeVideoSendStream* stream = streams.back(); |
| 1063 | |
| 1064 | EXPECT_FALSE(stream->IsSending()); |
| 1065 | |
| 1066 | // false->true |
| 1067 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1068 | EXPECT_TRUE(stream->IsSending()); |
| 1069 | // true->true |
| 1070 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1071 | EXPECT_TRUE(stream->IsSending()); |
| 1072 | // true->false |
| 1073 | EXPECT_TRUE(channel_->SetSend(false)); |
| 1074 | EXPECT_FALSE(stream->IsSending()); |
| 1075 | // false->false |
| 1076 | EXPECT_TRUE(channel_->SetSend(false)); |
| 1077 | EXPECT_FALSE(stream->IsSending()); |
| 1078 | |
| 1079 | EXPECT_TRUE(channel_->SetSend(true)); |
| 1080 | FakeVideoSendStream* new_stream = AddSendStream(); |
| 1081 | EXPECT_TRUE(new_stream->IsSending()) |
| 1082 | << "Send stream created after SetSend(true) not sending initially."; |
| 1083 | } |
| 1084 | |
| 1085 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Vga) { |
| 1086 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1087 | } |
| 1088 | |
| 1089 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Qvga) { |
| 1090 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1091 | } |
| 1092 | |
| 1093 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveH264SvcQqvga) { |
| 1094 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1095 | } |
| 1096 | |
| 1097 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendManyResizeOnce) { |
| 1098 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1099 | } |
| 1100 | |
| 1101 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SendVp8HdAndReceiveAdaptedVp8Vga) { |
| 1102 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1103 | } |
| 1104 | |
| 1105 | TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetDscpOptions) { |
| 1106 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1107 | } |
| 1108 | |
| 1109 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithMaxBitrate) { |
| 1110 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1111 | } |
| 1112 | |
| 1113 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithLoweredBitrate) { |
| 1114 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1115 | } |
| 1116 | |
| 1117 | TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsSucceedsWhenSending) { |
| 1118 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1119 | } |
| 1120 | |
| 1121 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ResetCodecOnScreencast) { |
| 1122 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1123 | } |
| 1124 | |
| 1125 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontResetCodecOnSendFrame) { |
| 1126 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1127 | } |
| 1128 | |
| 1129 | TEST_F(WebRtcVideoChannel2Test, |
| 1130 | DISABLED_DontRegisterDecoderIfFactoryIsNotGiven) { |
| 1131 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1132 | } |
| 1133 | |
| 1134 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RegisterDecoderIfFactoryIsGiven) { |
| 1135 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1136 | } |
| 1137 | |
| 1138 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterDecoderMultipleTimes) { |
| 1139 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1140 | } |
| 1141 | |
| 1142 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterDecoderForNonVP8) { |
| 1143 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1144 | } |
| 1145 | |
| 1146 | TEST_F(WebRtcVideoChannel2Test, |
| 1147 | DISABLED_DontRegisterEncoderIfFactoryIsNotGiven) { |
| 1148 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1149 | } |
| 1150 | |
| 1151 | TEST_F(WebRtcVideoChannel2Test, DISABLED_RegisterEncoderIfFactoryIsGiven) { |
| 1152 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1153 | } |
| 1154 | |
| 1155 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterEncoderMultipleTimes) { |
| 1156 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1157 | } |
| 1158 | |
| 1159 | TEST_F(WebRtcVideoChannel2Test, |
| 1160 | DISABLED_RegisterEncoderWithMultipleSendStreams) { |
| 1161 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1162 | } |
| 1163 | |
| 1164 | TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterEncoderForNonVP8) { |
| 1165 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1166 | } |
| 1167 | |
| 1168 | TEST_F(WebRtcVideoChannel2Test, DISABLED_FeedbackParamsForNonVP8) { |
| 1169 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1170 | } |
| 1171 | |
| 1172 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ExternalCodecAddedToTheEnd) { |
| 1173 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1174 | } |
| 1175 | |
| 1176 | TEST_F(WebRtcVideoChannel2Test, DISABLED_ExternalCodecIgnored) { |
| 1177 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1178 | } |
| 1179 | |
| 1180 | TEST_F(WebRtcVideoChannel2Test, DISABLED_UpdateEncoderCodecsAfterSetFactory) { |
| 1181 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1182 | } |
| 1183 | |
| 1184 | TEST_F(WebRtcVideoChannel2Test, DISABLED_OnReadyToSend) { |
| 1185 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1186 | } |
| 1187 | |
| 1188 | TEST_F(WebRtcVideoChannel2Test, DISABLED_CaptureFrameTimestampToNtpTimestamp) { |
| 1189 | FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1190 | } |
| 1191 | } // namespace cricket |