Bug 1320101 - Pass mLastFramerateTenths by copy. r?jesup draft
authorAndreas Pehrson <pehrsons@gmail.com>
Sat, 26 Nov 2016 00:28:29 +0100
changeset 446641 48194d50f88c8645847245af97b71e819e6a9bdc
parent 446640 d4ec16195003fbea83acb6d66d2a1d8e1d572c9e
child 446642 dd84437b9c101f473d804e92b821d9f76161360a
child 447406 e87813d10e8c99ffb8abfbbc66b80c3b7b938019
child 447771 1f05b784c564c7c8d4fa8c9176ef375b744f47a3
push id37837
push userbmo:pehrson@telenordigital.com
push dateThu, 01 Dec 2016 17:14:18 +0000
reviewersjesup
bugs1320101
milestone53.0a1
Bug 1320101 - Pass mLastFramerateTenths by copy. r?jesup Just for the cleanliness of not having to pass an atomic that we always read by reference. MozReview-Commit-ID: 60HzuTAENdQ
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
media/webrtc/signaling/src/media-conduit/VideoConduit.h
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -1128,17 +1128,17 @@ static ResolutionAndBitrateLimits kResol
   {MB_OF(176, 144), 100, 150, 500}, // WQVGA, CIF
   {0 , 40, 80, 250} // QCIF and below
 };
 
 void
 WebrtcVideoConduit::SelectBitrates(unsigned short width,
                                    unsigned short height,
                                    unsigned int cap,
-                                   mozilla::Atomic<int32_t, mozilla::Relaxed>& aLastFramerateTenths,
+                                   int32_t aLastFramerateTenths,
                                    unsigned int& out_min,
                                    unsigned int& out_start,
                                    unsigned int& out_max)
 {
   // max bandwidth should be proportional (not linearly!) to resolution, and
   // proportional (perhaps linearly, or close) to current frame rate.
   unsigned int fs = MB_OF(width, height);
 
@@ -1150,17 +1150,17 @@ WebrtcVideoConduit::SelectBitrates(unsig
          resAndLimits.resolution_in_mb == 0)) {
       out_min = MinIgnoreZero((unsigned int)resAndLimits.min_bitrate, cap);
       out_start = MinIgnoreZero((unsigned int)resAndLimits.start_bitrate, cap);
       out_max = MinIgnoreZero((unsigned int)resAndLimits.max_bitrate, cap);
       break;
     }
   }
 
-  // mLastFramerateTenths is an atomic, and scaled by *10
+  // mLastFramerateTenths is scaled by *10
   double framerate = std::min((aLastFramerateTenths/10.),60.0);
   MOZ_ASSERT(framerate > 0);
   // Now linear reduction/increase based on fps (max 60fps i.e. doubling)
   if (framerate >= 10) {
     out_min = out_min * (framerate/30);
     out_start = out_start * (framerate/30);
     out_max = std::max((unsigned int)(out_max * (framerate/30)), cap);
   } else {
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.h
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h
@@ -142,17 +142,17 @@ public:
    * @param width, height: dimensions of the frame
    * @param cap: user-enforced max bitrate, or 0
    * @param aLastFramerateTenths: holds the current input framerate
    * @param out_start, out_min, out_max: bitrate results
    */
   void SelectBitrates(unsigned short width,
                       unsigned short height,
                       unsigned int cap,
-                      mozilla::Atomic<int32_t, mozilla::Relaxed>& aLastFramerateTenths,
+                      int32_t aLastFramerateTenths,
                       unsigned int& out_min,
                       unsigned int& out_start,
                       unsigned int& out_max);
 
   /**
    * Function to select and change the encoding resolution based on incoming frame size
    * and current available bandwidth.
    * @param width, height: dimensions of the frame