#include "pc/track_media_info_map.h"
#include <cstdint>
#include <set>
#include <type_traits>
#include <utility>
#include "api/media_types.h"
#include "api/rtp_parameters.h"
#include "media/base/stream_params.h"
#include "rtc_base/checks.h"
#include "rtc_base/thread.h"
namespace webrtc {
namespace {
template <typename K, typename V>
V FindValueOrNull(const std::map<K, V>& map, const K& key) { … }
template <typename K, typename V>
const V* FindAddressOrNull(const std::map<K, V>& map, const K& key) { … }
void GetAudioAndVideoTrackBySsrc(
rtc::ArrayView<rtc::scoped_refptr<RtpSenderInternal>> rtp_senders,
rtc::ArrayView<rtc::scoped_refptr<RtpReceiverInternal>> rtp_receivers,
std::map<uint32_t, AudioTrackInterface*>* local_audio_track_by_ssrc,
std::map<uint32_t, VideoTrackInterface*>* local_video_track_by_ssrc,
std::map<uint32_t, AudioTrackInterface*>* remote_audio_track_by_ssrc,
std::map<uint32_t, VideoTrackInterface*>* remote_video_track_by_ssrc,
AudioTrackInterface** unsignaled_audio_track,
VideoTrackInterface** unsignaled_video_track) { … }
}
TrackMediaInfoMap::TrackMediaInfoMap() = default;
void TrackMediaInfoMap::Initialize(
absl::optional<cricket::VoiceMediaInfo> voice_media_info,
absl::optional<cricket::VideoMediaInfo> video_media_info,
rtc::ArrayView<rtc::scoped_refptr<RtpSenderInternal>> rtp_senders,
rtc::ArrayView<rtc::scoped_refptr<RtpReceiverInternal>> rtp_receivers) { … }
const cricket::VoiceSenderInfo* TrackMediaInfoMap::GetVoiceSenderInfoBySsrc(
uint32_t ssrc) const { … }
const cricket::VoiceReceiverInfo* TrackMediaInfoMap::GetVoiceReceiverInfoBySsrc(
uint32_t ssrc) const { … }
const cricket::VideoSenderInfo* TrackMediaInfoMap::GetVideoSenderInfoBySsrc(
uint32_t ssrc) const { … }
const cricket::VideoReceiverInfo* TrackMediaInfoMap::GetVideoReceiverInfoBySsrc(
uint32_t ssrc) const { … }
rtc::scoped_refptr<AudioTrackInterface> TrackMediaInfoMap::GetAudioTrack(
const cricket::VoiceSenderInfo& voice_sender_info) const { … }
rtc::scoped_refptr<AudioTrackInterface> TrackMediaInfoMap::GetAudioTrack(
const cricket::VoiceReceiverInfo& voice_receiver_info) const { … }
rtc::scoped_refptr<VideoTrackInterface> TrackMediaInfoMap::GetVideoTrack(
const cricket::VideoSenderInfo& video_sender_info) const { … }
rtc::scoped_refptr<VideoTrackInterface> TrackMediaInfoMap::GetVideoTrack(
const cricket::VideoReceiverInfo& video_receiver_info) const { … }
absl::optional<int> TrackMediaInfoMap::GetAttachmentIdByTrack(
const MediaStreamTrackInterface* track) const { … }
}