MediaStreamDescriptor::MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) : m_client(0) , m_id(id) , m_ended(false) { ASSERT(m_id.length()); for (size_t i = 0; i < audioSources.size(); i++) m_audioComponents.append(MediaStreamComponent::create(this, audioSources[i])); for (size_t i = 0; i < videoSources.size(); i++) m_videoComponents.append(MediaStreamComponent::create(this, videoSources[i])); }
MediaStreamDescriptor::MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources, bool ended) : m_client(0) , m_id(id) , m_ended(ended) { ASSERT(m_id.length()); for (size_t i = 0; i < audioSources.size(); i++) { audioSources[i]->setStream(this); m_audioStreamSources.append(audioSources[i]); } for (size_t i = 0; i < videoSources.size(); i++) { videoSources[i]->setStream(this); m_videoStreamSources.append(videoSources[i]); } }
static bool containsSource(MediaStreamSourceVector& sourceVector, MediaStreamSource* source) { for (size_t i = 0; i < sourceVector.size(); ++i) { if (source->id() == sourceVector[i]->id()) return true; } return false; }