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