Modified: trunk/Source/WebCore/ChangeLog (208586 => 208587)
--- trunk/Source/WebCore/ChangeLog 2016-11-11 11:08:39 UTC (rev 208586)
+++ trunk/Source/WebCore/ChangeLog 2016-11-11 13:09:33 UTC (rev 208587)
@@ -1,3 +1,33 @@
+2016-11-11 Alejandro G. Castro <a...@igalia.com>
+
+ [WebRTC][OpenWebRTC] Implement device permissions handling solution for owr backend in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=164010
+
+ Reviewed by Philippe Normand.
+
+ Move the capture of the sources for the OWR backend to the
+ WebProcess. In the UI we continue checking if the user allows
+ access to the audio and video capture. When device handling is
+ added in the future we will need some persistent ID and API to
+ pass from the UI process to the Web process.
+
+ * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
+ (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
+ Add the proper audio and video sources to allow the UI message to
+ be properly rendered. We are adding the specific devices, even
+ though the dialog just asks for general audio and video. There was
+ already a FIXME about improving this.
+ (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): We are
+ capturing the devices here when the allowed message arrived from
+ the UI process. We store the completion handler to use it later
+ when the aync owr API finishes capture devices process.
+ (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): We
+ now call the completion handler in this callback called when the
+ owr library finishes the capture of the devices. Now this happens
+ in the WebProcess for OWR port.
+ * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
+ Add an attribute to store the completion handler.
+
2016-11-11 Manuel Rego Casasnovas <r...@igalia.com>
[css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
Modified: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp (208586 => 208587)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp 2016-11-11 11:08:39 UTC (rev 208586)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp 2016-11-11 13:09:33 UTC (rev 208587)
@@ -81,46 +81,35 @@
m_validConstraintsHandler = WTFMove(validHandler);
m_invalidConstraintsHandler = WTFMove(invalidHandler);
+ Vector<String> audioSources;
+ Vector<String> videoSources;
+
// FIXME: Actually do constraints validation. The MediaConstraints
// need to comply with the available audio/video device(s)
// capabilities. See bug #123345.
- int types = OWR_MEDIA_TYPE_UNKNOWN;
if (audioConstraints.isValid())
- types |= OWR_MEDIA_TYPE_AUDIO;
+ audioSources.append(String("audio"));
+
if (videoConstraints.isValid())
- types |= OWR_MEDIA_TYPE_VIDEO;
+ videoSources.append(String("video"));
- owr_get_capture_sources(static_cast<OwrMediaType>(types), mediaSourcesAvailableCallback, this);
+ m_validConstraintsHandler(WTFMove(audioSources), WTFMove(videoSources));
+ m_validConstraintsHandler = nullptr;
+ m_invalidConstraintsHandler = nullptr;
}
void RealtimeMediaSourceCenterOwr::createMediaStream(NewMediaStreamHandler completionHandler, const String& audioDeviceID, const String& videoDeviceID, const MediaConstraints*, const MediaConstraints*)
{
- Vector<RefPtr<RealtimeMediaSource>> audioSources;
- Vector<RefPtr<RealtimeMediaSource>> videoSources;
+ int types = OWR_MEDIA_TYPE_UNKNOWN;
- // FIXME: Actually apply constraints to newly created sources.
+ if (!audioDeviceID.isEmpty())
+ types |= OWR_MEDIA_TYPE_AUDIO;
+ if (!videoDeviceID.isEmpty())
+ types |= OWR_MEDIA_TYPE_VIDEO;
- if (!audioDeviceID.isEmpty()) {
- RealtimeMediaSourceOwrMap::iterator sourceIterator = m_sourceMap.find(audioDeviceID);
- if (sourceIterator != m_sourceMap.end()) {
- RefPtr<RealtimeMediaSource> source = sourceIterator->value;
- if (source->type() == RealtimeMediaSource::Audio)
- audioSources.append(source.release());
- }
- }
- if (!videoDeviceID.isEmpty()) {
- RealtimeMediaSourceOwrMap::iterator sourceIterator = m_sourceMap.find(videoDeviceID);
- if (sourceIterator != m_sourceMap.end()) {
- RefPtr<RealtimeMediaSource> source = sourceIterator->value;
- if (source->type() == RealtimeMediaSource::Video)
- videoSources.append(source.release());
- }
- }
+ m_completionHandler = completionHandler;
- if (videoSources.isEmpty() && audioSources.isEmpty())
- completionHandler(nullptr);
- else
- completionHandler(MediaStreamPrivate::create(audioSources, videoSources));
+ owr_get_capture_sources(static_cast<OwrMediaType>(types), mediaSourcesAvailableCallback, this);
}
Vector<CaptureDevice> RealtimeMediaSourceCenterOwr::getMediaStreamDevices()
@@ -131,8 +120,8 @@
void RealtimeMediaSourceCenterOwr::mediaSourcesAvailable(GList* sources)
{
- Vector<String> audioSources;
- Vector<String> videoSources;
+ Vector<RefPtr<RealtimeMediaSource>> audioSources;
+ Vector<RefPtr<RealtimeMediaSource>> videoSources;
for (auto item = sources; item; item = item->next) {
OwrMediaSource* source = OWR_MEDIA_SOURCE(item->data);
@@ -143,17 +132,24 @@
String sourceName(name.get());
String id(createCanonicalUUIDString());
- RealtimeMediaSource::Type sourceType;
+ if (g_getenv("OWR_USE_TEST_SOURCES")) {
+ OwrSourceType sourceType = OWR_SOURCE_TYPE_UNKNOWN;
+ g_object_get(source, "type", &sourceType, NULL);
+ if (sourceType != OWR_SOURCE_TYPE_TEST)
+ continue;
+ }
+
+ RealtimeMediaSource::Type mediaSourceType;
if (mediaType & OWR_MEDIA_TYPE_AUDIO)
- sourceType = RealtimeMediaSource::Audio;
+ mediaSourceType = RealtimeMediaSource::Audio;
else if (mediaType & OWR_MEDIA_TYPE_VIDEO)
- sourceType = RealtimeMediaSource::Video;
+ mediaSourceType = RealtimeMediaSource::Video;
else {
- sourceType = RealtimeMediaSource::None;
+ mediaSourceType = RealtimeMediaSource::None;
ASSERT_NOT_REACHED();
}
- RefPtr<RealtimeMediaSourceOwr> mediaSource = adoptRef(new RealtimeMediaSourceOwr(source, id, sourceType, sourceName));
+ RefPtr<RealtimeMediaSourceOwr> mediaSource = adoptRef(new RealtimeMediaSourceOwr(source, id, mediaSourceType, sourceName));
RealtimeMediaSourceOwrMap::iterator sourceIterator = m_sourceMap.find(id);
if (sourceIterator == m_sourceMap.end())
@@ -160,15 +156,16 @@
m_sourceMap.add(id, mediaSource);
if (mediaType & OWR_MEDIA_TYPE_AUDIO)
- audioSources.append(id);
+ audioSources.append(mediaSource);
else if (mediaType & OWR_MEDIA_TYPE_VIDEO)
- videoSources.append(id);
+ videoSources.append(mediaSource);
}
- // TODO: Make sure contraints are actually validated by checking source types.
- m_validConstraintsHandler(WTFMove(audioSources), WTFMove(videoSources));
- m_validConstraintsHandler = nullptr;
- m_invalidConstraintsHandler = nullptr;
+ if (videoSources.isEmpty() && audioSources.isEmpty())
+ m_completionHandler(nullptr);
+ else
+ m_completionHandler(MediaStreamPrivate::create(audioSources, videoSources));
+
}
PassRefPtr<RealtimeMediaSource> RealtimeMediaSourceCenterOwr::firstSource(RealtimeMediaSource::Type type)
Modified: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h (208586 => 208587)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h 2016-11-11 11:08:39 UTC (rev 208586)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h 2016-11-11 13:09:33 UTC (rev 208587)
@@ -67,6 +67,7 @@
RealtimeMediaSourceOwrMap m_sourceMap;
ValidConstraintsHandler m_validConstraintsHandler;
InvalidConstraintsHandler m_invalidConstraintsHandler;
+ NewMediaStreamHandler m_completionHandler;
};
} // namespace WebCore