video_bitrate_allocator.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2016 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. #ifndef API_VIDEO_VIDEO_BITRATE_ALLOCATOR_H_
  11. #define API_VIDEO_VIDEO_BITRATE_ALLOCATOR_H_
  12. #include "api/units/data_rate.h"
  13. #include "api/video/video_bitrate_allocation.h"
  14. namespace webrtc {
  15. struct VideoBitrateAllocationParameters {
  16. VideoBitrateAllocationParameters(uint32_t total_bitrate_bps,
  17. uint32_t framerate);
  18. VideoBitrateAllocationParameters(DataRate total_bitrate, double framerate);
  19. VideoBitrateAllocationParameters(DataRate total_bitrate,
  20. DataRate stable_bitrate,
  21. double framerate);
  22. ~VideoBitrateAllocationParameters();
  23. DataRate total_bitrate;
  24. DataRate stable_bitrate;
  25. double framerate;
  26. };
  27. class VideoBitrateAllocator {
  28. public:
  29. VideoBitrateAllocator() {}
  30. virtual ~VideoBitrateAllocator() {}
  31. virtual VideoBitrateAllocation GetAllocation(uint32_t total_bitrate_bps,
  32. uint32_t framerate);
  33. virtual VideoBitrateAllocation Allocate(
  34. VideoBitrateAllocationParameters parameters);
  35. // Deprecated: Only used to work around issues with the legacy conference
  36. // screenshare mode and shouldn't be needed by any subclasses.
  37. virtual void SetLegacyConferenceMode(bool enabled);
  38. };
  39. class VideoBitrateAllocationObserver {
  40. public:
  41. VideoBitrateAllocationObserver() {}
  42. virtual ~VideoBitrateAllocationObserver() {}
  43. virtual void OnBitrateAllocationUpdated(
  44. const VideoBitrateAllocation& allocation) = 0;
  45. };
  46. } // namespace webrtc
  47. #endif // API_VIDEO_VIDEO_BITRATE_ALLOCATOR_H_