Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 1498053002: Add test for verifying configured key frame interval for VP9. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> // max 10 #include <algorithm> // max
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 protected: 1897 protected:
1898 bool ContinuousPictureId(const RTPVideoHeaderVP9& vp9) const { 1898 bool ContinuousPictureId(const RTPVideoHeaderVP9& vp9) const {
1899 if (last_vp9_.picture_id > vp9.picture_id) { 1899 if (last_vp9_.picture_id > vp9.picture_id) {
1900 return vp9.picture_id == 0; // Wrap. 1900 return vp9.picture_id == 0; // Wrap.
1901 } else { 1901 } else {
1902 return vp9.picture_id == last_vp9_.picture_id + 1; 1902 return vp9.picture_id == last_vp9_.picture_id + 1;
1903 } 1903 }
1904 } 1904 }
1905 1905
1906 void VerifySpatialIdxWithinFrame(const RTPVideoHeaderVP9& vp9) const { 1906 void VerifySpatialIdxWithinFrame(const RTPVideoHeaderVP9& vp9) const {
1907 if (frames_sent_ == 0)
1908 return;
1909
1910 bool new_layer = vp9.spatial_idx != last_vp9_.spatial_idx; 1907 bool new_layer = vp9.spatial_idx != last_vp9_.spatial_idx;
1911 EXPECT_EQ(new_layer, vp9.beginning_of_frame); 1908 EXPECT_EQ(new_layer, vp9.beginning_of_frame);
1912 EXPECT_EQ(new_layer, last_vp9_.end_of_frame); 1909 EXPECT_EQ(new_layer, last_vp9_.end_of_frame);
1913 EXPECT_EQ(new_layer ? last_vp9_.spatial_idx + 1 : last_vp9_.spatial_idx, 1910 EXPECT_EQ(new_layer ? last_vp9_.spatial_idx + 1 : last_vp9_.spatial_idx,
1914 vp9.spatial_idx); 1911 vp9.spatial_idx);
1915 } 1912 }
1916 1913
1917 void VerifyFixedTemporalLayerStructure(const RTPVideoHeaderVP9& vp9, 1914 void VerifyFixedTemporalLayerStructure(const RTPVideoHeaderVP9& vp9,
1918 uint8_t num_layers) const { 1915 uint8_t num_layers) const {
1919 switch (num_layers) { 1916 switch (num_layers) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 vp9_settings_.keyFrameInterval = kKeyFrameInterval; 2150 vp9_settings_.keyFrameInterval = kKeyFrameInterval;
2154 vp9_settings_.numberOfTemporalLayers = num_temporal_layers_; 2151 vp9_settings_.numberOfTemporalLayers = num_temporal_layers_;
2155 vp9_settings_.numberOfSpatialLayers = num_spatial_layers_; 2152 vp9_settings_.numberOfSpatialLayers = num_spatial_layers_;
2156 } 2153 }
2157 2154
2158 void InspectHeader(const RTPVideoHeaderVP9& vp9) override { 2155 void InspectHeader(const RTPVideoHeaderVP9& vp9) override {
2159 bool ss_data_expected = !vp9.inter_pic_predicted && 2156 bool ss_data_expected = !vp9.inter_pic_predicted &&
2160 vp9.beginning_of_frame && vp9.spatial_idx == 0; 2157 vp9.beginning_of_frame && vp9.spatial_idx == 0;
2161 EXPECT_EQ(ss_data_expected, vp9.ss_data_available); 2158 EXPECT_EQ(ss_data_expected, vp9.ss_data_available);
2162 EXPECT_EQ(vp9.spatial_idx > 0, vp9.inter_layer_predicted); // D 2159 EXPECT_EQ(vp9.spatial_idx > 0, vp9.inter_layer_predicted); // D
2160 EXPECT_EQ(!vp9.inter_pic_predicted,
2161 frames_sent_ % kKeyFrameInterval == 0);
2163 2162
2164 if (IsNewPictureId(vp9)) { 2163 if (IsNewPictureId(vp9)) {
2165 EXPECT_EQ(0, vp9.spatial_idx); 2164 EXPECT_EQ(0, vp9.spatial_idx);
2166 EXPECT_EQ(num_spatial_layers_ - 1, last_vp9_.spatial_idx); 2165 EXPECT_EQ(num_spatial_layers_ - 1, last_vp9_.spatial_idx);
2167 } 2166 }
2168 2167
2169 VerifyFixedTemporalLayerStructure(vp9, 2168 VerifyFixedTemporalLayerStructure(vp9,
2170 l_field_ ? num_temporal_layers_ : 0); 2169 l_field_ ? num_temporal_layers_ : 0);
2171 2170
2172 if (frames_sent_ > kNumFramesToSend) 2171 if (frames_sent_ > kNumFramesToSend)
(...skipping 26 matching lines...) Expand all
2199 EXPECT_GT(vp9_header.num_ref_pics, 0u); 2198 EXPECT_GT(vp9_header.num_ref_pics, 0u);
2200 observation_complete_.Set(); 2199 observation_complete_.Set();
2201 } 2200 }
2202 } 2201 }
2203 } test; 2202 } test;
2204 2203
2205 RunBaseTest(&test, FakeNetworkPipe::Config()); 2204 RunBaseTest(&test, FakeNetworkPipe::Config());
2206 } 2205 }
2207 2206
2208 } // namespace webrtc 2207 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698