OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // description is not changed and RemoveLocalStream | 352 // description is not changed and RemoveLocalStream |
353 // is called and later AddLocalStream is called again with the same stream. | 353 // is called and later AddLocalStream is called again with the same stream. |
354 AudioTrackVector audio_tracks = local_stream->GetAudioTracks(); | 354 AudioTrackVector audio_tracks = local_stream->GetAudioTracks(); |
355 for (AudioTrackVector::const_iterator it = audio_tracks.begin(); | 355 for (AudioTrackVector::const_iterator it = audio_tracks.begin(); |
356 it != audio_tracks.end(); ++it) { | 356 it != audio_tracks.end(); ++it) { |
357 const TrackInfo* track_info = FindTrackInfo(local_audio_tracks_, | 357 const TrackInfo* track_info = FindTrackInfo(local_audio_tracks_, |
358 local_stream->label(), | 358 local_stream->label(), |
359 (*it)->id()); | 359 (*it)->id()); |
360 if (track_info) { | 360 if (track_info) { |
361 OnLocalTrackSeen(track_info->stream_label, track_info->track_id, | 361 OnLocalTrackSeen(track_info->stream_label, track_info->track_id, |
362 track_info->ssrc, cricket::MEDIA_TYPE_AUDIO); | 362 track_info->ssrc, cricket::MEDIA_TYPE_AUDIO, |
| 363 track_info->mid); |
363 } | 364 } |
364 } | 365 } |
365 | 366 |
366 VideoTrackVector video_tracks = local_stream->GetVideoTracks(); | 367 VideoTrackVector video_tracks = local_stream->GetVideoTracks(); |
367 for (VideoTrackVector::const_iterator it = video_tracks.begin(); | 368 for (VideoTrackVector::const_iterator it = video_tracks.begin(); |
368 it != video_tracks.end(); ++it) { | 369 it != video_tracks.end(); ++it) { |
369 const TrackInfo* track_info = FindTrackInfo(local_video_tracks_, | 370 const TrackInfo* track_info = FindTrackInfo(local_video_tracks_, |
370 local_stream->label(), | 371 local_stream->label(), |
371 (*it)->id()); | 372 (*it)->id()); |
372 if (track_info) { | 373 if (track_info) { |
373 OnLocalTrackSeen(track_info->stream_label, track_info->track_id, | 374 OnLocalTrackSeen(track_info->stream_label, track_info->track_id, |
374 track_info->ssrc, cricket::MEDIA_TYPE_VIDEO); | 375 track_info->ssrc, cricket::MEDIA_TYPE_VIDEO, |
| 376 track_info->mid); |
375 } | 377 } |
376 } | 378 } |
377 return true; | 379 return true; |
378 } | 380 } |
379 | 381 |
380 void MediaStreamSignaling::RemoveLocalStream( | 382 void MediaStreamSignaling::RemoveLocalStream( |
381 MediaStreamInterface* local_stream) { | 383 MediaStreamInterface* local_stream) { |
382 AudioTrackVector audio_tracks = local_stream->GetAudioTracks(); | 384 AudioTrackVector audio_tracks = local_stream->GetAudioTracks(); |
383 for (AudioTrackVector::const_iterator it = audio_tracks.begin(); | 385 for (AudioTrackVector::const_iterator it = audio_tracks.begin(); |
384 it != audio_tracks.end(); ++it) { | 386 it != audio_tracks.end(); ++it) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 rtc::scoped_refptr<StreamCollection> new_streams( | 466 rtc::scoped_refptr<StreamCollection> new_streams( |
465 StreamCollection::Create()); | 467 StreamCollection::Create()); |
466 | 468 |
467 // Find all audio rtp streams and create corresponding remote AudioTracks | 469 // Find all audio rtp streams and create corresponding remote AudioTracks |
468 // and MediaStreams. | 470 // and MediaStreams. |
469 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc); | 471 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc); |
470 if (audio_content) { | 472 if (audio_content) { |
471 const cricket::AudioContentDescription* desc = | 473 const cricket::AudioContentDescription* desc = |
472 static_cast<const cricket::AudioContentDescription*>( | 474 static_cast<const cricket::AudioContentDescription*>( |
473 audio_content->description); | 475 audio_content->description); |
474 UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams); | 476 UpdateRemoteStreamsList(desc->streams(), desc->type(), audio_content->name, |
| 477 new_streams); |
475 remote_info_.default_audio_track_needed = | 478 remote_info_.default_audio_track_needed = |
476 MediaContentDirectionHasSend(desc->direction()) && | 479 MediaContentDirectionHasSend(desc->direction()) && |
477 desc->streams().empty(); | 480 desc->streams().empty(); |
| 481 if (remote_info_.default_audio_track_needed) { |
| 482 remote_info_.default_audio_mid = audio_content->name; |
| 483 } |
478 } | 484 } |
479 | 485 |
480 // Find all video rtp streams and create corresponding remote VideoTracks | 486 // Find all video rtp streams and create corresponding remote VideoTracks |
481 // and MediaStreams. | 487 // and MediaStreams. |
482 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc); | 488 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc); |
483 if (video_content) { | 489 if (video_content) { |
484 const cricket::VideoContentDescription* desc = | 490 const cricket::VideoContentDescription* desc = |
485 static_cast<const cricket::VideoContentDescription*>( | 491 static_cast<const cricket::VideoContentDescription*>( |
486 video_content->description); | 492 video_content->description); |
487 UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams); | 493 UpdateRemoteStreamsList(desc->streams(), desc->type(), video_content->name, |
| 494 new_streams); |
488 remote_info_.default_video_track_needed = | 495 remote_info_.default_video_track_needed = |
489 MediaContentDirectionHasSend(desc->direction()) && | 496 MediaContentDirectionHasSend(desc->direction()) && |
490 desc->streams().empty(); | 497 desc->streams().empty(); |
| 498 if (remote_info_.default_video_track_needed) { |
| 499 remote_info_.default_video_mid = video_content->name; |
| 500 } |
491 } | 501 } |
492 | 502 |
493 // Update the DataChannels with the information from the remote peer. | 503 // Update the DataChannels with the information from the remote peer. |
494 const cricket::ContentInfo* data_content = GetFirstDataContent(remote_desc); | 504 const cricket::ContentInfo* data_content = GetFirstDataContent(remote_desc); |
495 if (data_content) { | 505 if (data_content) { |
496 const cricket::DataContentDescription* data_desc = | 506 const cricket::DataContentDescription* data_desc = |
497 static_cast<const cricket::DataContentDescription*>( | 507 static_cast<const cricket::DataContentDescription*>( |
498 data_content->description); | 508 data_content->description); |
499 if (rtc::starts_with( | 509 if (rtc::starts_with( |
500 data_desc->protocol().data(), cricket::kMediaProtocolRtpPrefix)) { | 510 data_desc->protocol().data(), cricket::kMediaProtocolRtpPrefix)) { |
(...skipping 22 matching lines...) Expand all Loading... |
523 const SessionDescriptionInterface* desc) { | 533 const SessionDescriptionInterface* desc) { |
524 const cricket::ContentInfo* audio_content = | 534 const cricket::ContentInfo* audio_content = |
525 GetFirstAudioContent(desc->description()); | 535 GetFirstAudioContent(desc->description()); |
526 if (audio_content) { | 536 if (audio_content) { |
527 if (audio_content->rejected) { | 537 if (audio_content->rejected) { |
528 RejectRemoteTracks(cricket::MEDIA_TYPE_AUDIO); | 538 RejectRemoteTracks(cricket::MEDIA_TYPE_AUDIO); |
529 } | 539 } |
530 const cricket::AudioContentDescription* audio_desc = | 540 const cricket::AudioContentDescription* audio_desc = |
531 static_cast<const cricket::AudioContentDescription*>( | 541 static_cast<const cricket::AudioContentDescription*>( |
532 audio_content->description); | 542 audio_content->description); |
533 UpdateLocalTracks(audio_desc->streams(), audio_desc->type()); | 543 UpdateLocalTracks(audio_desc->streams(), audio_desc->type(), |
| 544 audio_content->name); |
534 } | 545 } |
535 | 546 |
536 const cricket::ContentInfo* video_content = | 547 const cricket::ContentInfo* video_content = |
537 GetFirstVideoContent(desc->description()); | 548 GetFirstVideoContent(desc->description()); |
538 if (video_content) { | 549 if (video_content) { |
539 if (video_content->rejected) { | 550 if (video_content->rejected) { |
540 RejectRemoteTracks(cricket::MEDIA_TYPE_VIDEO); | 551 RejectRemoteTracks(cricket::MEDIA_TYPE_VIDEO); |
541 } | 552 } |
542 const cricket::VideoContentDescription* video_desc = | 553 const cricket::VideoContentDescription* video_desc = |
543 static_cast<const cricket::VideoContentDescription*>( | 554 static_cast<const cricket::VideoContentDescription*>( |
544 video_content->description); | 555 video_content->description); |
545 UpdateLocalTracks(video_desc->streams(), video_desc->type()); | 556 UpdateLocalTracks(video_desc->streams(), video_desc->type(), |
| 557 video_content->name); |
546 } | 558 } |
547 | 559 |
548 const cricket::ContentInfo* data_content = | 560 const cricket::ContentInfo* data_content = |
549 GetFirstDataContent(desc->description()); | 561 GetFirstDataContent(desc->description()); |
550 if (data_content) { | 562 if (data_content) { |
551 const cricket::DataContentDescription* data_desc = | 563 const cricket::DataContentDescription* data_desc = |
552 static_cast<const cricket::DataContentDescription*>( | 564 static_cast<const cricket::DataContentDescription*>( |
553 data_content->description); | 565 data_content->description); |
554 if (rtc::starts_with( | 566 if (rtc::starts_with( |
555 data_desc->protocol().data(), cricket::kMediaProtocolRtpPrefix)) { | 567 data_desc->protocol().data(), cricket::kMediaProtocolRtpPrefix)) { |
(...skipping 24 matching lines...) Expand all Loading... |
580 temp_sctp_dcs.swap(sctp_data_channels_); | 592 temp_sctp_dcs.swap(sctp_data_channels_); |
581 SctpDataChannels::iterator it2 = temp_sctp_dcs.begin(); | 593 SctpDataChannels::iterator it2 = temp_sctp_dcs.begin(); |
582 for (; it2 != temp_sctp_dcs.end(); ++it2) { | 594 for (; it2 != temp_sctp_dcs.end(); ++it2) { |
583 (*it2)->OnDataEngineClose(); | 595 (*it2)->OnDataEngineClose(); |
584 } | 596 } |
585 } | 597 } |
586 | 598 |
587 void MediaStreamSignaling::UpdateRemoteStreamsList( | 599 void MediaStreamSignaling::UpdateRemoteStreamsList( |
588 const cricket::StreamParamsVec& streams, | 600 const cricket::StreamParamsVec& streams, |
589 cricket::MediaType media_type, | 601 cricket::MediaType media_type, |
| 602 const std::string& mid, |
590 StreamCollection* new_streams) { | 603 StreamCollection* new_streams) { |
591 TrackInfos* current_tracks = GetRemoteTracks(media_type); | 604 TrackInfos* current_tracks = GetRemoteTracks(media_type); |
592 | 605 |
593 // Find removed tracks. Ie tracks where the track id or ssrc don't match the | 606 // Find removed tracks. Ie tracks where the track id or ssrc don't match the |
594 // new StreamParam. | 607 // new StreamParam. |
595 TrackInfos::iterator track_it = current_tracks->begin(); | 608 TrackInfos::iterator track_it = current_tracks->begin(); |
596 while (track_it != current_tracks->end()) { | 609 while (track_it != current_tracks->end()) { |
597 const TrackInfo& info = *track_it; | 610 const TrackInfo& info = *track_it; |
598 const cricket::StreamParams* params = | 611 const cricket::StreamParams* params = |
599 cricket::GetStreamBySsrc(streams, info.ssrc); | 612 cricket::GetStreamBySsrc(streams, info.ssrc); |
(...skipping 19 matching lines...) Expand all Loading... |
619 if (!stream) { | 632 if (!stream) { |
620 // This is a new MediaStream. Create a new remote MediaStream. | 633 // This is a new MediaStream. Create a new remote MediaStream. |
621 stream = remote_stream_factory_->CreateMediaStream(stream_label); | 634 stream = remote_stream_factory_->CreateMediaStream(stream_label); |
622 remote_streams_->AddStream(stream); | 635 remote_streams_->AddStream(stream); |
623 new_streams->AddStream(stream); | 636 new_streams->AddStream(stream); |
624 } | 637 } |
625 | 638 |
626 const TrackInfo* track_info = FindTrackInfo(*current_tracks, stream_label, | 639 const TrackInfo* track_info = FindTrackInfo(*current_tracks, stream_label, |
627 track_id); | 640 track_id); |
628 if (!track_info) { | 641 if (!track_info) { |
629 current_tracks->push_back(TrackInfo(stream_label, track_id, ssrc)); | 642 current_tracks->push_back(TrackInfo(stream_label, track_id, ssrc, mid)); |
630 OnRemoteTrackSeen(stream_label, track_id, it->first_ssrc(), media_type); | 643 OnRemoteTrackSeen(stream_label, track_id, it->first_ssrc(), media_type, |
| 644 mid); |
631 } | 645 } |
632 } | 646 } |
633 } | 647 } |
634 | 648 |
635 void MediaStreamSignaling::OnRemoteTrackSeen(const std::string& stream_label, | 649 void MediaStreamSignaling::OnRemoteTrackSeen(const std::string& stream_label, |
636 const std::string& track_id, | 650 const std::string& track_id, |
637 uint32 ssrc, | 651 uint32 ssrc, |
638 cricket::MediaType media_type) { | 652 cricket::MediaType media_type, |
| 653 const std::string& mid) { |
639 MediaStreamInterface* stream = remote_streams_->find(stream_label); | 654 MediaStreamInterface* stream = remote_streams_->find(stream_label); |
640 | 655 |
641 if (media_type == cricket::MEDIA_TYPE_AUDIO) { | 656 if (media_type == cricket::MEDIA_TYPE_AUDIO) { |
642 AudioTrackInterface* audio_track = | 657 AudioTrackInterface* audio_track = |
643 remote_stream_factory_->AddAudioTrack(stream, track_id); | 658 remote_stream_factory_->AddAudioTrack(stream, track_id); |
644 stream_observer_->OnAddRemoteAudioTrack(stream, audio_track, ssrc); | 659 stream_observer_->OnAddRemoteAudioTrack(stream, audio_track, ssrc, mid); |
645 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 660 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
646 VideoTrackInterface* video_track = | 661 VideoTrackInterface* video_track = |
647 remote_stream_factory_->AddVideoTrack(stream, track_id); | 662 remote_stream_factory_->AddVideoTrack(stream, track_id); |
648 stream_observer_->OnAddRemoteVideoTrack(stream, video_track, ssrc); | 663 stream_observer_->OnAddRemoteVideoTrack(stream, video_track, ssrc, mid); |
649 } else { | 664 } else { |
650 ASSERT(false && "Invalid media type"); | 665 ASSERT(false && "Invalid media type"); |
651 } | 666 } |
652 } | 667 } |
653 | 668 |
654 void MediaStreamSignaling::OnRemoteTrackRemoved( | 669 void MediaStreamSignaling::OnRemoteTrackRemoved( |
655 const std::string& stream_label, | 670 const std::string& stream_label, |
656 const std::string& track_id, | 671 const std::string& track_id, |
657 cricket::MediaType media_type) { | 672 cricket::MediaType media_type) { |
658 MediaStreamInterface* stream = remote_streams_->find(stream_label); | 673 MediaStreamInterface* stream = remote_streams_->find(stream_label); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 remote_streams_->find(kDefaultStreamLabel); | 744 remote_streams_->find(kDefaultStreamLabel); |
730 if (default_remote_stream == NULL) { | 745 if (default_remote_stream == NULL) { |
731 default_created = true; | 746 default_created = true; |
732 default_remote_stream = | 747 default_remote_stream = |
733 remote_stream_factory_->CreateMediaStream(kDefaultStreamLabel); | 748 remote_stream_factory_->CreateMediaStream(kDefaultStreamLabel); |
734 remote_streams_->AddStream(default_remote_stream); | 749 remote_streams_->AddStream(default_remote_stream); |
735 } | 750 } |
736 if (remote_info_.default_audio_track_needed && | 751 if (remote_info_.default_audio_track_needed && |
737 default_remote_stream->GetAudioTracks().size() == 0) { | 752 default_remote_stream->GetAudioTracks().size() == 0) { |
738 remote_audio_tracks_.push_back(TrackInfo(kDefaultStreamLabel, | 753 remote_audio_tracks_.push_back(TrackInfo(kDefaultStreamLabel, |
739 kDefaultAudioTrackLabel, 0)); | 754 kDefaultAudioTrackLabel, 0, |
| 755 remote_info_.default_audio_mid)); |
740 | 756 |
741 OnRemoteTrackSeen(kDefaultStreamLabel, kDefaultAudioTrackLabel, 0, | 757 OnRemoteTrackSeen(kDefaultStreamLabel, kDefaultAudioTrackLabel, 0, |
742 cricket::MEDIA_TYPE_AUDIO); | 758 cricket::MEDIA_TYPE_AUDIO, |
| 759 remote_info_.default_audio_mid); |
743 } | 760 } |
744 if (remote_info_.default_video_track_needed && | 761 if (remote_info_.default_video_track_needed && |
745 default_remote_stream->GetVideoTracks().size() == 0) { | 762 default_remote_stream->GetVideoTracks().size() == 0) { |
746 remote_video_tracks_.push_back(TrackInfo(kDefaultStreamLabel, | 763 remote_video_tracks_.push_back(TrackInfo(kDefaultStreamLabel, |
747 kDefaultVideoTrackLabel, 0)); | 764 kDefaultVideoTrackLabel, 0, |
| 765 remote_info_.default_video_mid)); |
748 OnRemoteTrackSeen(kDefaultStreamLabel, kDefaultVideoTrackLabel, 0, | 766 OnRemoteTrackSeen(kDefaultStreamLabel, kDefaultVideoTrackLabel, 0, |
749 cricket::MEDIA_TYPE_VIDEO); | 767 cricket::MEDIA_TYPE_VIDEO, |
| 768 remote_info_.default_video_mid); |
750 } | 769 } |
751 if (default_created) { | 770 if (default_created) { |
752 stream_observer_->OnAddRemoteStream(default_remote_stream); | 771 stream_observer_->OnAddRemoteStream(default_remote_stream); |
753 } | 772 } |
754 } | 773 } |
755 | 774 |
756 MediaStreamSignaling::TrackInfos* MediaStreamSignaling::GetRemoteTracks( | 775 MediaStreamSignaling::TrackInfos* MediaStreamSignaling::GetRemoteTracks( |
757 cricket::MediaType type) { | 776 cricket::MediaType type) { |
758 if (type == cricket::MEDIA_TYPE_AUDIO) | 777 if (type == cricket::MEDIA_TYPE_AUDIO) |
759 return &remote_audio_tracks_; | 778 return &remote_audio_tracks_; |
760 else if (type == cricket::MEDIA_TYPE_VIDEO) | 779 else if (type == cricket::MEDIA_TYPE_VIDEO) |
761 return &remote_video_tracks_; | 780 return &remote_video_tracks_; |
762 ASSERT(false && "Unknown MediaType"); | 781 ASSERT(false && "Unknown MediaType"); |
763 return NULL; | 782 return NULL; |
764 } | 783 } |
765 | 784 |
766 MediaStreamSignaling::TrackInfos* MediaStreamSignaling::GetLocalTracks( | 785 MediaStreamSignaling::TrackInfos* MediaStreamSignaling::GetLocalTracks( |
767 cricket::MediaType media_type) { | 786 cricket::MediaType media_type) { |
768 ASSERT(media_type == cricket::MEDIA_TYPE_AUDIO || | 787 ASSERT(media_type == cricket::MEDIA_TYPE_AUDIO || |
769 media_type == cricket::MEDIA_TYPE_VIDEO); | 788 media_type == cricket::MEDIA_TYPE_VIDEO); |
770 | 789 |
771 return (media_type == cricket::MEDIA_TYPE_AUDIO) ? | 790 return (media_type == cricket::MEDIA_TYPE_AUDIO) ? |
772 &local_audio_tracks_ : &local_video_tracks_; | 791 &local_audio_tracks_ : &local_video_tracks_; |
773 } | 792 } |
774 | 793 |
775 void MediaStreamSignaling::UpdateLocalTracks( | 794 void MediaStreamSignaling::UpdateLocalTracks( |
776 const std::vector<cricket::StreamParams>& streams, | 795 const std::vector<cricket::StreamParams>& streams, |
777 cricket::MediaType media_type) { | 796 cricket::MediaType media_type, |
| 797 const std::string& mid) { |
778 TrackInfos* current_tracks = GetLocalTracks(media_type); | 798 TrackInfos* current_tracks = GetLocalTracks(media_type); |
779 | 799 |
780 // Find removed tracks. Ie tracks where the track id, stream label or ssrc | 800 // Find removed tracks. Ie tracks where the track id, stream label or ssrc |
781 // don't match the new StreamParam. | 801 // don't match the new StreamParam. |
782 TrackInfos::iterator track_it = current_tracks->begin(); | 802 TrackInfos::iterator track_it = current_tracks->begin(); |
783 while (track_it != current_tracks->end()) { | 803 while (track_it != current_tracks->end()) { |
784 const TrackInfo& info = *track_it; | 804 const TrackInfo& info = *track_it; |
785 const cricket::StreamParams* params = | 805 const cricket::StreamParams* params = |
786 cricket::GetStreamBySsrc(streams, info.ssrc); | 806 cricket::GetStreamBySsrc(streams, info.ssrc); |
787 if (!params || params->id != info.track_id || | 807 if (!params || params->id != info.track_id || |
(...skipping 11 matching lines...) Expand all Loading... |
799 it != streams.end(); ++it) { | 819 it != streams.end(); ++it) { |
800 // The sync_label is the MediaStream label and the |stream.id| is the | 820 // The sync_label is the MediaStream label and the |stream.id| is the |
801 // track id. | 821 // track id. |
802 const std::string& stream_label = it->sync_label; | 822 const std::string& stream_label = it->sync_label; |
803 const std::string& track_id = it->id; | 823 const std::string& track_id = it->id; |
804 uint32 ssrc = it->first_ssrc(); | 824 uint32 ssrc = it->first_ssrc(); |
805 const TrackInfo* track_info = FindTrackInfo(*current_tracks, | 825 const TrackInfo* track_info = FindTrackInfo(*current_tracks, |
806 stream_label, | 826 stream_label, |
807 track_id); | 827 track_id); |
808 if (!track_info) { | 828 if (!track_info) { |
809 current_tracks->push_back(TrackInfo(stream_label, track_id, ssrc)); | 829 current_tracks->push_back(TrackInfo(stream_label, track_id, ssrc, mid)); |
810 OnLocalTrackSeen(stream_label, track_id, it->first_ssrc(), | 830 OnLocalTrackSeen(stream_label, track_id, it->first_ssrc(), media_type, |
811 media_type); | 831 mid); |
812 } | 832 } |
813 } | 833 } |
814 } | 834 } |
815 | 835 |
816 void MediaStreamSignaling::OnLocalTrackSeen( | 836 void MediaStreamSignaling::OnLocalTrackSeen(const std::string& stream_label, |
817 const std::string& stream_label, | 837 const std::string& track_id, |
818 const std::string& track_id, | 838 uint32 ssrc, |
819 uint32 ssrc, | 839 cricket::MediaType media_type, |
820 cricket::MediaType media_type) { | 840 const std::string& mid) { |
821 MediaStreamInterface* stream = local_streams_->find(stream_label); | 841 MediaStreamInterface* stream = local_streams_->find(stream_label); |
822 if (!stream) { | 842 if (!stream) { |
823 LOG(LS_WARNING) << "An unknown local MediaStream with label " | 843 LOG(LS_WARNING) << "An unknown local MediaStream with label " |
824 << stream_label << " has been configured."; | 844 << stream_label << " has been configured."; |
825 return; | 845 return; |
826 } | 846 } |
827 | 847 |
828 if (media_type == cricket::MEDIA_TYPE_AUDIO) { | 848 if (media_type == cricket::MEDIA_TYPE_AUDIO) { |
829 AudioTrackInterface* audio_track = stream->FindAudioTrack(track_id); | 849 AudioTrackInterface* audio_track = stream->FindAudioTrack(track_id); |
830 if (!audio_track) { | 850 if (!audio_track) { |
831 LOG(LS_WARNING) << "An unknown local AudioTrack with id , " | 851 LOG(LS_WARNING) << "An unknown local AudioTrack with id , " |
832 << track_id << " has been configured."; | 852 << track_id << " has been configured."; |
833 return; | 853 return; |
834 } | 854 } |
835 stream_observer_->OnAddLocalAudioTrack(stream, audio_track, ssrc); | 855 stream_observer_->OnAddLocalAudioTrack(stream, audio_track, ssrc, mid); |
836 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 856 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
837 VideoTrackInterface* video_track = stream->FindVideoTrack(track_id); | 857 VideoTrackInterface* video_track = stream->FindVideoTrack(track_id); |
838 if (!video_track) { | 858 if (!video_track) { |
839 LOG(LS_WARNING) << "An unknown local VideoTrack with id , " | 859 LOG(LS_WARNING) << "An unknown local VideoTrack with id , " |
840 << track_id << " has been configured."; | 860 << track_id << " has been configured."; |
841 return; | 861 return; |
842 } | 862 } |
843 stream_observer_->OnAddLocalVideoTrack(stream, video_track, ssrc); | 863 stream_observer_->OnAddLocalVideoTrack(stream, video_track, ssrc, mid); |
844 } else { | 864 } else { |
845 ASSERT(false && "Invalid media type"); | 865 ASSERT(false && "Invalid media type"); |
846 } | 866 } |
847 } | 867 } |
848 | 868 |
849 void MediaStreamSignaling::OnLocalTrackRemoved( | 869 void MediaStreamSignaling::OnLocalTrackRemoved( |
850 const std::string& stream_label, | 870 const std::string& stream_label, |
851 const std::string& track_id, | 871 const std::string& track_id, |
852 uint32 ssrc, | 872 uint32 ssrc, |
853 cricket::MediaType media_type) { | 873 cricket::MediaType media_type) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 int MediaStreamSignaling::FindDataChannelBySid(int sid) const { | 1041 int MediaStreamSignaling::FindDataChannelBySid(int sid) const { |
1022 for (size_t i = 0; i < sctp_data_channels_.size(); ++i) { | 1042 for (size_t i = 0; i < sctp_data_channels_.size(); ++i) { |
1023 if (sctp_data_channels_[i]->id() == sid) { | 1043 if (sctp_data_channels_[i]->id() == sid) { |
1024 return static_cast<int>(i); | 1044 return static_cast<int>(i); |
1025 } | 1045 } |
1026 } | 1046 } |
1027 return -1; | 1047 return -1; |
1028 } | 1048 } |
1029 | 1049 |
1030 } // namespace webrtc | 1050 } // namespace webrtc |
OLD | NEW |