tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

video_bitrate_allocator.cc (1605B)


      1 /*
      2 *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #include "api/video/video_bitrate_allocator.h"
     12 
     13 #include <cstdint>
     14 
     15 #include "api/units/data_rate.h"
     16 #include "api/video/video_bitrate_allocation.h"
     17 
     18 namespace webrtc {
     19 
     20 VideoBitrateAllocationParameters::VideoBitrateAllocationParameters(
     21    uint32_t total_bitrate_bps,
     22    uint32_t framerate)
     23    : total_bitrate(DataRate::BitsPerSec(total_bitrate_bps)),
     24      framerate(static_cast<double>(framerate)) {}
     25 
     26 VideoBitrateAllocationParameters::VideoBitrateAllocationParameters(
     27    DataRate total_bitrate,
     28    double framerate)
     29    : total_bitrate(total_bitrate), framerate(framerate) {}
     30 
     31 VideoBitrateAllocationParameters::~VideoBitrateAllocationParameters() = default;
     32 
     33 VideoBitrateAllocation VideoBitrateAllocator::GetAllocation(
     34    uint32_t total_bitrate_bps,
     35    uint32_t framerate) {
     36  return Allocate({DataRate::BitsPerSec(total_bitrate_bps),
     37                   static_cast<double>(framerate)});
     38 }
     39 
     40 VideoBitrateAllocation VideoBitrateAllocator::Allocate(
     41    VideoBitrateAllocationParameters parameters) {
     42  return GetAllocation(parameters.total_bitrate.bps(), parameters.framerate);
     43 }
     44 
     45 void VideoBitrateAllocator::SetLegacyConferenceMode(bool /* enabled */) {}
     46 
     47 }  // namespace webrtc