Bug 1320101 - Pass mLastFramerateTenths by copy. r=jesup
authorAndreas Pehrson <pehrsons@gmail.com>
Sat, 26 Nov 2016 00:28:29 +0100
changeset 325413 38e008ff60f0f595cc6f57ecbac6775166ab480a
parent 325412 8e249f96175065170c647f4d10526af3e13d04ac
child 325414 337f8b56236774aea32593bba2c540df33cddd26
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +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