OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 | 10 |
11 #include <math.h> | 11 #include <math.h> |
12 | 12 |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 15 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
16 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" | 16 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" |
17 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" | 17 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" |
18 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 18 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
19 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 19 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
20 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" | 20 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" |
21 #include "webrtc/modules/video_coding/include/video_coding.h" | 21 #include "webrtc/modules/video_coding/include/video_coding.h" |
22 #include "webrtc/test/testsupport/fileutils.h" | 22 #include "webrtc/test/testsupport/fileutils.h" |
23 #include "webrtc/test/testsupport/frame_reader.h" | 23 #include "webrtc/test/testsupport/frame_reader.h" |
24 #include "webrtc/test/testsupport/frame_writer.h" | 24 #include "webrtc/test/testsupport/frame_writer.h" |
25 #include "webrtc/test/testsupport/gtest_disable.h" | |
26 #include "webrtc/test/testsupport/metrics/video_metrics.h" | 25 #include "webrtc/test/testsupport/metrics/video_metrics.h" |
27 #include "webrtc/test/testsupport/packet_reader.h" | 26 #include "webrtc/test/testsupport/packet_reader.h" |
28 #include "webrtc/typedefs.h" | 27 #include "webrtc/typedefs.h" |
29 | 28 |
30 namespace webrtc { | 29 namespace webrtc { |
31 | 30 |
32 // Maximum number of rate updates (i.e., calls to encoder to change bitrate | 31 // Maximum number of rate updates (i.e., calls to encoder to change bitrate |
33 // and/or frame rate) for the current tests. | 32 // and/or frame rate) for the current tests. |
34 const int kMaxNumRateUpdates = 3; | 33 const int kMaxNumRateUpdates = 3; |
35 | 34 |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 // |cpu_speed| <= ~6. A number of settings would need to be significantly | 807 // |cpu_speed| <= ~6. A number of settings would need to be significantly |
809 // modified for the |cpu_speed| = 12 case. For now, keep the tests below | 808 // modified for the |cpu_speed| = 12 case. For now, keep the tests below |
810 // disabled on Android. Some quality parameter in the above test has been | 809 // disabled on Android. Some quality parameter in the above test has been |
811 // adjusted to also pass for |cpu_speed| <= 12. | 810 // adjusted to also pass for |cpu_speed| <= 12. |
812 | 811 |
813 // VP8: Run with no packet loss, with varying bitrate (3 rate updates): | 812 // VP8: Run with no packet loss, with varying bitrate (3 rate updates): |
814 // low to high to medium. Check that quality and encoder response to the new | 813 // low to high to medium. Check that quality and encoder response to the new |
815 // target rate/per-frame bandwidth (for each rate update) is within limits. | 814 // target rate/per-frame bandwidth (for each rate update) is within limits. |
816 // One key frame (first frame only) in sequence. | 815 // One key frame (first frame only) in sequence. |
817 TEST_F(VideoProcessorIntegrationTest, | 816 TEST_F(VideoProcessorIntegrationTest, |
818 DISABLED_ON_ANDROID(ProcessNoLossChangeBitRateVP8)) { | 817 #if defined(WEBRTC_ANDROID) |
kjellander_webrtc
2016/01/04 12:52:45
Please use the MAYBE_ pattern as described on http
pbos-webrtc
2016/01/04 13:01:27
Inlined TEST_F instead for readability (imo)
kjellander_webrtc
2016/01/04 14:59:06
I don't like us having different ways of doing thi
pbos-webrtc
2016/01/04 16:11:42
Done.
| |
818 DISABLED_ProcessNoLossChangeBitRateVP8) { | |
819 #else | |
820 ProcessNoLossChangeBitRateVP8) { | |
821 #endif | |
819 // Bitrate and frame rate profile. | 822 // Bitrate and frame rate profile. |
820 RateProfile rate_profile; | 823 RateProfile rate_profile; |
821 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 824 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); |
822 SetRateProfilePars(&rate_profile, 1, 800, 30, 100); | 825 SetRateProfilePars(&rate_profile, 1, 800, 30, 100); |
823 SetRateProfilePars(&rate_profile, 2, 500, 30, 200); | 826 SetRateProfilePars(&rate_profile, 2, 500, 30, 200); |
824 rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1; | 827 rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1; |
825 rate_profile.num_frames = kNbrFramesLong; | 828 rate_profile.num_frames = kNbrFramesLong; |
826 // Codec/network settings. | 829 // Codec/network settings. |
827 CodecConfigPars process_settings; | 830 CodecConfigPars process_settings; |
828 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, | 831 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, |
(...skipping 11 matching lines...) Expand all Loading... | |
840 } | 843 } |
841 | 844 |
842 // VP8: Run with no packet loss, with an update (decrease) in frame rate. | 845 // VP8: Run with no packet loss, with an update (decrease) in frame rate. |
843 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. | 846 // Lower frame rate means higher per-frame-bandwidth, so easier to encode. |
844 // At the bitrate in this test, this means better rate control after the | 847 // At the bitrate in this test, this means better rate control after the |
845 // update(s) to lower frame rate. So expect less frame drops, and max values | 848 // update(s) to lower frame rate. So expect less frame drops, and max values |
846 // for the rate control metrics can be lower. One key frame (first frame only). | 849 // for the rate control metrics can be lower. One key frame (first frame only). |
847 // Note: quality after update should be higher but we currently compute quality | 850 // Note: quality after update should be higher but we currently compute quality |
848 // metrics averaged over whole sequence run. | 851 // metrics averaged over whole sequence run. |
849 TEST_F(VideoProcessorIntegrationTest, | 852 TEST_F(VideoProcessorIntegrationTest, |
850 DISABLED_ON_ANDROID(ProcessNoLossChangeFrameRateFrameDropVP8)) { | 853 #if defined(WEBRTC_ANDROID) |
854 DISABLED_ProcessNoLossChangeFrameRateFrameDropVP8) { | |
855 #else | |
856 ProcessNoLossChangeFrameRateFrameDropVP8) { | |
857 #endif | |
851 config_.networking_config.packet_loss_probability = 0; | 858 config_.networking_config.packet_loss_probability = 0; |
852 // Bitrate and frame rate profile. | 859 // Bitrate and frame rate profile. |
853 RateProfile rate_profile; | 860 RateProfile rate_profile; |
854 SetRateProfilePars(&rate_profile, 0, 80, 24, 0); | 861 SetRateProfilePars(&rate_profile, 0, 80, 24, 0); |
855 SetRateProfilePars(&rate_profile, 1, 80, 15, 100); | 862 SetRateProfilePars(&rate_profile, 1, 80, 15, 100); |
856 SetRateProfilePars(&rate_profile, 2, 80, 10, 200); | 863 SetRateProfilePars(&rate_profile, 2, 80, 10, 200); |
857 rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1; | 864 rate_profile.frame_index_rate_update[3] = kNbrFramesLong + 1; |
858 rate_profile.num_frames = kNbrFramesLong; | 865 rate_profile.num_frames = kNbrFramesLong; |
859 // Codec/network settings. | 866 // Codec/network settings. |
860 CodecConfigPars process_settings; | 867 CodecConfigPars process_settings; |
861 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, | 868 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, |
862 true, true, false); | 869 true, true, false); |
863 // Metrics for expected quality. | 870 // Metrics for expected quality. |
864 QualityMetrics quality_metrics; | 871 QualityMetrics quality_metrics; |
865 SetQualityMetrics(&quality_metrics, 31.0, 22.0, 0.80, 0.65); | 872 SetQualityMetrics(&quality_metrics, 31.0, 22.0, 0.80, 0.65); |
866 // Metrics for rate control. | 873 // Metrics for rate control. |
867 RateControlMetrics rc_metrics[3]; | 874 RateControlMetrics rc_metrics[3]; |
868 SetRateControlMetrics(rc_metrics, 0, 40, 20, 75, 15, 60, 0, 1); | 875 SetRateControlMetrics(rc_metrics, 0, 40, 20, 75, 15, 60, 0, 1); |
869 SetRateControlMetrics(rc_metrics, 1, 10, 0, 25, 10, 35, 0, 0); | 876 SetRateControlMetrics(rc_metrics, 1, 10, 0, 25, 10, 35, 0, 0); |
870 SetRateControlMetrics(rc_metrics, 2, 0, 0, 20, 10, 15, 0, 0); | 877 SetRateControlMetrics(rc_metrics, 2, 0, 0, 20, 10, 15, 0, 0); |
871 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 878 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, |
872 rc_metrics); | 879 rc_metrics); |
873 } | 880 } |
874 | 881 |
875 // Run with no packet loss, at low bitrate. During this time we should've | 882 // Run with no packet loss, at low bitrate. During this time we should've |
876 // resized once. Expect 2 key frames generated (first and one for resize). | 883 // resized once. Expect 2 key frames generated (first and one for resize). |
877 TEST_F(VideoProcessorIntegrationTest, | 884 TEST_F(VideoProcessorIntegrationTest, |
878 DISABLED_ON_ANDROID(ProcessNoLossSpatialResizeFrameDropVP8)) { | 885 #if defined(WEBRTC_ANDROID) |
886 DISABLED_ProcessNoLossSpatialResizeFrameDropVP8) { | |
887 #else | |
888 ProcessNoLossSpatialResizeFrameDropVP8) { | |
889 #endif | |
879 config_.networking_config.packet_loss_probability = 0; | 890 config_.networking_config.packet_loss_probability = 0; |
880 // Bitrate and frame rate profile. | 891 // Bitrate and frame rate profile. |
881 RateProfile rate_profile; | 892 RateProfile rate_profile; |
882 SetRateProfilePars(&rate_profile, 0, 50, 30, 0); | 893 SetRateProfilePars(&rate_profile, 0, 50, 30, 0); |
883 rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; | 894 rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; |
884 rate_profile.num_frames = kNbrFramesLong; | 895 rate_profile.num_frames = kNbrFramesLong; |
885 // Codec/network settings. | 896 // Codec/network settings. |
886 CodecConfigPars process_settings; | 897 CodecConfigPars process_settings; |
887 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, | 898 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 1, false, |
888 true, true, true); | 899 true, true, true); |
889 // Metrics for expected quality. | 900 // Metrics for expected quality. |
890 QualityMetrics quality_metrics; | 901 QualityMetrics quality_metrics; |
891 SetQualityMetrics(&quality_metrics, 25.0, 15.0, 0.70, 0.40); | 902 SetQualityMetrics(&quality_metrics, 25.0, 15.0, 0.70, 0.40); |
892 // Metrics for rate control. | 903 // Metrics for rate control. |
893 RateControlMetrics rc_metrics[1]; | 904 RateControlMetrics rc_metrics[1]; |
894 SetRateControlMetrics(rc_metrics, 0, 160, 60, 120, 20, 70, 1, 2); | 905 SetRateControlMetrics(rc_metrics, 0, 160, 60, 120, 20, 70, 1, 2); |
895 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 906 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, |
896 rc_metrics); | 907 rc_metrics); |
897 } | 908 } |
898 | 909 |
899 // VP8: Run with no packet loss, with 3 temporal layers, with a rate update in | 910 // VP8: Run with no packet loss, with 3 temporal layers, with a rate update in |
900 // the middle of the sequence. The max values for the frame size mismatch and | 911 // the middle of the sequence. The max values for the frame size mismatch and |
901 // encoding rate mismatch are applied to each layer. | 912 // encoding rate mismatch are applied to each layer. |
902 // No dropped frames in this test, and internal spatial resizer is off. | 913 // No dropped frames in this test, and internal spatial resizer is off. |
903 // One key frame (first frame only) in sequence, so no spatial resizing. | 914 // One key frame (first frame only) in sequence, so no spatial resizing. |
904 TEST_F(VideoProcessorIntegrationTest, | 915 TEST_F(VideoProcessorIntegrationTest, |
905 DISABLED_ON_ANDROID(ProcessNoLossTemporalLayersVP8)) { | 916 #if defined(WEBRTC_ANDROID) |
917 DISABLED_ProcessNoLossTemporalLayersVP8) { | |
918 #else | |
919 ProcessNoLossTemporalLayersVP8) { | |
920 #endif | |
906 config_.networking_config.packet_loss_probability = 0; | 921 config_.networking_config.packet_loss_probability = 0; |
907 // Bitrate and frame rate profile. | 922 // Bitrate and frame rate profile. |
908 RateProfile rate_profile; | 923 RateProfile rate_profile; |
909 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); | 924 SetRateProfilePars(&rate_profile, 0, 200, 30, 0); |
910 SetRateProfilePars(&rate_profile, 1, 400, 30, 150); | 925 SetRateProfilePars(&rate_profile, 1, 400, 30, 150); |
911 rate_profile.frame_index_rate_update[2] = kNbrFramesLong + 1; | 926 rate_profile.frame_index_rate_update[2] = kNbrFramesLong + 1; |
912 rate_profile.num_frames = kNbrFramesLong; | 927 rate_profile.num_frames = kNbrFramesLong; |
913 // Codec/network settings. | 928 // Codec/network settings. |
914 CodecConfigPars process_settings; | 929 CodecConfigPars process_settings; |
915 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 3, false, | 930 SetCodecParameters(&process_settings, kVideoCodecVP8, 0.0f, -1, 3, false, |
916 true, true, false); | 931 true, true, false); |
917 // Metrics for expected quality. | 932 // Metrics for expected quality. |
918 QualityMetrics quality_metrics; | 933 QualityMetrics quality_metrics; |
919 SetQualityMetrics(&quality_metrics, 32.5, 30.0, 0.85, 0.80); | 934 SetQualityMetrics(&quality_metrics, 32.5, 30.0, 0.85, 0.80); |
920 // Metrics for rate control. | 935 // Metrics for rate control. |
921 RateControlMetrics rc_metrics[2]; | 936 RateControlMetrics rc_metrics[2]; |
922 SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0, 1); | 937 SetRateControlMetrics(rc_metrics, 0, 0, 20, 30, 10, 10, 0, 1); |
923 SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0, 0); | 938 SetRateControlMetrics(rc_metrics, 1, 0, 0, 30, 15, 10, 0, 0); |
924 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, | 939 ProcessFramesAndVerify(quality_metrics, rate_profile, process_settings, |
925 rc_metrics); | 940 rc_metrics); |
926 } | 941 } |
927 } // namespace webrtc | 942 } // namespace webrtc |
OLD | NEW |