Commit 860809ad authored by tommyw@google.com's avatar tommyw@google.com

MediaStream API: Adding the new id attribute to MediaStream and MediaStreamTrack

https://bugs.webkit.org/show_bug.cgi?id=106564

Reviewed by Adam Barth.

Specification: http://dev.w3.org/2011/webrtc/editor/getusermedia.html
MediaStream looses its label attribute and instead gets an id attribute.
MediaStreamTrack gets an id attribute.

Source/Platform:

* chromium/public/WebMediaStreamComponent.h:
(WebMediaStreamComponent):
* chromium/public/WebMediaStreamDescriptor.h:
(WebMediaStreamDescriptor):

Source/WebCore:

Not testable yet, will add tests in a followup patch.

* Modules/mediastream/MediaStream.h:
(WebCore::MediaStream::label):
(MediaStream):
(WebCore::MediaStream::id):
* Modules/mediastream/MediaStream.idl:
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::id):
(WebCore):
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/MediaStreamTrack.idl:
* platform/chromium/support/WebMediaStreamComponent.cpp:
(WebKit::WebMediaStreamComponent::initialize):
(WebKit):
(WebKit::WebMediaStreamComponent::isEnabled):
(WebKit::WebMediaStreamComponent::id):
(WebKit::WebMediaStreamComponent::source):
* platform/chromium/support/WebMediaStreamDescriptor.cpp:
(WebKit::WebMediaStreamDescriptor::label):
(WebKit):
(WebKit::WebMediaStreamDescriptor::id):
* platform/mediastream/MediaStreamComponent.h:
(WebCore::MediaStreamComponent::id):
(WebCore::MediaStreamComponent::MediaStreamComponent):
(MediaStreamComponent):
* platform/mediastream/MediaStreamDescriptor.h:
(WebCore::MediaStreamDescriptor::create):
(WebCore::MediaStreamDescriptor::id):
(WebCore::MediaStreamDescriptor::MediaStreamDescriptor):
(MediaStreamDescriptor):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139352 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6a06c734
2013-01-10 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Adding the new id attribute to MediaStream and MediaStreamTrack
https://bugs.webkit.org/show_bug.cgi?id=106564
Reviewed by Adam Barth.
Specification: http://dev.w3.org/2011/webrtc/editor/getusermedia.html
MediaStream looses its label attribute and instead gets an id attribute.
MediaStreamTrack gets an id attribute.
* chromium/public/WebMediaStreamComponent.h:
(WebMediaStreamComponent):
* chromium/public/WebMediaStreamDescriptor.h:
(WebMediaStreamDescriptor):
2013-01-09 Chris Rogers <crogers@google.com>
Allow live/local audio input to be enabled only when needed
......
......@@ -56,9 +56,12 @@ public:
return *this;
}
WEBKIT_EXPORT void assign(const WebMediaStreamComponent&);
WEBKIT_EXPORT void initialize(const WebMediaStreamSource&);
WEBKIT_EXPORT void reset();
bool isNull() const { return m_private.isNull(); }
WEBKIT_EXPORT WebString id() const;
WEBKIT_EXPORT WebMediaStreamSource source() const;
WEBKIT_EXPORT bool isEnabled() const;
......
......@@ -63,8 +63,11 @@ public:
WEBKIT_EXPORT void reset();
bool isNull() const { return m_private.isNull(); }
// DEPRECATED
WEBKIT_EXPORT WebString label() const;
WEBKIT_EXPORT WebString id() const;
WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamComponent>&) const;
WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamComponent>&) const;
......
2013-01-10 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Adding the new id attribute to MediaStream and MediaStreamTrack
https://bugs.webkit.org/show_bug.cgi?id=106564
Reviewed by Adam Barth.
Specification: http://dev.w3.org/2011/webrtc/editor/getusermedia.html
MediaStream looses its label attribute and instead gets an id attribute.
MediaStreamTrack gets an id attribute.
Not testable yet, will add tests in a followup patch.
* Modules/mediastream/MediaStream.h:
(WebCore::MediaStream::label):
(MediaStream):
(WebCore::MediaStream::id):
* Modules/mediastream/MediaStream.idl:
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::id):
(WebCore):
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/MediaStreamTrack.idl:
* platform/chromium/support/WebMediaStreamComponent.cpp:
(WebKit::WebMediaStreamComponent::initialize):
(WebKit):
(WebKit::WebMediaStreamComponent::isEnabled):
(WebKit::WebMediaStreamComponent::id):
(WebKit::WebMediaStreamComponent::source):
* platform/chromium/support/WebMediaStreamDescriptor.cpp:
(WebKit::WebMediaStreamDescriptor::label):
(WebKit):
(WebKit::WebMediaStreamDescriptor::id):
* platform/mediastream/MediaStreamComponent.h:
(WebCore::MediaStreamComponent::id):
(WebCore::MediaStreamComponent::MediaStreamComponent):
(MediaStreamComponent):
* platform/mediastream/MediaStreamDescriptor.h:
(WebCore::MediaStreamDescriptor::create):
(WebCore::MediaStreamDescriptor::id):
(WebCore::MediaStreamDescriptor::MediaStreamDescriptor):
(MediaStreamDescriptor):
2013-01-10 Ojan Vafai <ojan@chromium.org>
Flexboxes incorrectly add the scrollbar width to the intrinsic width of fixed-width items
......@@ -53,7 +53,11 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(ended);
ReadyState readyState() const;
String label() const { return m_descriptor->label(); }
// DEPRECATED
String label() const { return m_descriptor->id(); }
String id() const { return m_descriptor->id(); }
MediaStreamTrackList* audioTracks() { return m_audioTracks.get(); }
MediaStreamTrackList* videoTracks() { return m_videoTracks.get(); }
......
......@@ -30,13 +30,15 @@
Constructor(in MediaStreamTrack[] tracks),
ConstructorParameters=0,
CallWith=ScriptExecutionContext,
] interface MediaStream {
] interface MediaStream {
// DEPRECATED
readonly attribute DOMString label;
readonly attribute DOMString id;
readonly attribute MediaStreamTrackList audioTracks;
readonly attribute MediaStreamTrackList videoTracks;
// FIXME: implement the record method when MediaStreamRecorder is available.
const unsigned short LIVE = 1;
const unsigned short ENDED = 2;
readonly attribute unsigned short readyState;
......
......@@ -71,6 +71,11 @@ String MediaStreamTrack::kind() const
return audioKind;
}
String MediaStreamTrack::id() const
{
return m_component->id();
}
String MediaStreamTrack::label() const
{
return m_component->source()->name();
......
......@@ -53,6 +53,7 @@ public:
virtual ~MediaStreamTrack();
String kind() const;
String id() const;
String label() const;
bool enabled() const;
......
......@@ -28,6 +28,7 @@
ActiveDOMObject
] interface MediaStreamTrack {
readonly attribute DOMString kind;
readonly attribute DOMString id;
readonly attribute DOMString label;
attribute boolean enabled;
......
......@@ -54,6 +54,11 @@ WebMediaStreamComponent& WebMediaStreamComponent::operator=(WebCore::MediaStream
return *this;
}
void WebMediaStreamComponent::initialize(const WebMediaStreamSource& source)
{
m_private = MediaStreamComponent::create(source);
}
void WebMediaStreamComponent::reset()
{
m_private.reset();
......@@ -72,13 +77,19 @@ WebMediaStreamComponent::operator MediaStreamComponent*() const
bool WebMediaStreamComponent::isEnabled() const
{
ASSERT(!m_private.isNull());
return m_private.get()->enabled();
return m_private->enabled();
}
WebString WebMediaStreamComponent::id() const
{
ASSERT(!m_private.isNull());
return m_private->id();
}
WebMediaStreamSource WebMediaStreamComponent::source() const
{
ASSERT(!m_private.isNull());
return WebMediaStreamSource(m_private.get()->source());
return WebMediaStreamSource(m_private->source());
}
void WebMediaStreamComponent::assign(const WebMediaStreamComponent& other)
......
......@@ -65,7 +65,12 @@ void WebMediaStreamDescriptor::reset()
WebString WebMediaStreamDescriptor::label() const
{
return m_private->label();
return m_private->id();
}
WebString WebMediaStreamDescriptor::id() const
{
return m_private->id();
}
class ExtraDataContainer : public WebCore::MediaStreamDescriptor::ExtraData {
......
......@@ -34,6 +34,7 @@
#if ENABLE(MEDIA_STREAM)
#include "MediaStreamSource.h"
#include "UUID.h"
namespace WebCore {
......@@ -46,17 +47,20 @@ public:
MediaStreamSource* source() const { return m_source.get(); }
String id() const { return m_id; }
bool enabled() const { return m_enabled; }
void setEnabled(bool enabled) { m_enabled = enabled; }
private:
MediaStreamComponent(PassRefPtr<MediaStreamSource> source)
: m_source(source)
, m_id(createCanonicalUUIDString())
, m_enabled(true)
{
}
RefPtr<MediaStreamSource> m_source;
String m_id;
bool m_enabled;
};
......
......@@ -56,15 +56,15 @@ public:
virtual ~ExtraData() { }
};
static PassRefPtr<MediaStreamDescriptor> create(const String& label, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
static PassRefPtr<MediaStreamDescriptor> create(const String& id, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
{
return adoptRef(new MediaStreamDescriptor(label, audioSources, videoSources));
return adoptRef(new MediaStreamDescriptor(id, audioSources, videoSources));
}
MediaStreamDescriptorClient* client() const { return m_client; }
void setClient(MediaStreamDescriptorClient* client) { m_client = client; }
String label() const { return m_label; }
String id() const { return m_id; }
unsigned numberOfAudioComponents() const { return m_audioComponents.size(); }
MediaStreamComponent* audioComponent(unsigned index) const { return m_audioComponents[index].get(); }
......@@ -79,9 +79,9 @@ public:
void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; }
private:
MediaStreamDescriptor(const String& label, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
: m_client(0)
, m_label(label)
, m_id(id)
, m_ended(false)
{
for (size_t i = 0; i < audioSources.size(); i++)
......@@ -92,7 +92,7 @@ private:
}
MediaStreamDescriptorClient* m_client;
String m_label;
String m_id;
Vector<RefPtr<MediaStreamComponent> > m_audioComponents;
Vector<RefPtr<MediaStreamComponent> > m_videoComponents;
bool m_ended;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment