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

Unified Diff: Source/core/platform/mediastream/MediaStreamDescriptor.h

Issue 14989002: Splitting MediaStreamDescriptor.h and MediaStreamComponent.h into .h and .cpp (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/mediastream/MediaStreamDescriptor.h
diff --git a/Source/core/platform/mediastream/MediaStreamDescriptor.h b/Source/core/platform/mediastream/MediaStreamDescriptor.h
index 62aea80dbca9e1be9e4c8aa487ff815d27076cde..1e254bfb7931dfc55567a7e0d1f03b02a1d116eb 100644
--- a/Source/core/platform/mediastream/MediaStreamDescriptor.h
+++ b/Source/core/platform/mediastream/MediaStreamDescriptor.h
@@ -32,8 +32,8 @@
#ifndef MediaStreamDescriptor_h
#define MediaStreamDescriptor_h
-#include "core/platform/UUID.h"
#include "core/platform/mediastream/MediaStreamComponent.h"
+#include "core/platform/mediastream/MediaStreamSource.h"
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
@@ -56,15 +56,9 @@ public:
virtual ~ExtraData() { }
};
- static PassRefPtr<MediaStreamDescriptor> create(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
- {
- return adoptRef(new MediaStreamDescriptor(createCanonicalUUIDString(), audioSources, videoSources));
- }
+ static PassRefPtr<MediaStreamDescriptor> create(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
- static PassRefPtr<MediaStreamDescriptor> create(const String& id, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentVector& videoComponents)
- {
- return adoptRef(new MediaStreamDescriptor(id, audioComponents, videoComponents));
- }
+ static PassRefPtr<MediaStreamDescriptor> create(const String& id, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentVector& videoComponents);
MediaStreamDescriptorClient* client() const { return m_client; }
void setClient(MediaStreamDescriptorClient* client) { m_client = client; }
@@ -77,50 +71,11 @@ public:
unsigned numberOfVideoComponents() const { return m_videoComponents.size(); }
MediaStreamComponent* videoComponent(unsigned index) const { return m_videoComponents[index].get(); }
- void addComponent(PassRefPtr<MediaStreamComponent> component) {
- switch (component->source()->type()) {
- case MediaStreamSource::TypeAudio:
- if (m_audioComponents.find(component) == notFound)
- m_audioComponents.append(component);
- break;
- case MediaStreamSource::TypeVideo:
- if (m_videoComponents.find(component) == notFound)
- m_videoComponents.append(component);
- break;
- }
- }
-
- void removeComponent(PassRefPtr<MediaStreamComponent> component) {
- size_t pos = notFound;
- switch (component->source()->type()) {
- case MediaStreamSource::TypeAudio:
- pos = m_audioComponents.find(component);
- if (pos != notFound)
- m_audioComponents.remove(pos);
- break;
- case MediaStreamSource::TypeVideo:
- pos = m_videoComponents.find(component);
- if (pos != notFound)
- m_videoComponents.remove(pos);
- break;
- }
- }
-
- void addRemoteTrack(MediaStreamComponent* component)
- {
- if (m_client)
- m_client->addRemoteTrack(component);
- else
- addComponent(component);
- }
-
- void removeRemoteTrack(MediaStreamComponent* component)
- {
- if (m_client)
- m_client->removeRemoteTrack(component);
- else
- removeComponent(component);
- }
+ void addComponent(PassRefPtr<MediaStreamComponent>);
+ void removeComponent(PassRefPtr<MediaStreamComponent>);
+
+ void addRemoteTrack(MediaStreamComponent*);
+ void removeRemoteTrack(MediaStreamComponent*);
bool ended() const { return m_ended; }
void setEnded() { m_ended = true; }
@@ -129,34 +84,8 @@ public:
void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; }
private:
- 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(const String& id, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentVector& videoComponents)
- : m_client(0)
- , m_id(id)
- , m_ended(false)
- {
- ASSERT(m_id.length());
- for (MediaStreamComponentVector::const_iterator iter = audioComponents.begin(); iter != audioComponents.end(); ++iter) {
- (*iter)->setStream(this);
- m_audioComponents.append((*iter));
- }
- for (MediaStreamComponentVector::const_iterator iter = videoComponents.begin(); iter != videoComponents.end(); ++iter) {
- (*iter)->setStream(this);
- m_videoComponents.append((*iter));
- }
- }
+ MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
+ MediaStreamDescriptor(const String& id, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentVector& videoComponents);
MediaStreamDescriptorClient* m_client;
String m_id;
« no previous file with comments | « Source/core/platform/mediastream/MediaStreamComponent.cpp ('k') | Source/core/platform/mediastream/MediaStreamDescriptor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698