Skip to content

Commit

Permalink
Revert "Remove MediaStreamDescriptor and call/use WebMediaStream dire…
Browse files Browse the repository at this point in the history
…ctly (attempt #3)" (r152913).

Speculative revert to fix VideoDestination browser_tests failures.

(Sorry if this turns out to be a mis-fire).

[email protected]
BUG=

Review URL: https://codereview.chromium.org/17553017

git-svn-id: svn://svn.chromium.org/blink/trunk@152926 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
[email protected] committed Jun 22, 2013
1 parent 6be9399 commit 6b5ecc1
Show file tree
Hide file tree
Showing 34 changed files with 223 additions and 359 deletions.
2 changes: 1 addition & 1 deletion Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void WebMediaPlayerClientImpl::loadRequested()

void WebMediaPlayerClientImpl::loadInternal()
{
m_isMediaStream = !(WebCore::MediaStreamRegistry::registry().lookupWebMediaStream(m_url.string()).isNull());
m_isMediaStream = WebCore::MediaStreamRegistry::registry().lookupMediaStreamDescriptor(m_url.string());

#if ENABLE(WEB_AUDIO)
m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's WebAudioSourceProvider.
Expand Down
3 changes: 2 additions & 1 deletion Source/WebKit/chromium/src/WebMediaStreamRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "WebMediaStreamRegistry.h"

#include "core/platform/mediastream/MediaStreamDescriptor.h"
#include "modules/mediastream/MediaStreamRegistry.h"
#include "public/platform/WebMediaStream.h"
#include "public/platform/WebString.h"
Expand All @@ -44,7 +45,7 @@ namespace WebKit {

WebMediaStream WebMediaStreamRegistry::lookupMediaStreamDescriptor(const WebURL& url)
{
return WebMediaStream(MediaStreamRegistry::registry().lookupWebMediaStream(KURL(url).string()));
return WebMediaStream(MediaStreamRegistry::registry().lookupMediaStreamDescriptor(KURL(url).string()));
}

} // namespace WebKit
7 changes: 4 additions & 3 deletions Source/WebKit/chromium/src/WebUserMediaRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "WebSecurityOrigin.h"
#include "core/dom/Document.h"
#include "core/platform/mediastream/MediaConstraints.h"
#include "core/platform/mediastream/MediaStreamDescriptor.h"
#include "core/platform/mediastream/MediaStreamSource.h"
#include "modules/mediastream/UserMediaRequest.h"
#include "weborigin/SecurityOrigin.h"
Expand Down Expand Up @@ -101,10 +102,10 @@ WebDocument WebUserMediaRequest::ownerDocument() const
return WebDocument(m_private->ownerDocument());
}

void WebUserMediaRequest::requestSucceeded(const WebMediaStream& webStream)
void WebUserMediaRequest::requestSucceeded(const WebMediaStream& streamDescriptor)
{
ASSERT(!isNull() && !webStream.isNull());
m_private->succeed(webStream);
ASSERT(!isNull() && !streamDescriptor.isNull());
m_private->succeed(streamDescriptor);
}

void WebUserMediaRequest::requestFailed(const WebString& description)
Expand Down
5 changes: 2 additions & 3 deletions Source/core/core.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -3018,6 +3018,8 @@
'platform/mediastream/MediaStreamCenter.h',
'platform/mediastream/MediaStreamComponent.cpp',
'platform/mediastream/MediaStreamComponent.h',
'platform/mediastream/MediaStreamDescriptor.cpp',
'platform/mediastream/MediaStreamDescriptor.h',
'platform/mediastream/MediaStreamSource.cpp',
'platform/mediastream/MediaStreamSource.h',
'platform/mediastream/RTCConfiguration.h',
Expand Down Expand Up @@ -3609,9 +3611,6 @@
'platform/chromium/support/WebHTTPLoadInfo.cpp',
'platform/chromium/support/WebMediaConstraints.cpp',
'platform/chromium/support/WebMediaStream.cpp',
'platform/chromium/support/WebMediaStreamClient.h',
'platform/chromium/support/WebMediaStreamPrivate.cpp',
'platform/chromium/support/WebMediaStreamPrivate.h',
'platform/chromium/support/WebMediaStreamSource.cpp',
'platform/chromium/support/WebMediaStreamSourcesRequest.cpp',
'platform/chromium/support/WebMediaStreamTrack.cpp',
Expand Down
2 changes: 1 addition & 1 deletion Source/core/html/HTMLMediaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content

LOG(Media, "HTMLMediaElement::loadResource - m_currentSrc -> %s", urlForLoggingMedia(m_currentSrc).utf8().data());

if (!(MediaStreamRegistry::registry().lookupWebMediaStream(url.string()).isNull()))
if (MediaStreamRegistry::registry().lookupMediaStreamDescriptor(url.string()))
removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction);

