Title: [187204] trunk/Source/WebCore
Revision
187204
Author
commit-qu...@webkit.org
Date
2015-07-22 18:54:54 -0700 (Wed, 22 Jul 2015)

Log Message

Rank sources for fitness for UIDs in bestSourcesForTypeAndConstraints
https://bugs.webkit.org/show_bug.cgi?id=147206
<rdar://problem/21950653>

Patch by Matthew Daiter <mdai...@apple.com> on 2015-07-22
Reviewed by Jer Noble.

* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::RealtimeMediaSource):
* platform/mediastream/RealtimeMediaSource.h:
(WebCore::RealtimeMediaSource::fitnessScore):
(WebCore::RealtimeMediaSource::setFitnessScore):
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (187203 => 187204)


--- trunk/Source/WebCore/ChangeLog	2015-07-23 01:47:00 UTC (rev 187203)
+++ trunk/Source/WebCore/ChangeLog	2015-07-23 01:54:54 UTC (rev 187204)
@@ -1,3 +1,19 @@
+2015-07-22  Matthew Daiter  <mdai...@apple.com>
+
+        Rank sources for fitness for UIDs in bestSourcesForTypeAndConstraints
+        https://bugs.webkit.org/show_bug.cgi?id=147206
+        <rdar://problem/21950653>
+
+        Reviewed by Jer Noble.
+
+        * platform/mediastream/RealtimeMediaSource.cpp:
+        (WebCore::RealtimeMediaSource::RealtimeMediaSource):
+        * platform/mediastream/RealtimeMediaSource.h:
+        (WebCore::RealtimeMediaSource::fitnessScore):
+        (WebCore::RealtimeMediaSource::setFitnessScore):
+        * platform/mediastream/mac/AVCaptureDeviceManager.mm:
+        (WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints):
+
 2015-07-22  Dean Jackson  <d...@apple.com>
 
         Video controls, though hidden, are still interactive when in PiP

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (187203 => 187204)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2015-07-23 01:47:00 UTC (rev 187203)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2015-07-23 01:54:54 UTC (rev 187204)
@@ -49,7 +49,10 @@
     , m_muted(false)
     , m_readonly(false)
     , m_remote(false)
+    , m_fitnessScore(0)
 {
+    // FIXME(147205): Need to implement fitness score for constraints
+
     if (!m_id.isEmpty())
         return;
     

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (187203 => 187204)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2015-07-23 01:47:00 UTC (rev 187203)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2015-07-23 01:54:54 UTC (rev 187204)
@@ -74,6 +74,9 @@
 
     virtual const String& name() const { return m_name; }
     virtual void setName(const String& name) { m_name = name; }
+    
+    virtual unsigned fitnessScore() const { return m_fitnessScore; }
+    virtual void setFitnessScore(const unsigned fitnessScore) { m_fitnessScore = fitnessScore; }
 
     virtual RefPtr<RealtimeMediaSourceCapabilities> capabilities() const = 0;
     virtual const RealtimeMediaSourceStates& states() = 0;
@@ -113,6 +116,8 @@
     bool m_muted;
     bool m_readonly;
     bool m_remote;
+    
+    unsigned m_fitnessScore;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm (187203 => 187204)


--- trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm	2015-07-23 01:47:00 UTC (rev 187203)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm	2015-07-23 01:54:54 UTC (rev 187204)
@@ -384,6 +384,13 @@
     
     if (!isAvailable())
         return bestSourcesList;
+    
+    struct {
+        bool operator()(RefPtr<RealtimeMediaSource> a, RefPtr<RealtimeMediaSource> b)
+        {
+            return a->fitnessScore() < b->fitnessScore();
+        }
+    } sortBasedOffFitnessScore;
 
     for (auto& captureDevice : captureDeviceList()) {
         if (!captureDevice.m_enabled)
@@ -409,7 +416,7 @@
             bestSourcesList.append(captureDevice.m_videoSource);
         }
     }
-
+    std::sort(bestSourcesList.begin(), bestSourcesList.end(), sortBasedOffFitnessScore);
     return bestSourcesList;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to