• Home
  • Raw
  • Download

Lines Matching +full:video +full:- +full:codecs

4  *  Use of this source code is governed by a BSD-style license
13 // the media-related aspects of SDP.
147 auto result = pc_factory->CreatePeerConnectionOrError( in CreatePeerConnection()
154 observer->SetPeerConnectionInterface(pc.get()); in CreatePeerConnection()
157 wrapper->set_media_engine(media_engine_ptr); in CreatePeerConnection()
162 // track (but no video).
169 wrapper->AddAudioTrack("a"); in CreatePeerConnectionWithAudio()
173 // Accepts the same arguments as CreatePeerConnection and adds default video
181 wrapper->AddVideoTrack("v"); in CreatePeerConnectionWithVideo()
186 // and video tracks.
193 wrapper->AddAudioTrack("a"); in CreatePeerConnectionWithAudioVideo()
194 wrapper->AddVideoTrack("v"); in CreatePeerConnectionWithAudioVideo()
202 cricket::GetFirstMediaContent(sdesc->description(), media_type); in GetMediaContentDirection()
204 return content->media_description()->direction(); in GetMediaContentDirection()
239 callee->media_engine()->set_fail_create_channel(true); in TEST_P()
242 ASSERT_FALSE(callee->SetRemoteDescription(caller->CreateOffer(), &error)); in TEST_P()
250 caller->media_engine()->set_fail_create_channel(true); in TEST_P()
253 ASSERT_FALSE(caller->SetLocalDescription(caller->CreateOffer(), &error)); in TEST_P()
269 // video stream creates the appropriate send/recv streams in the underlying
278 caller->AddAudioTrack(kCallerAudioId); in TEST_P()
279 caller->AddVideoTrack(kCallerVideoId); in TEST_P()
282 callee->AddAudioTrack(kCalleeAudioId); in TEST_P()
283 callee->AddVideoTrack(kCalleeVideoId); in TEST_P()
285 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
287 caller->SetRemoteDescription(callee->CreateAnswerAndSetAsLocal())); in TEST_P()
289 auto* caller_voice = caller->media_engine()->GetVoiceChannel(0); in TEST_P()
290 EXPECT_THAT(GetIds(caller_voice->recv_streams()), in TEST_P()
292 EXPECT_THAT(GetIds(caller_voice->send_streams()), in TEST_P()
295 auto* caller_video = caller->media_engine()->GetVideoChannel(0); in TEST_P()
296 EXPECT_THAT(GetIds(caller_video->recv_streams()), in TEST_P()
298 EXPECT_THAT(GetIds(caller_video->send_streams()), in TEST_P()
301 auto* callee_voice = callee->media_engine()->GetVoiceChannel(0); in TEST_P()
302 EXPECT_THAT(GetIds(callee_voice->recv_streams()), in TEST_P()
304 EXPECT_THAT(GetIds(callee_voice->send_streams()), in TEST_P()
307 auto* callee_video = callee->media_engine()->GetVideoChannel(0); in TEST_P()
308 EXPECT_THAT(GetIds(callee_video->recv_streams()), in TEST_P()
310 EXPECT_THAT(GetIds(callee_video->send_streams()), in TEST_P()
323 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_F()
325 // Stop both audio and video transceivers on the caller. in TEST_F()
326 auto transceivers = caller->pc()->GetTransceivers(); in TEST_F()
328 transceivers[0]->StopInternal(); in TEST_F()
329 transceivers[1]->StopInternal(); in TEST_F()
331 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_F()
333 ASSERT_FALSE(callee->media_engine()->GetVoiceChannel(0)); in TEST_F()
334 ASSERT_FALSE(callee->media_engine()->GetVideoChannel(0)); in TEST_F()
342 auto caller_audio_track = caller->AddAudioTrack("a"); in TEST_F()
343 auto caller_video_track = caller->AddVideoTrack("v"); in TEST_F()
346 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_F()
349 caller->pc()->RemoveTrackOrError(caller_audio_track); in TEST_F()
350 caller->pc()->RemoveTrackOrError(caller_video_track); in TEST_F()
352 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_F()
354 auto callee_voice = callee->media_engine()->GetVoiceChannel(0); in TEST_F()
355 auto callee_video = callee->media_engine()->GetVideoChannel(0); in TEST_F()
356 EXPECT_EQ(1u, callee_voice->send_streams().size()); in TEST_F()
357 EXPECT_EQ(0u, callee_voice->recv_streams().size()); in TEST_F()
358 EXPECT_EQ(1u, callee_video->send_streams().size()); in TEST_F()
359 EXPECT_EQ(0u, callee_video->recv_streams().size()); in TEST_F()
366 auto caller_video_track = caller->AddVideoTrack("v"); in TEST_F()
369 auto offer = caller->CreateOffer(options); in TEST_F()
370 auto* description = cricket::GetFirstMediaContent(offer->description(), in TEST_F()
372 ->media_description(); in TEST_F()
373 ASSERT_EQ(1u, description->streams().size()); in TEST_F()
374 ASSERT_TRUE(description->streams()[0].get_ssrc_group("SIM")); in TEST_F()
375 EXPECT_EQ(3u, description->streams()[0].get_ssrc_group("SIM")->ssrcs.size()); in TEST_F()
378 caller->SetLocalDescription(std::move(offer)); in TEST_F()
379 auto senders = caller->pc()->GetSenders(); in TEST_F()
381 EXPECT_EQ(cricket::MediaType::MEDIA_TYPE_VIDEO, senders[0]->media_type()); in TEST_F()
382 EXPECT_EQ(3u, senders[0]->GetParameters().encodings.size()); in TEST_F()
389 caller->AddVideoTrack("v0"); in TEST_F()
390 auto offer = caller->CreateOffer(); in TEST_F()
392 auto callee_video_track = callee->AddVideoTrack("v1"); in TEST_F()
393 ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); in TEST_F()
396 auto answer = callee->CreateAnswer(options); in TEST_F()
397 auto* description = cricket::GetFirstMediaContent(answer->description(), in TEST_F()
399 ->media_description(); in TEST_F()
400 ASSERT_EQ(1u, description->streams().size()); in TEST_F()
401 ASSERT_TRUE(description->streams()[0].get_ssrc_group("SIM")); in TEST_F()
402 EXPECT_EQ(3u, description->streams()[0].get_ssrc_group("SIM")->ssrcs.size()); in TEST_F()
405 callee->SetLocalDescription(std::move(answer)); in TEST_F()
406 auto senders = callee->pc()->GetSenders(); in TEST_F()
408 EXPECT_EQ(cricket::MediaType::MEDIA_TYPE_VIDEO, senders[0]->media_type()); in TEST_F()
409 EXPECT_EQ(3u, senders[0]->GetParameters().encodings.size()); in TEST_F()
421 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_F()
423 // Stop both audio and video transceivers on the callee. in TEST_F()
424 auto transceivers = callee->pc()->GetTransceivers(); in TEST_F()
426 transceivers[0]->StopInternal(); in TEST_F()
427 transceivers[1]->StopInternal(); in TEST_F()
429 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_F()
431 EXPECT_FALSE(callee->media_engine()->GetVoiceChannel(0)); in TEST_F()
432 EXPECT_FALSE(callee->media_engine()->GetVideoChannel(0)); in TEST_F()
441 auto callee_audio_track = callee->AddAudioTrack("a"); in TEST_F()
442 auto callee_video_track = callee->AddVideoTrack("v"); in TEST_F()
444 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_F()
447 callee->pc()->RemoveTrackOrError(callee_audio_track); in TEST_F()
448 callee->pc()->RemoveTrackOrError(callee_video_track); in TEST_F()
450 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_F()
452 auto callee_voice = callee->media_engine()->GetVoiceChannel(0); in TEST_F()
453 auto callee_video = callee->media_engine()->GetVideoChannel(0); in TEST_F()
454 EXPECT_EQ(0u, callee_voice->send_streams().size()); in TEST_F()
455 EXPECT_EQ(1u, callee_voice->recv_streams().size()); in TEST_F()
456 EXPECT_EQ(0u, callee_video->send_streams().size()); in TEST_F()
457 EXPECT_EQ(1u, callee_video->recv_streams().size()); in TEST_F()
466 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_P()
469 caller->AddAudioTrack("a2"); in TEST_P()
470 caller->AddVideoTrack("v2"); in TEST_P()
472 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); in TEST_P()
474 auto a1 = callee->media_engine()->GetVoiceChannel(0); in TEST_P()
475 auto a2 = callee->media_engine()->GetVoiceChannel(1); in TEST_P()
476 auto v1 = callee->media_engine()->GetVideoChannel(0); in TEST_P()
477 auto v2 = callee->media_engine()->GetVideoChannel(1); in TEST_P()
480 EXPECT_EQ(1u, a1->recv_streams().size()); in TEST_P()
482 EXPECT_EQ(1u, a2->recv_streams().size()); in TEST_P()
484 EXPECT_EQ(1u, v1->recv_streams().size()); in TEST_P()
486 EXPECT_EQ(1u, v2->recv_streams().size()); in TEST_P()
489 EXPECT_EQ(2u, a1->recv_streams().size()); in TEST_P()
492 EXPECT_EQ(2u, v1->recv_streams().size()); in TEST_P()
510 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get(), offer_options, in TEST_P()
514 callee->AddAudioTrack("a2"); in TEST_P()
515 callee->AddVideoTrack("v2"); in TEST_P()
517 ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get(), offer_options, in TEST_P()
520 auto callee_voice = callee->media_engine()->GetVoiceChannel(0); in TEST_P()
522 auto callee_video = callee->media_engine()->GetVideoChannel(0); in TEST_P()
526 EXPECT_EQ(1u, callee_voice->send_streams().size()); in TEST_P()
527 EXPECT_EQ(1u, callee_video->send_streams().size()); in TEST_P()
529 EXPECT_EQ(2u, callee_voice->send_streams().size()); in TEST_P()
530 EXPECT_EQ(2u, callee_video->send_streams().size()); in TEST_P()
540 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
541 auto answer = callee->CreateAnswer(); in TEST_P()
544 cricket::GetFirstAudioContent(answer->description()); in TEST_P()
546 EXPECT_FALSE(audio_content->rejected); in TEST_P()
549 cricket::GetFirstVideoContent(answer->description()); in TEST_P()
551 EXPECT_FALSE(video_content->rejected); in TEST_P()
564 caller_fake_engine->SetVideoCodecs(fake_codecs); in TEST_P()
567 auto offer = caller->CreateOfferAndSetAsLocal(); in TEST_P()
569 cricket::GetFirstVideoContentDescription(offer->description()); in TEST_P()
570 for (const auto& codec : offer_description->codecs()) { in TEST_P()
576 // video payload when raw_packetization_for_video is true.
586 caller_fake_engine->SetVideoCodecs(fake_codecs); in TEST_P()
588 callee_fake_engine->SetVideoCodecs(fake_codecs); in TEST_P()
594 auto offer = caller->CreateOfferAndSetAsLocal(options); in TEST_P()
596 cricket::GetFirstVideoContentDescription(offer->description()); in TEST_P()
597 for (const auto& codec : offer_description->codecs()) { in TEST_P()
604 ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); in TEST_P()
605 auto answer = callee->CreateAnswerAndSetAsLocal(options); in TEST_P()
607 cricket::GetFirstVideoContentDescription(answer->description()); in TEST_P()
608 for (const auto& codec : answer_description->codecs()) { in TEST_P()
614 ASSERT_TRUE(caller->SetRemoteDescription(std::move(answer))); in TEST_P()
629 caller_fake_engine->SetVideoCodecs(fake_codecs); in TEST_P()
631 callee_fake_engine->SetVideoCodecs(fake_codecs); in TEST_P()
639 auto offer = caller->CreateOfferAndSetAsLocal(caller_options); in TEST_P()
642 ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); in TEST_P()
643 auto answer = callee->CreateAnswerAndSetAsLocal(callee_options); in TEST_P()
646 cricket::GetFirstVideoContentDescription(answer->description()); in TEST_P()
647 for (const auto& codec : answer_description->codecs()) { in TEST_P()
651 ASSERT_TRUE(caller->SetRemoteDescription(std::move(answer))); in TEST_P()
678 caller->AddAudioTrack("a"); in TEST_P()
683 auto offer = caller->CreateOffer(options); in TEST_P()
685 auto* content = cricket::GetFirstMediaContent(offer->description(), in TEST_P()
690 EXPECT_EQ(expected_direction_, content->media_description()->direction()); in TEST_P()
701 Values(std::make_tuple(false, -1, RtpTransceiverDirection::kInactive),
704 std::make_tuple(true, -1, RtpTransceiverDirection::kSendRecv),
737 caller->AddAudioTrack("a"); in TEST_P()
740 auto offer = caller->CreateOffer(); in TEST_P()
741 cricket::GetFirstAudioContentDescription(offer->description()) in TEST_P()
742 ->set_direction(offer_direction_); in TEST_P()
746 callee->AddAudioTrack("a"); in TEST_P()
748 ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); in TEST_P()
753 auto answer = callee->CreateAnswer(options); in TEST_P()
787 caller->AddAudioTrack("a"); in TEST_P()
790 auto offer = caller->CreateOffer(); in TEST_P()
791 cricket::GetFirstAudioContentDescription(offer->description()) in TEST_P()
792 ->set_direction(offer_direction_); in TEST_P()
796 callee->AddAudioTrack("a"); in TEST_P()
798 ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); in TEST_P()
803 auto answer = callee->CreateAnswer(options); in TEST_P()
807 auto* audio_content = cricket::GetFirstAudioContent(answer->description()); in TEST_P()
809 EXPECT_EQ((offer_to_receive_ == 0 && !send_media_), audio_content->rejected); in TEST_P()
821 Values(-1, 0, 1)));
825 caller->AddVideoTrack("v"); in TEST_P()
830 auto offer = caller->CreateOffer(options); in TEST_P()
847 callee->AddVideoTrack("v"); in TEST_P()
849 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
854 auto answer = callee->CreateAnswer(options); in TEST_P()
868 auto codecs = media_engine->voice().send_codecs(); in AddComfortNoiseCodecsToSend() local
869 codecs.push_back(kComfortNoiseCodec8k); in AddComfortNoiseCodecsToSend()
870 codecs.push_back(kComfortNoiseCodec16k); in AddComfortNoiseCodecsToSend()
871 media_engine->SetAudioCodecs(codecs); in AddComfortNoiseCodecsToSend()
876 for (const auto& codec : audio_desc->codecs()) { in HasAnyComfortNoiseCodecs()
888 for (const auto& codec : audio_desc->codecs()) { in HasPayloadTypeConflict()
897 for (const auto& codec : video_desc->codecs()) { in HasPayloadTypeConflict()
915 auto offer = caller->CreateOffer(options); in TEST_P()
917 EXPECT_FALSE(HasAnyComfortNoiseCodecs(offer->description())); in TEST_P()
928 auto offer = caller->CreateOffer(options); in TEST_P()
930 EXPECT_TRUE(HasAnyComfortNoiseCodecs(offer->description())); in TEST_P()
942 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
946 auto answer = callee->CreateAnswer(options); in TEST_P()
948 EXPECT_FALSE(HasAnyComfortNoiseCodecs(answer->description())); in TEST_P()
963 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
967 auto answer = callee->CreateAnswer(options); in TEST_P()
969 EXPECT_FALSE(HasAnyComfortNoiseCodecs(answer->description())); in TEST_P()
998 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1000 auto answer = callee->CreateAnswer(); in TEST_P()
1001 mutator_(answer->description()); in TEST_P()
1004 ASSERT_FALSE(caller->SetRemoteDescription(std::move(answer), &error)); in TEST_P()
1012 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1014 auto answer = callee->CreateAnswer(); in TEST_P()
1015 mutator_(answer->description()); in TEST_P()
1018 ASSERT_FALSE(callee->SetLocalDescription(std::move(answer), &error)); in TEST_P()
1023 auto content_name = cricket::GetFirstVideoContent(desc)->name; in RemoveVideoContent()
1024 desc->RemoveContentByName(content_name); in RemoveVideoContent()
1025 desc->RemoveTransportInfoByName(content_name); in RemoveVideoContent()
1030 auto* transport_info = desc->GetTransportInfoByName(video_content->name); in RenameVideoContent()
1031 video_content->name = "video_renamed"; in RenameVideoContent()
1032 transport_info->content_name = video_content->name; in RenameVideoContent()
1036 absl::c_reverse(desc->contents()); in ReverseMediaContent()
1037 absl::c_reverse(desc->transport_infos()); in ReverseMediaContent()
1041 std::string audio_mid = cricket::GetFirstAudioContent(desc)->name; in ChangeMediaTypeAudioToVideo()
1042 desc->RemoveContentByName(audio_mid); in ChangeMediaTypeAudioToVideo()
1044 desc->AddContent(audio_mid, video_content->type, in ChangeMediaTypeAudioToVideo()
1045 video_content->media_description()->Clone()); in ChangeMediaTypeAudioToVideo()
1049 "The order of m-lines in answer doesn't match order in offer. Rejecting "
1056 Values(std::make_tuple("remove video",
1059 std::make_tuple("rename video",
1065 std::make_tuple("change audio type to video type",
1070 // a series of offer/answers where audio/video are both sent, then audio is
1071 // rejected, then both audio/video sent again.
1085 caller->AddAudioTrack("a"); in TEST_P()
1086 caller->AddVideoTrack("v"); in TEST_P()
1089 // Caller initially offers to send/recv audio and video. in TEST_P()
1090 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1091 // Callee accepts the audio as recv only but rejects the video. in TEST_P()
1092 ASSERT_TRUE(caller->SetRemoteDescription( in TEST_P()
1093 callee->CreateAnswerAndSetAsLocal(options_reject_video))); in TEST_P()
1095 auto caller_voice = caller->media_engine()->GetVoiceChannel(0); in TEST_P()
1097 EXPECT_EQ(0u, caller_voice->recv_streams().size()); in TEST_P()
1098 EXPECT_EQ(1u, caller_voice->send_streams().size()); in TEST_P()
1099 auto caller_video = caller->media_engine()->GetVideoChannel(0); in TEST_P()
1102 // Callee adds its own audio/video stream and offers to receive audio/video in TEST_P()
1104 callee->AddAudioTrack("a"); in TEST_P()
1105 auto callee_video_track = callee->AddVideoTrack("v"); in TEST_P()
1106 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1108 caller->SetRemoteDescription(callee->CreateAnswerAndSetAsLocal())); in TEST_P()
1110 auto callee_voice = callee->media_engine()->GetVoiceChannel(0); in TEST_P()
1112 EXPECT_EQ(1u, callee_voice->recv_streams().size()); in TEST_P()
1113 EXPECT_EQ(1u, callee_voice->send_streams().size()); in TEST_P()
1114 auto callee_video = callee->media_engine()->GetVideoChannel(0); in TEST_P()
1116 EXPECT_EQ(1u, callee_video->recv_streams().size()); in TEST_P()
1117 EXPECT_EQ(1u, callee_video->send_streams().size()); in TEST_P()
1119 // Callee removes video but keeps audio and rejects the video once again. in TEST_P()
1120 callee->pc()->RemoveTrackOrError(callee_video_track); in TEST_P()
1121 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1123 callee->SetLocalDescription(callee->CreateAnswer(options_reject_video))); in TEST_P()
1125 callee_voice = callee->media_engine()->GetVoiceChannel(0); in TEST_P()
1127 EXPECT_EQ(1u, callee_voice->recv_streams().size()); in TEST_P()
1128 EXPECT_EQ(1u, callee_voice->send_streams().size()); in TEST_P()
1129 callee_video = callee->media_engine()->GetVideoChannel(0); in TEST_P()
1134 // a series of offer/answers where audio/video are both sent, then video is
1135 // rejected, then both audio/video sent again.
1155 caller->AddAudioTrack("a"); in TEST_P()
1156 caller->AddVideoTrack("v"); in TEST_P()
1159 // Caller initially offers to send/recv audio and video. in TEST_P()
1160 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1161 // Callee accepts the video as recv only but rejects the audio. in TEST_P()
1162 ASSERT_TRUE(caller->SetRemoteDescription( in TEST_P()
1163 callee->CreateAnswerAndSetAsLocal(options_reject_audio))); in TEST_P()
1165 auto caller_voice = caller->media_engine()->GetVoiceChannel(0); in TEST_P()
1167 auto caller_video = caller->media_engine()->GetVideoChannel(0); in TEST_P()
1169 EXPECT_EQ(0u, caller_video->recv_streams().size()); in TEST_P()
1170 EXPECT_EQ(1u, caller_video->send_streams().size()); in TEST_P()
1172 // Callee adds its own audio/video stream and offers to receive audio/video in TEST_P()
1174 auto callee_audio_track = callee->AddAudioTrack("a"); in TEST_P()
1175 callee->AddVideoTrack("v"); in TEST_P()
1176 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1177 ASSERT_TRUE(caller->SetRemoteDescription( in TEST_P()
1178 callee->CreateAnswerAndSetAsLocal(options_no_bundle))); in TEST_P()
1180 auto callee_voice = callee->media_engine()->GetVoiceChannel(0); in TEST_P()
1182 EXPECT_EQ(1u, callee_voice->recv_streams().size()); in TEST_P()
1183 EXPECT_EQ(1u, callee_voice->send_streams().size()); in TEST_P()
1184 auto callee_video = callee->media_engine()->GetVideoChannel(0); in TEST_P()
1186 EXPECT_EQ(1u, callee_video->recv_streams().size()); in TEST_P()
1187 EXPECT_EQ(1u, callee_video->send_streams().size()); in TEST_P()
1189 // Callee removes audio but keeps video and rejects the audio once again. in TEST_P()
1190 callee->pc()->RemoveTrackOrError(callee_audio_track); in TEST_P()
1191 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1193 callee->SetLocalDescription(callee->CreateAnswer(options_reject_audio))); in TEST_P()
1195 callee_voice = callee->media_engine()->GetVoiceChannel(0); in TEST_P()
1197 callee_video = callee->media_engine()->GetVideoChannel(0); in TEST_P()
1199 EXPECT_EQ(1u, callee_video->recv_streams().size()); in TEST_P()
1200 EXPECT_EQ(1u, callee_video->send_streams().size()); in TEST_P()
1203 // Tests that if the underlying video encoder fails to be initialized (signaled
1204 // by failing to set send codecs), the PeerConnection signals the error to the
1210 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1212 auto video_channel = caller->media_engine()->GetVideoChannel(0); in TEST_P()
1213 video_channel->set_fail_set_send_codecs(true); in TEST_P()
1216 ASSERT_FALSE(caller->SetRemoteDescription(callee->CreateAnswerAndSetAsLocal(), in TEST_P()
1219 "video description " in TEST_P()
1220 "send parameters for m-section with mid='") + in TEST_P()
1221 (IsUnifiedPlan() ? "1" : "video") + "'.", in TEST_P()
1225 // Tests that if the underlying video encoder fails once then subsequent
1233 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); in TEST_P()
1235 auto video_channel = caller->media_engine()->GetVideoChannel(0); in TEST_P()
1236 video_channel->set_fail_set_send_codecs(true); in TEST_P()
1239 caller->SetRemoteDescription(callee->CreateAnswerAndSetAsLocal())); in TEST_P()
1241 video_channel->set_fail_set_send_codecs(false); in TEST_P()
1243 EXPECT_FALSE(caller->SetRemoteDescription(callee->CreateAnswer())); in TEST_P()
1244 EXPECT_FALSE(caller->SetLocalDescription(caller->CreateOffer())); in TEST_P()
1252 std::string old_name = content->name; in RenameContent()
1253 content->name = new_name; in RenameContent()
1254 auto* transport = desc->GetTransportInfoByName(old_name); in RenameContent()
1256 transport->content_name = new_name; in RenameContent()
1260 *desc->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); in RenameContent()
1263 desc->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); in RenameContent()
1264 desc->AddGroup(new_bundle_group); in RenameContent()
1275 auto offer = caller->CreateOffer(); in TEST_P()
1276 RenameContent(offer->description(), cricket::MEDIA_TYPE_AUDIO, kAudioMid); in TEST_P()
1277 RenameContent(offer->description(), cricket::MEDIA_TYPE_VIDEO, kVideoMid); in TEST_P()
1278 ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); in TEST_P()
1280 auto answer = callee->CreateAnswer(); in TEST_P()
1282 cricket::GetFirstAudioContent(answer->description())->name); in TEST_P()
1284 cricket::GetFirstVideoContent(answer->description())->name); in TEST_P()
1287 // Test that if the callee creates a re-offer, the MIDs are the same as the
1296 auto offer = caller->CreateOffer(); in TEST_P()
1297 RenameContent(offer->description(), cricket::MEDIA_TYPE_AUDIO, kAudioMid); in TEST_P()
1298 RenameContent(offer->description(), cricket::MEDIA_TYPE_VIDEO, kVideoMid); in TEST_P()
1299 ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); in TEST_P()
1300 ASSERT_TRUE(callee->SetLocalDescription(callee->CreateAnswer())); in TEST_P()
1302 auto reoffer = callee->CreateOffer(); in TEST_P()
1304 cricket::GetFirstAudioContent(reoffer->description())->name); in TEST_P()
1306 cricket::GetFirstVideoContent(reoffer->description())->name); in TEST_P()
1315 auto offer = caller->CreateOffer(); in TEST_P()
1316 RenameContent(offer->description(), cricket::MEDIA_TYPE_AUDIO, "same"); in TEST_P()
1317 RenameContent(offer->description(), cricket::MEDIA_TYPE_VIDEO, "same"); in TEST_P()
1320 EXPECT_FALSE(callee->SetRemoteDescription(std::move(offer), &error)); in TEST_P()
1331 ASSERT_TRUE(caller->SetLocalDescription(caller->CreateOffer())); in TEST_P()
1333 auto caller_voice = caller->media_engine()->GetVoiceChannel(0); in TEST_P()
1335 const cricket::AudioOptions& audio_options = caller_voice->options(); in TEST_P()
1348 caller_fake_engine->SetAudioCodecs(caller_fake_codecs); in TEST_P()
1358 callee_fake_engine->SetAudioCodecs(callee_fake_codecs); in TEST_P()
1362 auto offer = caller->CreateOfferAndSetAsLocal(); in TEST_P()
1363 callee->SetRemoteDescription(std::move(offer)); in TEST_P()
1364 auto answer = callee->CreateAnswerAndSetAsLocal(); in TEST_P()
1366 cricket::GetFirstAudioContentDescription(answer->description()); in TEST_P()
1367 ASSERT_EQ(1u, answer_description->codecs().size()); in TEST_P()
1371 offer = callee->CreateOfferAndSetAsLocal(); in TEST_P()
1373 cricket::GetFirstAudioContentDescription(offer->description()); in TEST_P()
1374 ASSERT_EQ(2u, offer_description->codecs().size()); in TEST_P()
1375 for (const auto& codec : offer_description->codecs()) { in TEST_P()
1393 caller_fake_engine->SetAudioCodecs(caller_fake_codecs); in TEST_P()
1401 callee_fake_engine->SetAudioCodecs(callee_fake_codecs); in TEST_P()
1406 auto offer = caller->CreateOfferAndSetAsLocal(); in TEST_P()
1407 callee->SetRemoteDescription(std::move(offer)); in TEST_P()
1408 auto answer = callee->CreateAnswerAndSetAsLocal(); in TEST_P()
1410 cricket::GetFirstAudioContentDescription(answer->description()); in TEST_P()
1411 ASSERT_EQ(2u, answer_description->codecs().size()); in TEST_P()
1415 offer = callee->CreateOfferAndSetAsLocal(); in TEST_P()
1417 cricket::GetFirstAudioContentDescription(offer->description()); in TEST_P()
1418 ASSERT_EQ(2u, offer_description->codecs().size()); in TEST_P()
1419 for (const auto& codec : offer_description->codecs()) { in TEST_P()
1435 caller_fake_engine->SetAudioCodecs(caller_fake_codecs); in TEST_P()
1445 callee_fake_engine->SetAudioCodecs(callee_fake_codecs); in TEST_P()
1450 auto offer = caller->CreateOfferAndSetAsLocal(); in TEST_P()
1451 callee->SetRemoteDescription(std::move(offer)); in TEST_P()
1452 auto answer = callee->CreateAnswerAndSetAsLocal(); in TEST_P()
1454 cricket::GetFirstAudioContentDescription(answer->description()); in TEST_P()
1455 ASSERT_EQ(1u, answer_description->codecs().size()); in TEST_P()
1459 offer = callee->CreateOfferAndSetAsLocal(); in TEST_P()
1461 cricket::GetFirstAudioContentDescription(offer->description()); in TEST_P()
1462 ASSERT_EQ(2u, offer_description->codecs().size()); in TEST_P()
1463 for (const auto& codec : offer_description->codecs()) { in TEST_P()
1475 // Test that RED with fmtp must match base codecs.
1484 caller_fake_engine->SetAudioCodecs(caller_fake_codecs); in TEST_P()
1495 callee_fake_engine->SetAudioCodecs(callee_fake_codecs); in TEST_P()
1500 auto offer = caller->CreateOfferAndSetAsLocal(); in TEST_P()
1501 callee->SetRemoteDescription(std::move(offer)); in TEST_P()
1502 auto answer = callee->CreateAnswerAndSetAsLocal(); in TEST_P()
1504 cricket::GetFirstAudioContentDescription(answer->description()); in TEST_P()
1505 ASSERT_EQ(1u, answer_description->codecs().size()); in TEST_P()
1508 // Test behaviour when the RED fmtp attempts to specify different codecs
1519 caller_fake_engine->SetAudioCodecs(caller_fake_codecs); in TEST_P()
1529 callee_fake_engine->SetAudioCodecs(callee_fake_codecs); in TEST_P()
1533 auto offer = caller->CreateOfferAndSetAsLocal(); in TEST_P()
1534 callee->SetRemoteDescription(std::move(offer)); in TEST_P()
1535 auto answer = callee->CreateAnswerAndSetAsLocal(); in TEST_P()
1537 cricket::GetFirstAudioContentDescription(answer->description()); in TEST_P()
1539 ASSERT_EQ(1u, answer_description->codecs().size()); in TEST_P()
1552 caller_fake_engine->SetAudioCodecs(caller_fake_codecs); in TEST_P()
1562 callee_fake_engine->SetAudioCodecs(callee_fake_codecs); in TEST_P()
1566 auto offer = caller->CreateOfferAndSetAsLocal(); in TEST_P()
1567 callee->SetRemoteDescription(std::move(offer)); in TEST_P()
1568 auto answer = callee->CreateAnswerAndSetAsLocal(); in TEST_P()
1570 cricket::GetFirstAudioContentDescription(answer->description()); in TEST_P()
1572 ASSERT_EQ(2u, answer_description->codecs().size()); in TEST_P()
1576 offer = callee->CreateOfferAndSetAsLocal(); in TEST_P()
1578 cricket::GetFirstAudioContentDescription(offer->description()); in TEST_P()
1579 ASSERT_EQ(2u, offer_description->codecs().size()); in TEST_P()
1580 for (const auto& codec : offer_description->codecs()) { in TEST_P()
1594 const std::vector<C>& codecs) { in CompareCodecs() argument
1599 bool codecs_has_rtx = absl::c_any_of(codecs, [](const C& codec) { in CompareCodecs()
1605 codecs, std::back_inserter(codecs_no_rtx), in CompareCodecs()
1625 auto send_codecs = fake_engine->voice().send_codecs(); in TEST_F()
1628 fake_engine->SetAudioSendCodecs(send_codecs); in TEST_F()
1632 auto transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1633 auto capabilities = caller->pc_factory()->GetRtpSenderCapabilities( in TEST_F()
1636 std::vector<webrtc::RtpCodecCapability> codecs; in TEST_F() local
1637 absl::c_copy_if(capabilities.codecs, std::back_inserter(codecs), in TEST_F()
1642 auto result = transceiver->SetCodecPreferences(codecs); in TEST_F()
1649 auto recv_codecs = fake_engine->voice().recv_codecs(); in TEST_F()
1652 fake_engine->SetAudioRecvCodecs(recv_codecs); in TEST_F()
1655 auto transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1656 auto capabilities = caller->pc_factory()->GetRtpReceiverCapabilities( in TEST_F()
1659 std::vector<webrtc::RtpCodecCapability> codecs; in TEST_F() local
1660 absl::c_copy_if(capabilities.codecs, std::back_inserter(codecs), in TEST_F()
1665 auto result = transceiver->SetCodecPreferences(codecs); in TEST_F()
1673 auto transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1675 caller->pc_factory() in TEST_F()
1676 ->GetRtpSenderCapabilities(cricket::MediaType::MEDIA_TYPE_VIDEO) in TEST_F()
1677 .codecs; in TEST_F()
1678 auto codecs = in TEST_F() local
1679 caller->pc_factory() in TEST_F()
1680 ->GetRtpSenderCapabilities(cricket::MediaType::MEDIA_TYPE_AUDIO) in TEST_F()
1681 .codecs; in TEST_F()
1682 codecs.insert(codecs.end(), video_codecs.begin(), video_codecs.end()); in TEST_F()
1683 auto result = transceiver->SetCodecPreferences(codecs); in TEST_F()
1690 auto audio_codecs = fake_engine->voice().send_codecs(); in TEST_F()
1694 std::to_string(audio_codecs.back().id - 1); in TEST_F()
1699 fake_engine->SetAudioCodecs(audio_codecs); in TEST_F()
1703 auto transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1704 auto codecs = in TEST_F() local
1705 caller->pc_factory() in TEST_F()
1706 ->GetRtpSenderCapabilities(cricket::MediaType::MEDIA_TYPE_AUDIO) in TEST_F()
1707 .codecs; in TEST_F()
1708 auto codecs_only_rtx_red_fec = codecs; in TEST_F()
1718 auto result = transceiver->SetCodecPreferences(codecs_only_rtx_red_fec); in TEST_F()
1726 caller->pc_factory() in TEST_F()
1727 ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO) in TEST_F()
1728 .codecs; in TEST_F()
1730 auto audio_transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1733 EXPECT_TRUE(audio_transceiver->SetCodecPreferences(sender_audio_codecs).ok()); in TEST_F()
1734 auto offer = caller->CreateOffer(); in TEST_F()
1735 auto codecs = offer->description() in TEST_F() local
1736 ->contents()[0] in TEST_F()
1738 ->as_audio() in TEST_F()
1739 ->codecs(); in TEST_F()
1740 EXPECT_TRUE(CompareCodecs(sender_audio_codecs, codecs)); in TEST_F()
1748 caller->pc_factory() in TEST_F()
1749 ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO) in TEST_F()
1750 .codecs; in TEST_F()
1753 auto audio_transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1756 EXPECT_TRUE(audio_transceiver->SetCodecPreferences(empty_codecs).ok()); in TEST_F()
1757 auto offer = caller->CreateOffer(); in TEST_F()
1758 auto codecs = offer->description() in TEST_F() local
1759 ->contents()[0] in TEST_F()
1761 ->as_audio() in TEST_F()
1762 ->codecs(); in TEST_F()
1763 EXPECT_TRUE(CompareCodecs(sender_audio_codecs, codecs)); in TEST_F()
1770 auto transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1772 caller->pc_factory() in TEST_F()
1773 ->GetRtpSenderCapabilities(cricket::MediaType::MEDIA_TYPE_AUDIO) in TEST_F()
1774 .codecs; in TEST_F()
1775 auto codecs = in TEST_F() local
1776 caller->pc_factory() in TEST_F()
1777 ->GetRtpSenderCapabilities(cricket::MediaType::MEDIA_TYPE_VIDEO) in TEST_F()
1778 .codecs; in TEST_F()
1779 codecs.insert(codecs.end(), audio_codecs.begin(), audio_codecs.end()); in TEST_F()
1780 auto result = transceiver->SetCodecPreferences(codecs); in TEST_F()
1787 auto video_codecs = fake_engine->video().send_codecs(); in TEST_F()
1791 std::to_string(video_codecs.back().id - 1); in TEST_F()
1796 fake_engine->SetVideoCodecs(video_codecs); in TEST_F()
1800 auto transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1801 auto codecs = in TEST_F() local
1802 caller->pc_factory() in TEST_F()
1803 ->GetRtpSenderCapabilities(cricket::MediaType::MEDIA_TYPE_VIDEO) in TEST_F()
1804 .codecs; in TEST_F()
1805 auto codecs_only_rtx_red_fec = codecs; in TEST_F()
1815 auto result = transceiver->SetCodecPreferences(codecs_only_rtx_red_fec); in TEST_F()
1823 caller->pc_factory() in TEST_F()
1824 ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO) in TEST_F()
1825 .codecs; in TEST_F()
1827 auto video_transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1830 EXPECT_TRUE(video_transceiver->SetCodecPreferences(sender_video_codecs).ok()); in TEST_F()
1831 auto offer = caller->CreateOffer(); in TEST_F()
1832 auto codecs = offer->description() in TEST_F() local
1833 ->contents()[0] in TEST_F()
1835 ->as_video() in TEST_F()
1836 ->codecs(); in TEST_F()
1837 EXPECT_TRUE(CompareCodecs(sender_video_codecs, codecs)); in TEST_F()
1845 caller->pc_factory() in TEST_F()
1846 ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO) in TEST_F()
1847 .codecs; in TEST_F()
1851 auto video_transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1853 // Normal case, resetting preferences with empty list of codecs in TEST_F()
1854 EXPECT_TRUE(video_transceiver->SetCodecPreferences(empty_codecs).ok()); in TEST_F()
1855 auto offer = caller->CreateOffer(); in TEST_F()
1856 auto codecs = offer->description() in TEST_F() local
1857 ->contents()[0] in TEST_F()
1859 ->as_video() in TEST_F()
1860 ->codecs(); in TEST_F()
1861 EXPECT_TRUE(CompareCodecs(sender_video_codecs, codecs)); in TEST_F()
1869 caller->pc_factory() in TEST_F()
1870 ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO) in TEST_F()
1871 .codecs; in TEST_F()
1873 auto video_transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1883 EXPECT_TRUE(video_transceiver->SetCodecPreferences(duplicate_codec).ok()); in TEST_F()
1884 auto offer = caller->CreateOffer(); in TEST_F()
1885 auto codecs = offer->description() in TEST_F() local
1886 ->contents()[0] in TEST_F()
1888 ->as_video() in TEST_F()
1889 ->codecs(); in TEST_F()
1890 EXPECT_TRUE(CompareCodecs(single_codec, codecs)); in TEST_F()
1895 auto caller_video_codecs = caller_fake_engine->video().send_codecs(); in TEST_F()
1901 std::to_string(caller_video_codecs.back().id - 1); in TEST_F()
1907 std::to_string(caller_video_codecs.back().id - 1); in TEST_F()
1908 caller_fake_engine->SetVideoCodecs(caller_video_codecs); in TEST_F()
1913 caller->pc_factory() in TEST_F()
1914 ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO) in TEST_F()
1915 .codecs; in TEST_F()
1917 auto video_transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1932 video_transceiver->SetCodecPreferences(video_codecs_vpx_rtx).ok()); in TEST_F()
1933 auto offer = caller->CreateOffer(); in TEST_F()
1934 auto codecs = offer->description() in TEST_F() local
1935 ->contents()[0] in TEST_F()
1937 ->as_video() in TEST_F()
1938 ->codecs(); in TEST_F()
1940 EXPECT_TRUE(CompareCodecs(video_codecs_vpx_rtx, codecs)); in TEST_F()
1941 EXPECT_EQ(codecs.size(), 4u); in TEST_F()
1947 auto caller_video_codecs = caller_fake_engine->video().send_codecs(); in TEST_F()
1953 std::to_string(caller_video_codecs.back().id - 1); in TEST_F()
1959 std::to_string(caller_video_codecs.back().id - 1); in TEST_F()
1960 caller_fake_engine->SetVideoCodecs(caller_video_codecs); in TEST_F()
1963 callee_fake_engine->SetVideoCodecs(caller_video_codecs); in TEST_F()
1968 auto video_codecs = caller->pc_factory() in TEST_F()
1969 ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO) in TEST_F()
1970 .codecs; in TEST_F()
1972 auto send_transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
1982 EXPECT_TRUE(send_transceiver->SetCodecPreferences(video_codecs_vpx).ok()); in TEST_F()
1984 auto offer = caller->CreateOfferAndSetAsLocal(); in TEST_F()
1985 auto codecs = offer->description() in TEST_F() local
1986 ->contents()[0] in TEST_F()
1988 ->as_video() in TEST_F()
1989 ->codecs(); in TEST_F()
1991 EXPECT_EQ(codecs.size(), 2u); // VP8, VP9 in TEST_F()
1992 EXPECT_TRUE(CompareCodecs(video_codecs_vpx, codecs)); in TEST_F()
1994 callee->SetRemoteDescription(std::move(offer)); in TEST_F()
1996 auto recv_transceiver = callee->pc()->GetTransceivers().front(); in TEST_F()
2006 recv_transceiver->SetCodecPreferences(video_codecs_vp8_rtx); in TEST_F()
2008 auto answer = callee->CreateAnswerAndSetAsLocal(); in TEST_F()
2010 auto recv_codecs = answer->description() in TEST_F()
2011 ->contents()[0] in TEST_F()
2013 ->as_video() in TEST_F()
2014 ->codecs(); in TEST_F()
2021 auto caller_video_codecs = caller_fake_engine->video().send_codecs(); in TEST_F()
2027 std::to_string(caller_video_codecs.back().id - 1); in TEST_F()
2033 std::to_string(caller_video_codecs.back().id - 1); in TEST_F()
2034 caller_fake_engine->SetVideoCodecs(caller_video_codecs); in TEST_F()
2037 callee_fake_engine->SetVideoCodecs(caller_video_codecs); in TEST_F()
2042 auto video_codecs = caller->pc_factory() in TEST_F()
2043 ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO) in TEST_F()
2044 .codecs; in TEST_F()
2046 auto send_transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
2056 EXPECT_TRUE(send_transceiver->SetCodecPreferences(video_codecs_vpx).ok()); in TEST_F()
2061 auto offer = caller->CreateOfferAndSetAsLocal(); in TEST_F()
2062 auto codecs = offer->description() in TEST_F() local
2063 ->contents()[0] in TEST_F()
2065 ->as_video() in TEST_F()
2066 ->codecs(); in TEST_F()
2067 EXPECT_EQ(codecs.size(), 2u); // VP9, VP8 in TEST_F()
2068 EXPECT_TRUE(CompareCodecs(video_codecs_vpx, codecs)); in TEST_F()
2070 callee->SetRemoteDescription(std::move(offer)); in TEST_F()
2072 auto recv_transceiver = callee->pc()->GetTransceivers().front(); in TEST_F()
2073 recv_transceiver->SetCodecPreferences(video_codecs_vpx_reverse); in TEST_F()
2075 auto answer = callee->CreateAnswerAndSetAsLocal(); in TEST_F()
2077 auto recv_codecs = answer->description() in TEST_F()
2078 ->contents()[0] in TEST_F()
2080 ->as_video() in TEST_F()
2081 ->codecs(); in TEST_F()
2093 auto offer = caller->CreateOffer(options); in TEST_F()
2094 EXPECT_TRUE(HasAnyComfortNoiseCodecs(offer->description())); in TEST_F()
2096 auto transceiver = caller->pc()->GetTransceivers().front(); in TEST_F()
2097 auto capabilities = caller->pc_factory()->GetRtpSenderCapabilities( in TEST_F()
2099 EXPECT_TRUE(transceiver->SetCodecPreferences(capabilities.codecs).ok()); in TEST_F()
2102 offer = caller->CreateOffer(options); in TEST_F()
2103 EXPECT_FALSE(HasAnyComfortNoiseCodecs(offer->description())); in TEST_F()
2106 // If the "default" payload types of audio/video codecs are the same, and
2107 // audio/video are bundled (as is the default), payload types should be
2118 fake_engine->SetAudioCodecs(audio_codecs); in TEST_F()
2124 fake_engine->SetVideoCodecs(video_codecs); in TEST_F()
2127 auto transceivers = caller->pc()->GetTransceivers(); in TEST_F()
2130 auto audio_transceiver = caller->pc()->GetTransceivers()[0]; in TEST_F()
2131 auto capabilities = caller->pc_factory()->GetRtpSenderCapabilities( in TEST_F()
2133 EXPECT_TRUE(audio_transceiver->SetCodecPreferences(capabilities.codecs).ok()); in TEST_F()
2135 auto video_transceiver = caller->pc()->GetTransceivers()[1]; in TEST_F()
2136 capabilities = caller->pc_factory()->GetRtpSenderCapabilities( in TEST_F()
2138 EXPECT_TRUE(video_transceiver->SetCodecPreferences(capabilities.codecs).ok()); in TEST_F()
2141 auto offer = caller->CreateOffer(options); in TEST_F()
2142 EXPECT_FALSE(HasPayloadTypeConflict(offer->description())); in TEST_F()
2144 EXPECT_EQ(2u, cricket::GetFirstAudioContentDescription(offer->description()) in TEST_F()
2145 ->codecs() in TEST_F()
2147 EXPECT_EQ(2u, cricket::GetFirstVideoContentDescription(offer->description()) in TEST_F()
2148 ->codecs() in TEST_F()
2161 fake_engine->SetAudioCodecs(audio_codecs); in TEST_F()
2167 fake_engine->SetVideoCodecs(video_codecs); in TEST_F()
2172 caller->SetRemoteDescription(caller->CreateOffer(options)); in TEST_F()
2174 auto transceivers = caller->pc()->GetTransceivers(); in TEST_F()
2177 auto audio_transceiver = caller->pc()->GetTransceivers()[0]; in TEST_F()
2178 auto capabilities = caller->pc_factory()->GetRtpSenderCapabilities( in TEST_F()
2180 EXPECT_TRUE(audio_transceiver->SetCodecPreferences(capabilities.codecs).ok()); in TEST_F()
2182 auto video_transceiver = caller->pc()->GetTransceivers()[1]; in TEST_F()
2183 capabilities = caller->pc_factory()->GetRtpSenderCapabilities( in TEST_F()
2185 EXPECT_TRUE(video_transceiver->SetCodecPreferences(capabilities.codecs).ok()); in TEST_F()
2187 auto answer = caller->CreateAnswer(options); in TEST_F()
2189 EXPECT_FALSE(HasPayloadTypeConflict(answer->description())); in TEST_F()
2191 EXPECT_EQ(2u, cricket::GetFirstAudioContentDescription(answer->description()) in TEST_F()
2192 ->codecs() in TEST_F()
2194 EXPECT_EQ(2u, cricket::GetFirstVideoContentDescription(answer->description()) in TEST_F()
2195 ->codecs() in TEST_F()
2208 fake_engine->SetAudioCodecs(audio_codecs); in TEST_F()
2214 fake_engine->SetVideoCodecs(video_codecs); in TEST_F()
2219 caller->SetRemoteDescription(caller->CreateOffer(options)); in TEST_F()
2220 caller->SetLocalDescription(caller->CreateAnswer(options)); in TEST_F()
2222 auto transceivers = caller->pc()->GetTransceivers(); in TEST_F()
2225 auto audio_transceiver = caller->pc()->GetTransceivers()[0]; in TEST_F()
2226 auto capabilities = caller->pc_factory()->GetRtpSenderCapabilities( in TEST_F()
2228 EXPECT_TRUE(audio_transceiver->SetCodecPreferences(capabilities.codecs).ok()); in TEST_F()
2230 auto video_transceiver = caller->pc()->GetTransceivers()[1]; in TEST_F()
2231 capabilities = caller->pc_factory()->GetRtpSenderCapabilities( in TEST_F()
2233 EXPECT_TRUE(video_transceiver->SetCodecPreferences(capabilities.codecs).ok()); in TEST_F()
2235 auto reoffer = caller->CreateOffer(options); in TEST_F()
2237 EXPECT_FALSE(HasPayloadTypeConflict(reoffer->description())); in TEST_F()
2239 EXPECT_EQ(2u, cricket::GetFirstAudioContentDescription(reoffer->description()) in TEST_F()
2240 ->codecs() in TEST_F()
2242 EXPECT_EQ(2u, cricket::GetFirstVideoContentDescription(reoffer->description()) in TEST_F()
2243 ->codecs() in TEST_F()