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 <algorithm> // max | 10 #include <algorithm> // max |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 } | 1043 } |
1044 | 1044 |
1045 private: | 1045 private: |
1046 virtual Action OnSendRtp(const uint8_t* packet, size_t length) { | 1046 virtual Action OnSendRtp(const uint8_t* packet, size_t length) { |
1047 if (RtpHeaderParser::IsRtcp(packet, length)) | 1047 if (RtpHeaderParser::IsRtcp(packet, length)) |
1048 return DROP_PACKET; | 1048 return DROP_PACKET; |
1049 | 1049 |
1050 RTPHeader header; | 1050 RTPHeader header; |
1051 if (!parser_->Parse(packet, length, &header)) | 1051 if (!parser_->Parse(packet, length, &header)) |
1052 return DROP_PACKET; | 1052 return DROP_PACKET; |
1053 RTC_DCHECK(stream_ != nullptr); | 1053 RTC_DCHECK(stream_); |
1054 VideoSendStream::Stats stats = stream_->GetStats(); | 1054 VideoSendStream::Stats stats = stream_->GetStats(); |
1055 if (!stats.substreams.empty()) { | 1055 if (!stats.substreams.empty()) { |
1056 EXPECT_EQ(1u, stats.substreams.size()); | 1056 EXPECT_EQ(1u, stats.substreams.size()); |
1057 int total_bitrate_bps = | 1057 int total_bitrate_bps = |
1058 stats.substreams.begin()->second.total_bitrate_bps; | 1058 stats.substreams.begin()->second.total_bitrate_bps; |
1059 test::PrintResult("bitrate_stats_", | 1059 test::PrintResult("bitrate_stats_", |
1060 "min_transmit_bitrate_low_remb", | 1060 "min_transmit_bitrate_low_remb", |
1061 "bitrate_bps", | 1061 "bitrate_bps", |
1062 static_cast<size_t>(total_bitrate_bps), | 1062 static_cast<size_t>(total_bitrate_bps), |
1063 "bps", | 1063 "bps", |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 video_send_stream_->Stop(); | 1238 video_send_stream_->Stop(); |
1239 | 1239 |
1240 // Test if the input and output frames are the same. render_time_ms and | 1240 // Test if the input and output frames are the same. render_time_ms and |
1241 // timestamp are not compared because capturer sets those values. | 1241 // timestamp are not compared because capturer sets those values. |
1242 ExpectEqualFramesVector(input_frames, observer.output_frames()); | 1242 ExpectEqualFramesVector(input_frames, observer.output_frames()); |
1243 | 1243 |
1244 DestroyStreams(); | 1244 DestroyStreams(); |
1245 } | 1245 } |
1246 | 1246 |
1247 void ExpectEqualFrames(const VideoFrame& frame1, const VideoFrame& frame2) { | 1247 void ExpectEqualFrames(const VideoFrame& frame1, const VideoFrame& frame2) { |
1248 if (frame1.native_handle() != nullptr || frame2.native_handle() != nullptr) | 1248 if (frame1.native_handle() || frame2.native_handle()) |
1249 ExpectEqualTextureFrames(frame1, frame2); | 1249 ExpectEqualTextureFrames(frame1, frame2); |
1250 else | 1250 else |
1251 ExpectEqualBufferFrames(frame1, frame2); | 1251 ExpectEqualBufferFrames(frame1, frame2); |
1252 } | 1252 } |
1253 | 1253 |
1254 void ExpectEqualTextureFrames(const VideoFrame& frame1, | 1254 void ExpectEqualTextureFrames(const VideoFrame& frame1, |
1255 const VideoFrame& frame2) { | 1255 const VideoFrame& frame2) { |
1256 EXPECT_EQ(frame1.native_handle(), frame2.native_handle()); | 1256 EXPECT_EQ(frame1.native_handle(), frame2.native_handle()); |
1257 EXPECT_EQ(frame1.width(), frame2.width()); | 1257 EXPECT_EQ(frame1.width(), frame2.width()); |
1258 EXPECT_EQ(frame1.height(), frame2.height()); | 1258 EXPECT_EQ(frame1.height(), frame2.height()); |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 uint8_t buffer[16] = {0}; | 1852 uint8_t buffer[16] = {0}; |
1853 EncodedImage encoded(buffer, sizeof(buffer), sizeof(buffer)); | 1853 EncodedImage encoded(buffer, sizeof(buffer), sizeof(buffer)); |
1854 encoded._timeStamp = input_image.timestamp(); | 1854 encoded._timeStamp = input_image.timestamp(); |
1855 encoded.capture_time_ms_ = input_image.render_time_ms(); | 1855 encoded.capture_time_ms_ = input_image.render_time_ms(); |
1856 | 1856 |
1857 for (size_t i = 0; i < kNumStreams; ++i) { | 1857 for (size_t i = 0; i < kNumStreams; ++i) { |
1858 specifics.codecSpecific.generic.simulcast_idx = static_cast<uint8_t>(i); | 1858 specifics.codecSpecific.generic.simulcast_idx = static_cast<uint8_t>(i); |
1859 encoded._frameType = (*frame_types)[i]; | 1859 encoded._frameType = (*frame_types)[i]; |
1860 encoded._encodedWidth = kEncodedResolution[i].width; | 1860 encoded._encodedWidth = kEncodedResolution[i].width; |
1861 encoded._encodedHeight = kEncodedResolution[i].height; | 1861 encoded._encodedHeight = kEncodedResolution[i].height; |
1862 RTC_DCHECK(callback_ != nullptr); | 1862 RTC_DCHECK(callback_); |
1863 if (callback_->Encoded(encoded, &specifics, nullptr) != 0) | 1863 if (callback_->Encoded(encoded, &specifics, nullptr) != 0) |
1864 return -1; | 1864 return -1; |
1865 } | 1865 } |
1866 | 1866 |
1867 observation_complete_.Set(); | 1867 observation_complete_.Set(); |
1868 return 0; | 1868 return 0; |
1869 } | 1869 } |
1870 void ModifyVideoConfigs( | 1870 void ModifyVideoConfigs( |
1871 VideoSendStream::Config* send_config, | 1871 VideoSendStream::Config* send_config, |
1872 std::vector<VideoReceiveStream::Config>* receive_configs, | 1872 std::vector<VideoReceiveStream::Config>* receive_configs, |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 observation_complete_.Set(); | 2312 observation_complete_.Set(); |
2313 } | 2313 } |
2314 } | 2314 } |
2315 } test; | 2315 } test; |
2316 | 2316 |
2317 RunBaseTest(&test); | 2317 RunBaseTest(&test); |
2318 } | 2318 } |
2319 #endif | 2319 #endif |
2320 | 2320 |
2321 } // namespace webrtc | 2321 } // namespace webrtc |
OLD | NEW |