Exposing video bitrate allocator into API
In order to have public video bitrate allocator factory, the video bitrate allocator has be part of the api. Bug: webrtc:9513 Change-Id: Ia2e5ab9eb988c710c1ac492afccc470a92544aa2 Reviewed-on: https://webrtc-review.googlesource.com/88083 Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Jiawei Ou <ouj@fb.com> Cr-Commit-Position: refs/heads/master@{#24073}
This commit is contained in:
parent
f7a64ecfa3
commit
4206a0a849
12
api/BUILD.gn
12
api/BUILD.gn
@ -425,6 +425,18 @@ if (rtc_include_tests) {
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("mock_video_bitrate_allocator") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"test/mock_video_bitrate_allocator.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"../api/video:video_bitrate_allocator",
|
||||
"../test:test_support",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("mock_video_codec_factory") {
|
||||
testonly = true
|
||||
sources = [
|
||||
|
||||
28
api/test/mock_video_bitrate_allocator.h
Normal file
28
api/test/mock_video_bitrate_allocator.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
#define API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockVideoBitrateAllocator : public webrtc::VideoBitrateAllocator {
|
||||
MOCK_METHOD2(GetAllocation,
|
||||
VideoBitrateAllocation(uint32_t total_bitrate,
|
||||
uint32_t framerate));
|
||||
MOCK_METHOD1(GetPreferredBitrateBps, uint32_t(uint32_t framerate));
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
@ -92,6 +92,16 @@ rtc_source_set("video_bitrate_allocation") {
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("video_bitrate_allocator") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
"video_bitrate_allocator.h",
|
||||
]
|
||||
deps = [
|
||||
":video_bitrate_allocation",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("video_stream_decoder") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
|
||||
38
api/video/video_bitrate_allocator.h
Normal file
38
api/video/video_bitrate_allocator.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef API_VIDEO_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
#define API_VIDEO_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
|
||||
#include "api/video/video_bitrate_allocation.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class VideoBitrateAllocator {
|
||||
public:
|
||||
VideoBitrateAllocator() {}
|
||||
virtual ~VideoBitrateAllocator() {}
|
||||
|
||||
virtual VideoBitrateAllocation GetAllocation(uint32_t total_bitrate_bps,
|
||||
uint32_t framerate) = 0;
|
||||
};
|
||||
|
||||
class VideoBitrateAllocationObserver {
|
||||
public:
|
||||
VideoBitrateAllocationObserver() {}
|
||||
virtual ~VideoBitrateAllocationObserver() {}
|
||||
|
||||
virtual void OnBitrateAllocationUpdated(
|
||||
const VideoBitrateAllocation& allocation) = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_VIDEO_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
@ -45,6 +45,7 @@ rtc_static_library("common_video") {
|
||||
"..:webrtc_common",
|
||||
"../:typedefs",
|
||||
"../api/video:video_bitrate_allocation",
|
||||
"../api/video:video_bitrate_allocator",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_frame_i420",
|
||||
"../media:rtc_h264_profile_id",
|
||||
|
||||
@ -11,28 +11,6 @@
|
||||
#ifndef COMMON_VIDEO_INCLUDE_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
#define COMMON_VIDEO_INCLUDE_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
|
||||
#include "api/video/video_bitrate_allocation.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class VideoBitrateAllocator {
|
||||
public:
|
||||
VideoBitrateAllocator() {}
|
||||
virtual ~VideoBitrateAllocator() {}
|
||||
|
||||
virtual VideoBitrateAllocation GetAllocation(uint32_t total_bitrate,
|
||||
uint32_t framerate) = 0;
|
||||
};
|
||||
|
||||
class VideoBitrateAllocationObserver {
|
||||
public:
|
||||
VideoBitrateAllocationObserver() {}
|
||||
virtual ~VideoBitrateAllocationObserver() {}
|
||||
|
||||
virtual void OnBitrateAllocationUpdated(
|
||||
const VideoBitrateAllocation& allocation) = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
|
||||
#endif // COMMON_VIDEO_INCLUDE_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
|
||||
@ -202,6 +202,7 @@ rtc_static_library("rtp_rtcp") {
|
||||
"../../api:transport_api",
|
||||
"../../api/audio_codecs:audio_codecs_api",
|
||||
"../../api/video:video_bitrate_allocation",
|
||||
"../../api/video:video_bitrate_allocator",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../common_video",
|
||||
"../../logging:rtc_event_audio",
|
||||
@ -426,6 +427,7 @@ if (rtc_include_tests) {
|
||||
"../../api:libjingle_peerconnection_api",
|
||||
"../../api:transport_api",
|
||||
"../../api/video:video_bitrate_allocation",
|
||||
"../../api/video:video_bitrate_allocator",
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../call:rtp_receiver",
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
#include <vector>
|
||||
|
||||
#include "api/video/video_bitrate_allocation.h"
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/bye.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/compound_packet.h"
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
|
||||
#include "api/array_view.h"
|
||||
#include "api/video/video_bitrate_allocation.h"
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "modules/rtp_rtcp/mocks/mock_rtcp_bandwidth_observer.h"
|
||||
#include "modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet.h"
|
||||
|
||||
@ -159,6 +159,7 @@ rtc_static_library("video_coding") {
|
||||
"../../:typedefs",
|
||||
"../../api:fec_controller_api",
|
||||
"../../api/video:encoded_frame",
|
||||
"../../api/video:video_bitrate_allocator",
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video:video_frame_i420",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
@ -261,6 +262,7 @@ rtc_source_set("video_coding_utility") {
|
||||
"..:module_api",
|
||||
"../..:webrtc_common",
|
||||
"../../:typedefs",
|
||||
"../../api/video:video_bitrate_allocator",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../common_video",
|
||||
"../../modules/rtp_rtcp",
|
||||
@ -445,6 +447,7 @@ rtc_static_library("webrtc_vp9_helpers") {
|
||||
deps = [
|
||||
":video_codec_interface",
|
||||
"../..:webrtc_common",
|
||||
"../../api/video:video_bitrate_allocator",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../common_video",
|
||||
"../../rtc_base:checks",
|
||||
@ -596,6 +599,7 @@ if (rtc_include_tests) {
|
||||
"../..:webrtc_common",
|
||||
"../../:typedefs",
|
||||
"../../api:videocodec_test_fixture_api",
|
||||
"../../api/video:video_bitrate_allocator",
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video:video_frame_i420",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
@ -834,6 +838,7 @@ if (rtc_include_tests) {
|
||||
"../../api:create_simulcast_test_fixture_api",
|
||||
"../../api:simulcast_test_fixture_api",
|
||||
"../../api:videocodec_test_fixture_api",
|
||||
"../../api/video:video_bitrate_allocator",
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video:video_frame_i420",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
|
||||
#include "api/test/videocodec_test_fixture.h"
|
||||
#include "api/test/videocodec_test_stats.h"
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "api/video/video_frame.h"
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
#include "modules/video_coding/utility/ivf_file_writer.h"
|
||||
#include "rtc_base/buffer.h"
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "api/video_codecs/video_codec.h"
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
#ifndef MODULES_VIDEO_CODING_UTILITY_DEFAULT_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
#define MODULES_VIDEO_CODING_UTILITY_DEFAULT_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "api/video_codecs/video_codec.h"
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
|
||||
#include "modules/video_coding/include/video_codec_initializer.h"
|
||||
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "modules/video_coding/codecs/vp9/svc_config.h"
|
||||
#include "modules/video_coding/codecs/vp9/svc_rate_allocator.h"
|
||||
#include "modules/video_coding/include/video_coding_defines.h"
|
||||
|
||||
@ -9,9 +9,9 @@
|
||||
*/
|
||||
|
||||
#include "modules/video_coding/include/video_codec_initializer.h"
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "modules/video_coding/codecs/vp8/temporal_layers.h"
|
||||
#include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
|
||||
#include "rtc_base/refcountedobject.h"
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/video_coding/encoded_frame.h"
|
||||
#include "modules/video_coding/include/video_codec_initializer.h"
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
|
||||
#include <algorithm> // std::max
|
||||
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/video_coding/encoded_frame.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
|
||||
@ -61,6 +61,7 @@ rtc_static_library("video") {
|
||||
"../api:fec_controller_api",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:transport_api",
|
||||
"../api/video:video_bitrate_allocator",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_frame_i420",
|
||||
"../api/video:video_stream_encoder",
|
||||
|
||||
@ -15,10 +15,10 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "call/bitrate_allocator.h"
|
||||
#include "call/rtp_video_sender_interface.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "modules/utility/include/process_thread.h"
|
||||
#include "modules/video_coding/utility/ivf_file_writer.h"
|
||||
#include "rtc_base/weak_ptr.h"
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "common_video/include/video_frame.h"
|
||||
#include "modules/video_coding/include/video_codec_initializer.h"
|
||||
#include "modules/video_coding/include/video_coding.h"
|
||||
|
||||
@ -17,13 +17,13 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "api/video/video_rotation.h"
|
||||
#include "api/video/video_sink_interface.h"
|
||||
#include "api/video/video_stream_encoder_interface.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "call/video_send_stream.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/video_bitrate_allocator.h"
|
||||
#include "modules/video_coding/include/video_coding_defines.h"
|
||||
#include "modules/video_coding/utility/quality_scaler.h"
|
||||
#include "modules/video_coding/video_coding_impl.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user