if (m_sendProgressEvents)
Expand Down
89 changes: 24 additions & 65 deletions Source/core/platform/chromium/support/WebMediaStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include "public/platform/WebMediaStream.h"

#include "core/platform/UUID.h"
#include "core/platform/chromium/support/WebMediaStreamPrivate.h"
#include "core/platform/mediastream/MediaStreamComponent.h"
#include "core/platform/mediastream/MediaStreamDescriptor.h"
#include "core/platform/mediastream/MediaStreamSource.h"
#include "public/platform/WebMediaStreamSource.h"
#include "public/platform/WebMediaStreamTrack.h"
Expand All @@ -43,7 +43,7 @@ namespace WebKit {

namespace {

class ExtraDataContainer : public WebMediaStreamPrivate::ExtraData {
class ExtraDataContainer : public MediaStreamDescriptor::ExtraData {
public:
ExtraDataContainer(WebMediaStream::ExtraData* extraData) : m_extraData(adoptPtr(extraData)) { }

Expand All @@ -55,8 +55,13 @@ class ExtraDataContainer : public WebMediaStreamPrivate::ExtraData {

} // namespace

WebMediaStream::WebMediaStream(WebMediaStreamPrivate* stream)
: m_private(stream)
WebMediaStream::WebMediaStream(const PassRefPtr<WebCore::MediaStreamDescriptor>& mediaStreamDescriptor)
: m_private(mediaStreamDescriptor)
{
}

WebMediaStream::WebMediaStream(WebCore::MediaStreamDescriptor* mediaStreamDescriptor)
: m_private(mediaStreamDescriptor)
{
}

Expand All @@ -77,7 +82,7 @@ WebString WebMediaStream::id() const

WebMediaStream::ExtraData* WebMediaStream::extraData() const
{
RefPtr<WebMediaStreamPrivate::ExtraData> data = m_private->extraData();
RefPtr<MediaStreamDescriptor::ExtraData> data = m_private->extraData();
if (!data)
return 0;
return static_cast<ExtraDataContainer*>(data.get())->extraData();
Expand Down Expand Up @@ -106,78 +111,32 @@ void WebMediaStream::videoTracks(WebVector<WebMediaStreamTrack>& webTracks) cons
webTracks.swap(result);
}

unsigned WebMediaStream::numberOfAudioComponents() const
{
return m_private->numberOfAudioComponents();
}

WebCore::MediaStreamComponent* WebMediaStream::audioComponent(unsigned index) const
{
return m_private->audioComponent(index);
}

unsigned WebMediaStream::numberOfVideoComponents() const
{
return m_private->numberOfVideoComponents();
}

WebCore::MediaStreamComponent* WebMediaStream::videoComponent(unsigned index) const
{
return m_private->videoComponent(index);
}

void WebMediaStream::addComponent(WebCore::MediaStreamComponent* component)
void WebMediaStream::addTrack(const WebMediaStreamTrack& track)
{
ASSERT(!isNull());
m_private->addComponent(component);
m_private->addRemoteTrack(track);
}

void WebMediaStream::removeComponent(WebCore::MediaStreamComponent* component)
void WebMediaStream::removeTrack(const WebMediaStreamTrack& track)
{
ASSERT(!isNull());
m_private->removeComponent(component);
}

void WebMediaStream::trackEnded()
{
m_private->client()->trackEnded();
}

void WebMediaStream::streamEnded()
{
m_private->client()->streamEnded();
}

bool WebMediaStream::ended() const
{
return m_private->ended();
}

void WebMediaStream::setEnded()
{
m_private->setEnded();
}

WebMediaStreamClient* WebMediaStream::client()
{
return m_private->client();
m_private->removeRemoteTrack(track);
}

void WebMediaStream::setClient(WebMediaStreamClient* client)
WebMediaStream& WebMediaStream::operator=(const PassRefPtr<WebCore::MediaStreamDescriptor>& mediaStreamDescriptor)
{
m_private->setClient(client);
m_private = mediaStreamDescriptor;
return *this;
}

void WebMediaStream::addTrack(const WebMediaStreamTrack& track)
WebMediaStream::operator PassRefPtr<WebCore::MediaStreamDescriptor>() const
{
ASSERT(!isNull());
m_private->addRemoteTrack(track);
return m_private.get();
}

void WebMediaStream::removeTrack(const WebMediaStreamTrack& track)
WebMediaStream::operator WebCore::MediaStreamDescriptor*() const
{
ASSERT(!isNull());
m_private->removeRemoteTrack(track);
return m_private.get();
}

void WebMediaStream::initialize(const WebString& label, const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources)
Expand All @@ -191,12 +150,12 @@ void WebMediaStream::initialize(const WebString& label, const WebVector<WebMedia
MediaStreamSource* source = videoSources[i];
video.append(MediaStreamComponent::create(source->id(), source));
}
m_private = WebMediaStreamPrivate::create(label, audio, video);
m_private = MediaStreamDescriptor::create(label, audio, video);
}

void WebMediaStream::initialize(const WebVector<WebMediaStreamTrack>& audioTracks, const WebVector<WebMediaStreamTrack>& videoTracks)
{
initialize(WebCore::createCanonicalUUIDString(), audioTracks, videoTracks);
initialize(createCanonicalUUIDString(), audioTracks, videoTracks);
}

void WebMediaStream::initialize(const WebString& label, const WebVector<WebMediaStreamTrack>& audioTracks, const WebVector<WebMediaStreamTrack>& videoTracks)
Expand All @@ -210,7 +169,7 @@ void WebMediaStream::initialize(const WebString& label, const WebVector<WebMedia
MediaStreamComponent* component = videoTracks[i];
video.append(component);
}
m_private = WebMediaStreamPrivate::create(label, audio, video);
m_private = MediaStreamDescriptor::create(label, audio, video);
}

void WebMediaStream::assign(const WebMediaStream& other)
Expand Down
50 changes: 0 additions & 50 deletions Source/core/platform/chromium/support/WebMediaStreamClient.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool WebRTCStatsRequest::hasSelector() const

const WebMediaStream WebRTCStatsRequest::stream() const
{
return m_private->stream();
return WebMediaStream(m_private->stream());
}

const WebMediaStreamTrack WebRTCStatsRequest::component() const
Expand Down
31 changes: 16 additions & 15 deletions Source/core/platform/mediastream/MediaStreamCenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@

#include "core/platform/mediastream/MediaStreamCenter.h"

#include "core/platform/chromium/support/WebMediaStreamClient.h"
#include "core/platform/mediastream/MediaStreamSource.h"
#include "core/platform/mediastream/MediaStreamDescriptor.h"
#include "core/platform/mediastream/MediaStreamSourcesQueryClient.h"
#include "modules/mediastream/MediaStreamTrackSourcesRequest.h"
#include "public/platform/Platform.h"
Expand Down Expand Up @@ -68,7 +67,7 @@ bool MediaStreamCenter::getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSo
return m_private && m_private->getMediaStreamTrackSources(request);
}

void MediaStreamCenter::didSetMediaStreamTrackEnabled(WebKit::WebMediaStream stream, MediaStreamComponent* component)
void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component)
{
if (m_private) {
if (component->enabled())
Expand All @@ -78,41 +77,43 @@ void MediaStreamCenter::didSetMediaStreamTrackEnabled(WebKit::WebMediaStream str
}
}

bool MediaStreamCenter::didAddMediaStreamTrack(WebKit::WebMediaStream stream, MediaStreamComponent* component)
bool MediaStreamCenter::didAddMediaStreamTrack(MediaStreamDescriptor* stream, MediaStreamComponent* component)
{
return m_private && m_private->didAddMediaStreamTrack(stream, component);
}

bool MediaStreamCenter::didRemoveMediaStreamTrack(WebKit::WebMediaStream stream, MediaStreamComponent* component)
bool MediaStreamCenter::didRemoveMediaStreamTrack(MediaStreamDescriptor* stream, MediaStreamComponent* component)
{
return m_private && m_private->didRemoveMediaStreamTrack(stream, component);
}

void MediaStreamCenter::didStopLocalMediaStream(WebKit::WebMediaStream stream)
void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor* stream)
{
if (m_private) {
m_private->didStopLocalMediaStream(stream);
for (unsigned i = 0; i < stream.numberOfAudioComponents(); i++)
stream.audioComponent(i)->source()->setReadyState(MediaStreamSource::ReadyStateEnded);
for (unsigned i = 0; i < stream.numberOfVideoComponents(); i++)
stream.videoComponent(i)->source()->setReadyState(MediaStreamSource::ReadyStateEnded);
for (unsigned i = 0; i < stream->numberOfAudioComponents(); i++)
stream->audioComponent(i)->source()->setReadyState(MediaStreamSource::ReadyStateEnded);
for (unsigned i = 0; i < stream->numberOfVideoComponents(); i++)
stream->videoComponent(i)->source()->setReadyState(MediaStreamSource::ReadyStateEnded);
}
}

