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

Side by Side Diff: talk/session/media/channel_unittest.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: google::int32 Created 5 years, 3 months 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 * libjingle 2 * libjingle
3 * Copyright 2009 Google Inc. 3 * Copyright 2009 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 using cricket::StreamParams; 60 using cricket::StreamParams;
61 using cricket::TransportChannel; 61 using cricket::TransportChannel;
62 using rtc::WindowId; 62 using rtc::WindowId;
63 63
64 static const cricket::AudioCodec kPcmuCodec(0, "PCMU", 64000, 8000, 1, 0); 64 static const cricket::AudioCodec kPcmuCodec(0, "PCMU", 64000, 8000, 1, 0);
65 static const cricket::AudioCodec kPcmaCodec(8, "PCMA", 64000, 8000, 1, 0); 65 static const cricket::AudioCodec kPcmaCodec(8, "PCMA", 64000, 8000, 1, 0);
66 static const cricket::AudioCodec kIsacCodec(103, "ISAC", 40000, 16000, 1, 0); 66 static const cricket::AudioCodec kIsacCodec(103, "ISAC", 40000, 16000, 1, 0);
67 static const cricket::VideoCodec kH264Codec(97, "H264", 640, 400, 30, 0); 67 static const cricket::VideoCodec kH264Codec(97, "H264", 640, 400, 30, 0);
68 static const cricket::VideoCodec kH264SvcCodec(99, "H264-SVC", 320, 200, 15, 0); 68 static const cricket::VideoCodec kH264SvcCodec(99, "H264-SVC", 320, 200, 15, 0);
69 static const cricket::DataCodec kGoogleDataCodec(101, "google-data", 0); 69 static const cricket::DataCodec kGoogleDataCodec(101, "google-data", 0);
70 static const uint32 kSsrc1 = 0x1111; 70 static const uint32_t kSsrc1 = 0x1111;
71 static const uint32 kSsrc2 = 0x2222; 71 static const uint32_t kSsrc2 = 0x2222;
72 static const uint32 kSsrc3 = 0x3333; 72 static const uint32_t kSsrc3 = 0x3333;
73 static const int kAudioPts[] = {0, 8}; 73 static const int kAudioPts[] = {0, 8};
74 static const int kVideoPts[] = {97, 99}; 74 static const int kVideoPts[] = {97, 99};
75 75
76 template<class ChannelT, 76 template<class ChannelT,
77 class MediaChannelT, 77 class MediaChannelT,
78 class ContentT, 78 class ContentT,
79 class CodecT, 79 class CodecT,
80 class MediaInfoT, 80 class MediaInfoT,
81 class OptionsT> 81 class OptionsT>
82 class Traits { 82 class Traits {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 rtc::Pathname(path), "wb"); 123 rtc::Pathname(path), "wb");
124 } 124 }
125 125
126 // Base class for Voice/VideoChannel tests 126 // Base class for Voice/VideoChannel tests
127 template<class T> 127 template<class T>
128 class ChannelTest : public testing::Test, public sigslot::has_slots<> { 128 class ChannelTest : public testing::Test, public sigslot::has_slots<> {
129 public: 129 public:
130 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, 130 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8,
131 DTLS = 0x10 }; 131 DTLS = 0x10 };
132 132
133 ChannelTest(const uint8* rtp_data, int rtp_len, 133 ChannelTest(const uint8_t* rtp_data,
134 const uint8* rtcp_data, int rtcp_len) 134 int rtp_len,
135 const uint8_t* rtcp_data,
136 int rtcp_len)
135 : session1_(true), 137 : session1_(true),
136 session2_(false), 138 session2_(false),
137 media_channel1_(NULL), 139 media_channel1_(NULL),
138 media_channel2_(NULL), 140 media_channel2_(NULL),
139 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), 141 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len),
140 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), 142 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len),
141 media_info_callbacks1_(), 143 media_info_callbacks1_(),
142 media_info_callbacks2_(), 144 media_info_callbacks2_(),
143 ssrc_(0), 145 ssrc_(0),
144 error_(T::MediaChannel::ERROR_NONE) { 146 error_(T::MediaChannel::ERROR_NONE) {}
145 }
146 147
147 void CreateChannels(int flags1, int flags2) { 148 void CreateChannels(int flags1, int flags2) {
148 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), 149 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()),
149 new typename T::MediaChannel(NULL, typename T::Options()), 150 new typename T::MediaChannel(NULL, typename T::Options()),
150 flags1, flags2, rtc::Thread::Current()); 151 flags1, flags2, rtc::Thread::Current());
151 } 152 }
152 void CreateChannels( 153 void CreateChannels(
153 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, 154 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2,
154 int flags1, int flags2, rtc::Thread* thread) { 155 int flags1, int flags2, rtc::Thread* thread) {
155 media_channel1_ = ch1; 156 media_channel1_ = ch1;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 304 }
304 bool SendRtcp1() { 305 bool SendRtcp1() {
305 return media_channel1_->SendRtcp(rtcp_packet_.c_str(), 306 return media_channel1_->SendRtcp(rtcp_packet_.c_str(),
306 static_cast<int>(rtcp_packet_.size())); 307 static_cast<int>(rtcp_packet_.size()));
307 } 308 }
308 bool SendRtcp2() { 309 bool SendRtcp2() {
309 return media_channel2_->SendRtcp(rtcp_packet_.c_str(), 310 return media_channel2_->SendRtcp(rtcp_packet_.c_str(),
310 static_cast<int>(rtcp_packet_.size())); 311 static_cast<int>(rtcp_packet_.size()));
311 } 312 }
312 // Methods to send custom data. 313 // Methods to send custom data.
313 bool SendCustomRtp1(uint32 ssrc, int sequence_number, int pl_type = -1) { 314 bool SendCustomRtp1(uint32_t ssrc, int sequence_number, int pl_type = -1) {
314 std::string data(CreateRtpData(ssrc, sequence_number, pl_type)); 315 std::string data(CreateRtpData(ssrc, sequence_number, pl_type));
315 return media_channel1_->SendRtp(data.c_str(), 316 return media_channel1_->SendRtp(data.c_str(),
316 static_cast<int>(data.size())); 317 static_cast<int>(data.size()));
317 } 318 }
318 bool SendCustomRtp2(uint32 ssrc, int sequence_number, int pl_type = -1) { 319 bool SendCustomRtp2(uint32_t ssrc, int sequence_number, int pl_type = -1) {
319 std::string data(CreateRtpData(ssrc, sequence_number, pl_type)); 320 std::string data(CreateRtpData(ssrc, sequence_number, pl_type));
320 return media_channel2_->SendRtp(data.c_str(), 321 return media_channel2_->SendRtp(data.c_str(),
321 static_cast<int>(data.size())); 322 static_cast<int>(data.size()));
322 } 323 }
323 bool SendCustomRtcp1(uint32 ssrc) { 324 bool SendCustomRtcp1(uint32_t ssrc) {
324 std::string data(CreateRtcpData(ssrc)); 325 std::string data(CreateRtcpData(ssrc));
325 return media_channel1_->SendRtcp(data.c_str(), 326 return media_channel1_->SendRtcp(data.c_str(),
326 static_cast<int>(data.size())); 327 static_cast<int>(data.size()));
327 } 328 }
328 bool SendCustomRtcp2(uint32 ssrc) { 329 bool SendCustomRtcp2(uint32_t ssrc) {
329 std::string data(CreateRtcpData(ssrc)); 330 std::string data(CreateRtcpData(ssrc));
330 return media_channel2_->SendRtcp(data.c_str(), 331 return media_channel2_->SendRtcp(data.c_str(),
331 static_cast<int>(data.size())); 332 static_cast<int>(data.size()));
332 } 333 }
333 bool CheckRtp1() { 334 bool CheckRtp1() {
334 return media_channel1_->CheckRtp(rtp_packet_.c_str(), 335 return media_channel1_->CheckRtp(rtp_packet_.c_str(),
335 static_cast<int>(rtp_packet_.size())); 336 static_cast<int>(rtp_packet_.size()));
336 } 337 }
337 bool CheckRtp2() { 338 bool CheckRtp2() {
338 return media_channel2_->CheckRtp(rtp_packet_.c_str(), 339 return media_channel2_->CheckRtp(rtp_packet_.c_str(),
339 static_cast<int>(rtp_packet_.size())); 340 static_cast<int>(rtp_packet_.size()));
340 } 341 }
341 bool CheckRtcp1() { 342 bool CheckRtcp1() {
342 return media_channel1_->CheckRtcp(rtcp_packet_.c_str(), 343 return media_channel1_->CheckRtcp(rtcp_packet_.c_str(),
343 static_cast<int>(rtcp_packet_.size())); 344 static_cast<int>(rtcp_packet_.size()));
344 } 345 }
345 bool CheckRtcp2() { 346 bool CheckRtcp2() {
346 return media_channel2_->CheckRtcp(rtcp_packet_.c_str(), 347 return media_channel2_->CheckRtcp(rtcp_packet_.c_str(),
347 static_cast<int>(rtcp_packet_.size())); 348 static_cast<int>(rtcp_packet_.size()));
348 } 349 }
349 // Methods to check custom data. 350 // Methods to check custom data.
350 bool CheckCustomRtp1(uint32 ssrc, int sequence_number, int pl_type = -1 ) { 351 bool CheckCustomRtp1(uint32_t ssrc, int sequence_number, int pl_type = -1) {
351 std::string data(CreateRtpData(ssrc, sequence_number, pl_type)); 352 std::string data(CreateRtpData(ssrc, sequence_number, pl_type));
352 return media_channel1_->CheckRtp(data.c_str(), 353 return media_channel1_->CheckRtp(data.c_str(),
353 static_cast<int>(data.size())); 354 static_cast<int>(data.size()));
354 } 355 }
355 bool CheckCustomRtp2(uint32 ssrc, int sequence_number, int pl_type = -1) { 356 bool CheckCustomRtp2(uint32_t ssrc, int sequence_number, int pl_type = -1) {
356 std::string data(CreateRtpData(ssrc, sequence_number, pl_type)); 357 std::string data(CreateRtpData(ssrc, sequence_number, pl_type));
357 return media_channel2_->CheckRtp(data.c_str(), 358 return media_channel2_->CheckRtp(data.c_str(),
358 static_cast<int>(data.size())); 359 static_cast<int>(data.size()));
359 } 360 }
360 bool CheckCustomRtcp1(uint32 ssrc) { 361 bool CheckCustomRtcp1(uint32_t ssrc) {
361 std::string data(CreateRtcpData(ssrc)); 362 std::string data(CreateRtcpData(ssrc));
362 return media_channel1_->CheckRtcp(data.c_str(), 363 return media_channel1_->CheckRtcp(data.c_str(),
363 static_cast<int>(data.size())); 364 static_cast<int>(data.size()));
364 } 365 }
365 bool CheckCustomRtcp2(uint32 ssrc) { 366 bool CheckCustomRtcp2(uint32_t ssrc) {
366 std::string data(CreateRtcpData(ssrc)); 367 std::string data(CreateRtcpData(ssrc));
367 return media_channel2_->CheckRtcp(data.c_str(), 368 return media_channel2_->CheckRtcp(data.c_str(),
368 static_cast<int>(data.size())); 369 static_cast<int>(data.size()));
369 } 370 }
370 std::string CreateRtpData(uint32 ssrc, int sequence_number, int pl_type) { 371 std::string CreateRtpData(uint32_t ssrc, int sequence_number, int pl_type) {
371 std::string data(rtp_packet_); 372 std::string data(rtp_packet_);
372 // Set SSRC in the rtp packet copy. 373 // Set SSRC in the rtp packet copy.
373 rtc::SetBE32(const_cast<char*>(data.c_str()) + 8, ssrc); 374 rtc::SetBE32(const_cast<char*>(data.c_str()) + 8, ssrc);
374 rtc::SetBE16(const_cast<char*>(data.c_str()) + 2, sequence_number); 375 rtc::SetBE16(const_cast<char*>(data.c_str()) + 2, sequence_number);
375 if (pl_type >= 0) { 376 if (pl_type >= 0) {
376 rtc::Set8(const_cast<char*>(data.c_str()), 1, 377 rtc::Set8(const_cast<char*>(data.c_str()), 1,
377 static_cast<uint8_t>(pl_type)); 378 static_cast<uint8_t>(pl_type));
378 } 379 }
379 return data; 380 return data;
380 } 381 }
381 std::string CreateRtcpData(uint32 ssrc) { 382 std::string CreateRtcpData(uint32_t ssrc) {
382 std::string data(rtcp_packet_); 383 std::string data(rtcp_packet_);
383 // Set SSRC in the rtcp packet copy. 384 // Set SSRC in the rtcp packet copy.
384 rtc::SetBE32(const_cast<char*>(data.c_str()) + 4, ssrc); 385 rtc::SetBE32(const_cast<char*>(data.c_str()) + 4, ssrc);
385 return data; 386 return data;
386 } 387 }
387 388
388 bool CheckNoRtp1() { 389 bool CheckNoRtp1() {
389 return media_channel1_->CheckNoRtp(); 390 return media_channel1_->CheckNoRtp();
390 } 391 }
391 bool CheckNoRtp2() { 392 bool CheckNoRtp2() {
(...skipping 12 matching lines...) Expand all
404 typename T::Content* content) { 405 typename T::Content* content) {
405 // overridden in specialized classes 406 // overridden in specialized classes
406 } 407 }
407 void CopyContent(const typename T::Content& source, 408 void CopyContent(const typename T::Content& source,
408 typename T::Content* content) { 409 typename T::Content* content) {
409 // overridden in specialized classes 410 // overridden in specialized classes
410 } 411 }
411 412
412 // Creates a cricket::SessionDescription with one MediaContent and one stream. 413 // Creates a cricket::SessionDescription with one MediaContent and one stream.
413 // kPcmuCodec is used as audio codec and kH264Codec is used as video codec. 414 // kPcmuCodec is used as audio codec and kH264Codec is used as video codec.
414 cricket::SessionDescription* CreateSessionDescriptionWithStream(uint32 ssrc) { 415 cricket::SessionDescription* CreateSessionDescriptionWithStream(
416 uint32_t ssrc) {
415 typename T::Content content; 417 typename T::Content content;
416 cricket::SessionDescription* sdesc = new cricket::SessionDescription(); 418 cricket::SessionDescription* sdesc = new cricket::SessionDescription();
417 CreateContent(SECURE, kPcmuCodec, kH264Codec, &content); 419 CreateContent(SECURE, kPcmuCodec, kH264Codec, &content);
418 AddLegacyStreamInContent(ssrc, 0, &content); 420 AddLegacyStreamInContent(ssrc, 0, &content);
419 sdesc->AddContent("DUMMY_CONTENT_NAME", 421 sdesc->AddContent("DUMMY_CONTENT_NAME",
420 cricket::NS_JINGLE_RTP, content.Copy()); 422 cricket::NS_JINGLE_RTP, content.Copy());
421 return sdesc; 423 return sdesc;
422 } 424 }
423 425
424 class CallThread : public rtc::SignalThread { 426 class CallThread : public rtc::SignalThread {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 void OnMediaMonitor(typename T::Channel* channel, 463 void OnMediaMonitor(typename T::Channel* channel,
462 const typename T::MediaInfo& info) { 464 const typename T::MediaInfo& info) {
463 if (channel == channel1_.get()) { 465 if (channel == channel1_.get()) {
464 media_info_callbacks1_++; 466 media_info_callbacks1_++;
465 } else if (channel == channel2_.get()) { 467 } else if (channel == channel2_.get()) {
466 media_info_callbacks2_++; 468 media_info_callbacks2_++;
467 } 469 }
468 } 470 }
469 471
470 void OnMediaChannelError(typename T::Channel* channel, 472 void OnMediaChannelError(typename T::Channel* channel,
471 uint32 ssrc, 473 uint32_t ssrc,
472 typename T::MediaChannel::Error error) { 474 typename T::MediaChannel::Error error) {
473 ssrc_ = ssrc; 475 ssrc_ = ssrc;
474 error_ = error; 476 error_ = error;
475 } 477 }
476 478
477 void AddLegacyStreamInContent(uint32 ssrc, int flags, 479 void AddLegacyStreamInContent(uint32_t ssrc,
478 typename T::Content* content) { 480 int flags,
481 typename T::Content* content) {
479 // Base implementation. 482 // Base implementation.
480 } 483 }
481 484
482 // Tests that can be used by derived classes. 485 // Tests that can be used by derived classes.
483 486
484 // Basic sanity check. 487 // Basic sanity check.
485 void TestInit() { 488 void TestInit() {
486 CreateChannels(0, 0); 489 CreateChannels(0, 0);
487 EXPECT_FALSE(channel1_->secure()); 490 EXPECT_FALSE(channel1_->secure());
488 EXPECT_FALSE(media_channel1_->sending()); 491 EXPECT_FALSE(media_channel1_->sending());
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 void SendBundleToBundle( 1382 void SendBundleToBundle(
1380 const int* pl_types, int len, bool rtcp_mux, bool secure) { 1383 const int* pl_types, int len, bool rtcp_mux, bool secure) {
1381 ASSERT_EQ(2, len); 1384 ASSERT_EQ(2, len);
1382 int sequence_number1_1 = 0, sequence_number2_2 = 0; 1385 int sequence_number1_1 = 0, sequence_number2_2 = 0;
1383 // Only pl_type1 was added to the bundle filter for both |channel1_| 1386 // Only pl_type1 was added to the bundle filter for both |channel1_|
1384 // and |channel2_|. 1387 // and |channel2_|.
1385 int pl_type1 = pl_types[0]; 1388 int pl_type1 = pl_types[0];
1386 int pl_type2 = pl_types[1]; 1389 int pl_type2 = pl_types[1];
1387 int flags = SSRC_MUX | RTCP; 1390 int flags = SSRC_MUX | RTCP;
1388 if (secure) flags |= SECURE; 1391 if (secure) flags |= SECURE;
1389 uint32 expected_channels = 2U; 1392 uint32_t expected_channels = 2U;
1390 if (rtcp_mux) { 1393 if (rtcp_mux) {
1391 flags |= RTCP_MUX; 1394 flags |= RTCP_MUX;
1392 expected_channels = 1U; 1395 expected_channels = 1U;
1393 } 1396 }
1394 CreateChannels(flags, flags); 1397 CreateChannels(flags, flags);
1395 EXPECT_TRUE(SendInitiate()); 1398 EXPECT_TRUE(SendInitiate());
1396 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1399 EXPECT_EQ(2U, GetTransport1()->channels().size());
1397 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); 1400 EXPECT_EQ(expected_channels, GetTransport2()->channels().size());
1398 EXPECT_TRUE(SendAccept()); 1401 EXPECT_TRUE(SendAccept());
1399 EXPECT_EQ(expected_channels, GetTransport1()->channels().size()); 1402 EXPECT_EQ(expected_channels, GetTransport1()->channels().size());
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 typename T::Content local_media_content1_; 1715 typename T::Content local_media_content1_;
1713 typename T::Content local_media_content2_; 1716 typename T::Content local_media_content2_;
1714 typename T::Content remote_media_content1_; 1717 typename T::Content remote_media_content1_;
1715 typename T::Content remote_media_content2_; 1718 typename T::Content remote_media_content2_;
1716 // The RTP and RTCP packets to send in the tests. 1719 // The RTP and RTCP packets to send in the tests.
1717 std::string rtp_packet_; 1720 std::string rtp_packet_;
1718 std::string rtcp_packet_; 1721 std::string rtcp_packet_;
1719 int media_info_callbacks1_; 1722 int media_info_callbacks1_;
1720 int media_info_callbacks2_; 1723 int media_info_callbacks2_;
1721 1724
1722 uint32 ssrc_; 1725 uint32_t ssrc_;
1723 typename T::MediaChannel::Error error_; 1726 typename T::MediaChannel::Error error_;
1724 }; 1727 };
1725 1728
1726 1729
1727 template<> 1730 template<>
1728 void ChannelTest<VoiceTraits>::CreateContent( 1731 void ChannelTest<VoiceTraits>::CreateContent(
1729 int flags, 1732 int flags,
1730 const cricket::AudioCodec& audio_codec, 1733 const cricket::AudioCodec& audio_codec,
1731 const cricket::VideoCodec& video_codec, 1734 const cricket::VideoCodec& video_codec,
1732 cricket::AudioContentDescription* audio) { 1735 cricket::AudioContentDescription* audio) {
(...skipping 13 matching lines...) Expand all
1746 *audio = source; 1749 *audio = source;
1747 } 1750 }
1748 1751
1749 template<> 1752 template<>
1750 bool ChannelTest<VoiceTraits>::CodecMatches(const cricket::AudioCodec& c1, 1753 bool ChannelTest<VoiceTraits>::CodecMatches(const cricket::AudioCodec& c1,
1751 const cricket::AudioCodec& c2) { 1754 const cricket::AudioCodec& c2) {
1752 return c1.name == c2.name && c1.clockrate == c2.clockrate && 1755 return c1.name == c2.name && c1.clockrate == c2.clockrate &&
1753 c1.bitrate == c2.bitrate && c1.channels == c2.channels; 1756 c1.bitrate == c2.bitrate && c1.channels == c2.channels;
1754 } 1757 }
1755 1758
1756 template<> 1759 template <>
1757 void ChannelTest<VoiceTraits>::AddLegacyStreamInContent( 1760 void ChannelTest<VoiceTraits>::AddLegacyStreamInContent(
1758 uint32 ssrc, int flags, cricket::AudioContentDescription* audio) { 1761 uint32_t ssrc,
1762 int flags,
1763 cricket::AudioContentDescription* audio) {
1759 audio->AddLegacyStream(ssrc); 1764 audio->AddLegacyStream(ssrc);
1760 } 1765 }
1761 1766
1762 class VoiceChannelTest 1767 class VoiceChannelTest
1763 : public ChannelTest<VoiceTraits> { 1768 : public ChannelTest<VoiceTraits> {
1764 public: 1769 public:
1765 typedef ChannelTest<VoiceTraits> Base; 1770 typedef ChannelTest<VoiceTraits> Base;
1766 VoiceChannelTest() : Base(kPcmuFrame, sizeof(kPcmuFrame), 1771 VoiceChannelTest() : Base(kPcmuFrame, sizeof(kPcmuFrame),
1767 kRtcpReport, sizeof(kRtcpReport)) {} 1772 kRtcpReport, sizeof(kRtcpReport)) {}
1768 }; 1773 };
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 *video = source; 1815 *video = source;
1811 } 1816 }
1812 1817
1813 template<> 1818 template<>
1814 bool ChannelTest<VideoTraits>::CodecMatches(const cricket::VideoCodec& c1, 1819 bool ChannelTest<VideoTraits>::CodecMatches(const cricket::VideoCodec& c1,
1815 const cricket::VideoCodec& c2) { 1820 const cricket::VideoCodec& c2) {
1816 return c1.name == c2.name && c1.width == c2.width && c1.height == c2.height && 1821 return c1.name == c2.name && c1.width == c2.width && c1.height == c2.height &&
1817 c1.framerate == c2.framerate; 1822 c1.framerate == c2.framerate;
1818 } 1823 }
1819 1824
1820 template<> 1825 template <>
1821 void ChannelTest<VideoTraits>::AddLegacyStreamInContent( 1826 void ChannelTest<VideoTraits>::AddLegacyStreamInContent(
1822 uint32 ssrc, int flags, cricket::VideoContentDescription* video) { 1827 uint32_t ssrc,
1828 int flags,
1829 cricket::VideoContentDescription* video) {
1823 video->AddLegacyStream(ssrc); 1830 video->AddLegacyStream(ssrc);
1824 } 1831 }
1825 1832
1826 class VideoChannelTest 1833 class VideoChannelTest
1827 : public ChannelTest<VideoTraits> { 1834 : public ChannelTest<VideoTraits> {
1828 public: 1835 public:
1829 typedef ChannelTest<VideoTraits> Base; 1836 typedef ChannelTest<VideoTraits> Base;
1830 VideoChannelTest() : Base(kH264Packet, sizeof(kH264Packet), 1837 VideoChannelTest() : Base(kH264Packet, sizeof(kH264Packet),
1831 kRtcpReport, sizeof(kRtcpReport)) {} 1838 kRtcpReport, sizeof(kRtcpReport)) {}
1832 }; 1839 };
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
2581 cricket::DataContentDescription* data) { 2588 cricket::DataContentDescription* data) {
2582 *data = source; 2589 *data = source;
2583 } 2590 }
2584 2591
2585 template<> 2592 template<>
2586 bool ChannelTest<DataTraits>::CodecMatches(const cricket::DataCodec& c1, 2593 bool ChannelTest<DataTraits>::CodecMatches(const cricket::DataCodec& c1,
2587 const cricket::DataCodec& c2) { 2594 const cricket::DataCodec& c2) {
2588 return c1.name == c2.name; 2595 return c1.name == c2.name;
2589 } 2596 }
2590 2597
2591 template<> 2598 template <>
2592 void ChannelTest<DataTraits>::AddLegacyStreamInContent( 2599 void ChannelTest<DataTraits>::AddLegacyStreamInContent(
2593 uint32 ssrc, int flags, cricket::DataContentDescription* data) { 2600 uint32_t ssrc,
2601 int flags,
2602 cricket::DataContentDescription* data) {
2594 data->AddLegacyStream(ssrc); 2603 data->AddLegacyStream(ssrc);
2595 } 2604 }
2596 2605
2597 TEST_F(DataChannelTest, TestInit) { 2606 TEST_F(DataChannelTest, TestInit) {
2598 Base::TestInit(); 2607 Base::TestInit();
2599 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); 2608 EXPECT_FALSE(media_channel1_->IsStreamMuted(0));
2600 } 2609 }
2601 2610
2602 TEST_F(DataChannelTest, TestSetContents) { 2611 TEST_F(DataChannelTest, TestSetContents) {
2603 Base::TestSetContents(); 2612 Base::TestSetContents();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2731 }; 2740 };
2732 rtc::Buffer payload(data, 3); 2741 rtc::Buffer payload(data, 3);
2733 cricket::SendDataResult result; 2742 cricket::SendDataResult result;
2734 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 2743 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
2735 EXPECT_EQ(params.ssrc, 2744 EXPECT_EQ(params.ssrc,
2736 media_channel1_->last_sent_data_params().ssrc); 2745 media_channel1_->last_sent_data_params().ssrc);
2737 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 2746 EXPECT_EQ("foo", media_channel1_->last_sent_data());
2738 } 2747 }
2739 2748
2740 // TODO(pthatcher): TestSetReceiver? 2749 // TODO(pthatcher): TestSetReceiver?
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698