OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/media/engine/internalencoderfactory.h" | 10 #include "webrtc/media/engine/internalencoderfactory.h" |
| 11 #include "webrtc/media/engine/simulcast_encoder_adapter.h" |
11 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" | 12 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" |
12 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" | |
13 #include "webrtc/modules/video_coding/sequence_number_util.h" | 13 #include "webrtc/modules/video_coding/sequence_number_util.h" |
14 #include "webrtc/test/call_test.h" | 14 #include "webrtc/test/call_test.h" |
15 | 15 |
16 namespace webrtc { | 16 namespace webrtc { |
17 | 17 |
18 const int kFrameMaxWidth = 1280; | 18 const int kFrameMaxWidth = 1280; |
19 const int kFrameMaxHeight = 720; | 19 const int kFrameMaxHeight = 720; |
20 const int kFrameRate = 30; | 20 const int kFrameRate = 30; |
21 const int kMaxSecondsLost = 5; | 21 const int kMaxSecondsLost = 5; |
22 const int kMaxFramesLost = kFrameRate * kMaxSecondsLost; | 22 const int kMaxFramesLost = kFrameRate * kMaxSecondsLost; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 TEST_F(PictureIdTest, PictureIdIncreasingAfterStreamCountChangeVp8) { | 285 TEST_F(PictureIdTest, PictureIdIncreasingAfterStreamCountChangeVp8) { |
286 std::unique_ptr<VideoEncoder> encoder(VP8Encoder::Create()); | 286 std::unique_ptr<VideoEncoder> encoder(VP8Encoder::Create()); |
287 // Make sure that that the picture id is not reset if the stream count goes | 287 // Make sure that that the picture id is not reset if the stream count goes |
288 // down and then up. | 288 // down and then up. |
289 std::vector<int> ssrc_counts = {3, 1, 3}; | 289 std::vector<int> ssrc_counts = {3, 1, 3}; |
290 SetupEncoder(encoder.get()); | 290 SetupEncoder(encoder.get()); |
291 TestPictureIdContinuousAfterReconfigure(ssrc_counts); | 291 TestPictureIdContinuousAfterReconfigure(ssrc_counts); |
292 } | 292 } |
293 | 293 |
294 class VideoEncoderFactoryAdapter : public webrtc::VideoEncoderFactory { | |
295 public: | |
296 explicit VideoEncoderFactoryAdapter( | |
297 cricket::WebRtcVideoEncoderFactory* factory) | |
298 : factory_(factory) {} | |
299 virtual ~VideoEncoderFactoryAdapter() {} | |
300 | |
301 // Implements webrtc::VideoEncoderFactory. | |
302 webrtc::VideoEncoder* Create() override { | |
303 return factory_->CreateVideoEncoder( | |
304 cricket::VideoCodec(cricket::kVp8CodecName)); | |
305 } | |
306 | |
307 void Destroy(webrtc::VideoEncoder* encoder) override { | |
308 return factory_->DestroyVideoEncoder(encoder); | |
309 } | |
310 | |
311 private: | |
312 cricket::WebRtcVideoEncoderFactory* const factory_; | |
313 }; | |
314 | |
315 TEST_F(PictureIdTest, | 294 TEST_F(PictureIdTest, |
316 PictureIdContinuousAfterReconfigureSimulcastEncoderAdapter) { | 295 PictureIdContinuousAfterReconfigureSimulcastEncoderAdapter) { |
317 cricket::InternalEncoderFactory internal_encoder_factory; | 296 cricket::InternalEncoderFactory internal_encoder_factory; |
318 SimulcastEncoderAdapter simulcast_encoder_adapter( | 297 SimulcastEncoderAdapter simulcast_encoder_adapter(&internal_encoder_factory); |
319 new VideoEncoderFactoryAdapter(&internal_encoder_factory)); | |
320 SetupEncoder(&simulcast_encoder_adapter); | 298 SetupEncoder(&simulcast_encoder_adapter); |
321 TestPictureIdContinuousAfterReconfigure({1, 3, 3, 1, 1}); | 299 TestPictureIdContinuousAfterReconfigure({1, 3, 3, 1, 1}); |
322 } | 300 } |
323 | 301 |
324 TEST_F(PictureIdTest, | 302 TEST_F(PictureIdTest, |
325 PictureIdIncreasingAfterRecreateStreamSimulcastEncoderAdapter) { | 303 PictureIdIncreasingAfterRecreateStreamSimulcastEncoderAdapter) { |
326 cricket::InternalEncoderFactory internal_encoder_factory; | 304 cricket::InternalEncoderFactory internal_encoder_factory; |
327 SimulcastEncoderAdapter simulcast_encoder_adapter( | 305 SimulcastEncoderAdapter simulcast_encoder_adapter(&internal_encoder_factory); |
328 new VideoEncoderFactoryAdapter(&internal_encoder_factory)); | |
329 SetupEncoder(&simulcast_encoder_adapter); | 306 SetupEncoder(&simulcast_encoder_adapter); |
330 TestPictureIdIncreaseAfterRecreateStreams({1, 3, 3, 1, 1}); | 307 TestPictureIdIncreaseAfterRecreateStreams({1, 3, 3, 1, 1}); |
331 } | 308 } |
332 | 309 |
333 // When using the simulcast encoder adapter, the picture id is randomly set | 310 // When using the simulcast encoder adapter, the picture id is randomly set |
334 // when the ssrc count is reduced and then increased. This means that we are | 311 // when the ssrc count is reduced and then increased. This means that we are |
335 // not spec compliant in that particular case. | 312 // not spec compliant in that particular case. |
336 TEST_F( | 313 TEST_F( |
337 PictureIdTest, | 314 PictureIdTest, |
338 DISABLED_PictureIdIncreasingAfterStreamCountChangeSimulcastEncoderAdapter) { | 315 DISABLED_PictureIdIncreasingAfterStreamCountChangeSimulcastEncoderAdapter) { |
339 cricket::InternalEncoderFactory internal_encoder_factory; | 316 cricket::InternalEncoderFactory internal_encoder_factory; |
340 SimulcastEncoderAdapter simulcast_encoder_adapter( | 317 SimulcastEncoderAdapter simulcast_encoder_adapter(&internal_encoder_factory); |
341 new VideoEncoderFactoryAdapter(&internal_encoder_factory)); | |
342 // Make sure that that the picture id is not reset if the stream count goes | 318 // Make sure that that the picture id is not reset if the stream count goes |
343 // down and then up. | 319 // down and then up. |
344 std::vector<int> ssrc_counts = {3, 1, 3}; | 320 std::vector<int> ssrc_counts = {3, 1, 3}; |
345 SetupEncoder(&simulcast_encoder_adapter); | 321 SetupEncoder(&simulcast_encoder_adapter); |
346 TestPictureIdContinuousAfterReconfigure(ssrc_counts); | 322 TestPictureIdContinuousAfterReconfigure(ssrc_counts); |
347 } | 323 } |
348 | 324 |
349 } // namespace webrtc | 325 } // namespace webrtc |
OLD | NEW |