void MediaStreamCenter::didCreateMediaStream(WebKit::WebMediaStream stream)
void MediaStreamCenter::didCreateMediaStream(MediaStreamDescriptor* stream)
{
if (m_private) {
m_private->didCreateMediaStream(stream);
WebKit::WebMediaStream webStream(stream);
m_private->didCreateMediaStream(webStream);
}
}

void MediaStreamCenter::stopLocalMediaStream(WebKit::WebMediaStream stream)
void MediaStreamCenter::stopLocalMediaStream(const WebKit::WebMediaStream& webStream)
{
WebKit::WebMediaStreamClient* client = stream.client();
MediaStreamDescriptor* stream = webStream;
MediaStreamDescriptorClient* client = stream->client();
if (client)
client->streamEnded();
else
stream.setEnded();
stream->setEnded();
}

} // namespace WebCore
12 changes: 6 additions & 6 deletions Source/core/platform/mediastream/MediaStreamCenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ class MediaStreamCenter : public WebKit::WebMediaStreamCenterClient {
static MediaStreamCenter& instance();

bool getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequest>);
void didSetMediaStreamTrackEnabled(WebKit::WebMediaStream, MediaStreamComponent*);
bool didAddMediaStreamTrack(WebKit::WebMediaStream, MediaStreamComponent*);
bool didRemoveMediaStreamTrack(WebKit::WebMediaStream, MediaStreamComponent*);
void didStopLocalMediaStream(WebKit::WebMediaStream);
void didCreateMediaStream(WebKit::WebMediaStream);
void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*);
bool didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*);
bool didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*);
void didStopLocalMediaStream(MediaStreamDescriptor*);
void didCreateMediaStream(MediaStreamDescriptor*);

// WebKit::WebMediaStreamCenterClient
virtual void stopLocalMediaStream(WebKit::WebMediaStream) OVERRIDE;
virtual void stopLocalMediaStream(const WebKit::WebMediaStream&) OVERRIDE;

private:
MediaStreamCenter();
Expand Down
Loading

0 comments on commit 6b5ecc1

Please sign in to comment.