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
--- 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