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

Side by Side Diff: webrtc/media/base/videoengine_unittest.h

Issue 2484193002: Expose RtpCodecParameters to VideoMediaInfo stats. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 416
417 cricket::VideoMediaInfo info; 417 cricket::VideoMediaInfo info;
418 EXPECT_TRUE(channel_->GetStats(&info)); 418 EXPECT_TRUE(channel_->GetStats(&info));
419 419
420 ASSERT_EQ(1U, info.senders.size()); 420 ASSERT_EQ(1U, info.senders.size());
421 // TODO(whyuan): bytes_sent and bytes_rcvd are different. Are both payload? 421 // TODO(whyuan): bytes_sent and bytes_rcvd are different. Are both payload?
422 // For webrtc, bytes_sent does not include the RTP header length. 422 // For webrtc, bytes_sent does not include the RTP header length.
423 EXPECT_GT(info.senders[0].bytes_sent, 0); 423 EXPECT_GT(info.senders[0].bytes_sent, 0);
424 EXPECT_EQ(NumRtpPackets(), info.senders[0].packets_sent); 424 EXPECT_EQ(NumRtpPackets(), info.senders[0].packets_sent);
425 EXPECT_EQ(0.0, info.senders[0].fraction_lost); 425 EXPECT_EQ(0.0, info.senders[0].fraction_lost);
426 EXPECT_TRUE(info.senders[0].codec_payload_type);
427 EXPECT_EQ(DefaultCodec().id, *info.senders[0].codec_payload_type);
Taylor Brandstetter 2016/11/08 23:55:44 nit: This will crash if codec_payload_type if null
hbos 2016/11/11 11:20:05 Done. Here and for receivers.
426 EXPECT_EQ(0, info.senders[0].firs_rcvd); 428 EXPECT_EQ(0, info.senders[0].firs_rcvd);
427 EXPECT_EQ(0, info.senders[0].plis_rcvd); 429 EXPECT_EQ(0, info.senders[0].plis_rcvd);
428 EXPECT_EQ(0, info.senders[0].nacks_rcvd); 430 EXPECT_EQ(0, info.senders[0].nacks_rcvd);
429 EXPECT_EQ(kVideoWidth, info.senders[0].send_frame_width); 431 EXPECT_EQ(kVideoWidth, info.senders[0].send_frame_width);
430 EXPECT_EQ(kVideoHeight, info.senders[0].send_frame_height); 432 EXPECT_EQ(kVideoHeight, info.senders[0].send_frame_height);
431 EXPECT_GT(info.senders[0].framerate_input, 0); 433 EXPECT_GT(info.senders[0].framerate_input, 0);
432 EXPECT_GT(info.senders[0].framerate_sent, 0); 434 EXPECT_GT(info.senders[0].framerate_sent, 0);
433 435
436 EXPECT_NE(info.send_codecs.end(), info.send_codecs.find(DefaultCodec().id));
437 EXPECT_EQ(DefaultCodec().ToCodecParameters(),
438 info.send_codecs[DefaultCodec().id]);
439
434 ASSERT_EQ(1U, info.receivers.size()); 440 ASSERT_EQ(1U, info.receivers.size());
435 EXPECT_EQ(1U, info.senders[0].ssrcs().size()); 441 EXPECT_EQ(1U, info.senders[0].ssrcs().size());
436 EXPECT_EQ(1U, info.receivers[0].ssrcs().size()); 442 EXPECT_EQ(1U, info.receivers[0].ssrcs().size());
437 EXPECT_EQ(info.senders[0].ssrcs()[0], info.receivers[0].ssrcs()[0]); 443 EXPECT_EQ(info.senders[0].ssrcs()[0], info.receivers[0].ssrcs()[0]);
444 EXPECT_TRUE(info.receivers[0].codec_payload_type);
445 EXPECT_EQ(DefaultCodec().id, *info.receivers[0].codec_payload_type);
438 EXPECT_EQ(NumRtpBytes(), info.receivers[0].bytes_rcvd); 446 EXPECT_EQ(NumRtpBytes(), info.receivers[0].bytes_rcvd);
439 EXPECT_EQ(NumRtpPackets(), info.receivers[0].packets_rcvd); 447 EXPECT_EQ(NumRtpPackets(), info.receivers[0].packets_rcvd);
440 EXPECT_EQ(0.0, info.receivers[0].fraction_lost); 448 EXPECT_EQ(0.0, info.receivers[0].fraction_lost);
441 EXPECT_EQ(0, info.receivers[0].packets_lost); 449 EXPECT_EQ(0, info.receivers[0].packets_lost);
442 // TODO(asapersson): Not set for webrtc. Handle missing stats. 450 // TODO(asapersson): Not set for webrtc. Handle missing stats.
443 // EXPECT_EQ(0, info.receivers[0].packets_concealed); 451 // EXPECT_EQ(0, info.receivers[0].packets_concealed);
444 EXPECT_EQ(0, info.receivers[0].firs_sent); 452 EXPECT_EQ(0, info.receivers[0].firs_sent);
445 EXPECT_EQ(0, info.receivers[0].plis_sent); 453 EXPECT_EQ(0, info.receivers[0].plis_sent);
446 EXPECT_EQ(0, info.receivers[0].nacks_sent); 454 EXPECT_EQ(0, info.receivers[0].nacks_sent);
447 EXPECT_EQ(kVideoWidth, info.receivers[0].frame_width); 455 EXPECT_EQ(kVideoWidth, info.receivers[0].frame_width);
448 EXPECT_EQ(kVideoHeight, info.receivers[0].frame_height); 456 EXPECT_EQ(kVideoHeight, info.receivers[0].frame_height);
449 EXPECT_GT(info.receivers[0].framerate_rcvd, 0); 457 EXPECT_GT(info.receivers[0].framerate_rcvd, 0);
450 EXPECT_GT(info.receivers[0].framerate_decoded, 0); 458 EXPECT_GT(info.receivers[0].framerate_decoded, 0);
451 EXPECT_GT(info.receivers[0].framerate_output, 0); 459 EXPECT_GT(info.receivers[0].framerate_output, 0);
460
461 EXPECT_NE(info.receive_codecs.end(),
462 info.receive_codecs.find(DefaultCodec().id));
463 EXPECT_EQ(DefaultCodec().ToCodecParameters(),
464 info.receive_codecs[DefaultCodec().id]);
452 } 465 }
453 466
454 cricket::VideoSenderInfo GetSenderStats(size_t i) { 467 cricket::VideoSenderInfo GetSenderStats(size_t i) {
455 cricket::VideoMediaInfo info; 468 cricket::VideoMediaInfo info;
456 EXPECT_TRUE(channel_->GetStats(&info)); 469 EXPECT_TRUE(channel_->GetStats(&info));
457 return info.senders[i]; 470 return info.senders[i];
458 } 471 }
459 472
460 cricket::VideoReceiverInfo GetReceiverStats(size_t i) { 473 cricket::VideoReceiverInfo GetReceiverStats(size_t i) {
461 cricket::VideoMediaInfo info; 474 cricket::VideoMediaInfo info;
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 std::unique_ptr<C> channel_; 940 std::unique_ptr<C> channel_;
928 cricket::FakeNetworkInterface network_interface_; 941 cricket::FakeNetworkInterface network_interface_;
929 cricket::FakeVideoRenderer renderer_; 942 cricket::FakeVideoRenderer renderer_;
930 cricket::VideoMediaChannel::Error media_error_; 943 cricket::VideoMediaChannel::Error media_error_;
931 944
932 // Used by test cases where 2 streams are run on the same channel. 945 // Used by test cases where 2 streams are run on the same channel.
933 cricket::FakeVideoRenderer renderer2_; 946 cricket::FakeVideoRenderer renderer2_;
934 }; 947 };
935 948
936 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT 949 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698