Move some video codec constants to separate file.
kMaxSimulcastStreams, kMaxSpatialLayers and kMaxTemporalStreams don't really beling on VideoBitrateAllocation. common_types.h is going away and it feels dubious to requrie include of the full VideoEncoder api to use them. Therefore moving them into a seprate file/target. Also includes some remaining cleanup of includes. Bug: webrtc:9271 Change-Id: I7ded3d97a9a835ac756159700774445a2b93a697 Reviewed-on: https://webrtc-review.googlesource.com/c/117305 Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26299}
This commit is contained in:
@ -102,6 +102,14 @@ rtc_source_set("encoded_frame") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rtc_source_set("video_codec_constants") {
|
||||||
|
visibility = [ "*" ]
|
||||||
|
sources = [
|
||||||
|
"video_codec_constants.h",
|
||||||
|
]
|
||||||
|
deps = []
|
||||||
|
}
|
||||||
|
|
||||||
rtc_source_set("video_bitrate_allocation") {
|
rtc_source_set("video_bitrate_allocation") {
|
||||||
visibility = [ "*" ]
|
visibility = [ "*" ]
|
||||||
sources = [
|
sources = [
|
||||||
@ -109,6 +117,7 @@ rtc_source_set("video_bitrate_allocation") {
|
|||||||
"video_bitrate_allocation.h",
|
"video_bitrate_allocation.h",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
|
":video_codec_constants",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:safe_conversions",
|
"../../rtc_base:safe_conversions",
|
||||||
"../../rtc_base:stringutils",
|
"../../rtc_base:stringutils",
|
||||||
|
|||||||
@ -18,14 +18,10 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "absl/types/optional.h"
|
#include "absl/types/optional.h"
|
||||||
|
#include "api/video/video_codec_constants.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
// TODO(sprang): Move back to common_types when include of this is removed.
|
|
||||||
enum : int { kMaxSimulcastStreams = 4 };
|
|
||||||
enum : int { kMaxSpatialLayers = 5 };
|
|
||||||
enum : int { kMaxTemporalStreams = 4 };
|
|
||||||
|
|
||||||
// Class that describes how video bitrate, in bps, is allocated across temporal
|
// Class that describes how video bitrate, in bps, is allocated across temporal
|
||||||
// and spatial layers. Not that bitrates are NOT cumulative. Depending on if
|
// and spatial layers. Not that bitrates are NOT cumulative. Depending on if
|
||||||
// layers are dependent or not, it is up to the user to aggregate.
|
// layers are dependent or not, it is up to the user to aggregate.
|
||||||
|
|||||||
22
api/video/video_codec_constants.h
Normal file
22
api/video/video_codec_constants.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 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_CODEC_CONSTANTS_H_
|
||||||
|
#define API_VIDEO_VIDEO_CODEC_CONSTANTS_H_
|
||||||
|
|
||||||
|
namespace webrtc {
|
||||||
|
|
||||||
|
enum : int { kMaxSimulcastStreams = 4 };
|
||||||
|
enum : int { kMaxSpatialLayers = 5 };
|
||||||
|
enum : int { kMaxTemporalStreams = 4 };
|
||||||
|
|
||||||
|
} // namespace webrtc
|
||||||
|
|
||||||
|
#endif // API_VIDEO_VIDEO_CODEC_CONSTANTS_H_
|
||||||
@ -38,6 +38,7 @@ rtc_source_set("video_codecs_api") {
|
|||||||
"../../rtc_base/system:rtc_export",
|
"../../rtc_base/system:rtc_export",
|
||||||
"../video:encoded_image",
|
"../video:encoded_image",
|
||||||
"../video:video_bitrate_allocation",
|
"../video:video_bitrate_allocation",
|
||||||
|
"../video:video_codec_constants",
|
||||||
"../video:video_frame",
|
"../video:video_frame",
|
||||||
"//third_party/abseil-cpp/absl/strings",
|
"//third_party/abseil-cpp/absl/strings",
|
||||||
"//third_party/abseil-cpp/absl/types:optional",
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
#include "absl/types/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/video/encoded_image.h"
|
#include "api/video/encoded_image.h"
|
||||||
#include "api/video/video_bitrate_allocation.h"
|
#include "api/video/video_bitrate_allocation.h"
|
||||||
|
#include "api/video/video_codec_constants.h"
|
||||||
#include "api/video/video_frame.h"
|
#include "api/video/video_frame.h"
|
||||||
#include "api/video_codecs/video_codec.h"
|
#include "api/video_codecs/video_codec.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
|
|||||||
@ -14,8 +14,6 @@
|
|||||||
#include <stddef.h> // For size_t
|
#include <stddef.h> // For size_t
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
// TODO(sprang): Remove this include when all usage includes it directly.
|
|
||||||
#include "api/video/video_bitrate_allocation.h"
|
|
||||||
// TODO(bugs.webrtc.org/7660): Delete include once downstream code is updated.
|
// TODO(bugs.webrtc.org/7660): Delete include once downstream code is updated.
|
||||||
#include "api/video/video_codec_type.h"
|
#include "api/video/video_codec_type.h"
|
||||||
|
|
||||||
|
|||||||
@ -190,7 +190,7 @@ rtc_static_library("rtc_simulcast_encoder_adapter") {
|
|||||||
"engine/simulcast_encoder_adapter.h",
|
"engine/simulcast_encoder_adapter.h",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"../api/video:video_bitrate_allocation",
|
"../api/video:video_codec_constants",
|
||||||
"../api/video:video_frame",
|
"../api/video:video_frame",
|
||||||
"../api/video:video_frame_i420",
|
"../api/video:video_frame_i420",
|
||||||
"../api/video_codecs:video_codecs_api",
|
"../api/video_codecs:video_codecs_api",
|
||||||
@ -374,6 +374,7 @@ rtc_static_library("rtc_audio_video") {
|
|||||||
"../api:transport_api",
|
"../api:transport_api",
|
||||||
"../api/audio_codecs:audio_codecs_api",
|
"../api/audio_codecs:audio_codecs_api",
|
||||||
"../api/video:builtin_video_bitrate_allocator_factory",
|
"../api/video:builtin_video_bitrate_allocator_factory",
|
||||||
|
"../api/video:video_codec_constants",
|
||||||
"../api/video:video_frame",
|
"../api/video:video_frame",
|
||||||
"../api/video:video_frame_i420",
|
"../api/video:video_frame_i420",
|
||||||
"../api/video_codecs:rtc_software_fallback_wrappers",
|
"../api/video_codecs:rtc_software_fallback_wrappers",
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "absl/types/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/video/video_bitrate_allocation.h"
|
#include "api/video/video_codec_constants.h"
|
||||||
#include "media/base/media_constants.h"
|
#include "media/base/media_constants.h"
|
||||||
#include "media/engine/constants.h"
|
#include "media/engine/constants.h"
|
||||||
#include "media/engine/simulcast.h"
|
#include "media/engine/simulcast.h"
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "api/video/i420_buffer.h"
|
#include "api/video/i420_buffer.h"
|
||||||
#include "api/video/video_bitrate_allocation.h"
|
#include "api/video/video_codec_constants.h"
|
||||||
#include "api/video/video_frame_buffer.h"
|
#include "api/video/video_frame_buffer.h"
|
||||||
#include "api/video/video_rotation.h"
|
#include "api/video/video_rotation.h"
|
||||||
#include "api/video_codecs/video_encoder_factory.h"
|
#include "api/video_codecs/video_encoder_factory.h"
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "absl/strings/match.h"
|
#include "absl/strings/match.h"
|
||||||
|
#include "api/video/video_codec_constants.h"
|
||||||
#include "api/video_codecs/sdp_video_format.h"
|
#include "api/video_codecs/sdp_video_format.h"
|
||||||
#include "api/video_codecs/video_decoder_factory.h"
|
#include "api/video_codecs/video_decoder_factory.h"
|
||||||
#include "api/video_codecs/video_encoder.h"
|
#include "api/video_codecs/video_encoder.h"
|
||||||
@ -246,8 +247,8 @@ bool GetVp9LayersFromFieldTrialGroup(size_t* num_spatial_layers,
|
|||||||
num_temporal_layers) != 2) {
|
num_temporal_layers) != 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const size_t kMaxSpatialLayers = 3;
|
if (*num_spatial_layers > webrtc::kMaxSpatialLayers ||
|
||||||
if (*num_spatial_layers > kMaxSpatialLayers || *num_spatial_layers < 1)
|
*num_spatial_layers < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const size_t kMaxTemporalLayers = 3;
|
const size_t kMaxTemporalLayers = 3;
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "api/rtp_headers.h"
|
#include "api/rtp_headers.h"
|
||||||
#include "common_types.h" // NOLINT(build/include)
|
#include "common_types.h" // NOLINT(build/include)
|
||||||
|
|||||||
@ -426,6 +426,7 @@ if (rtc_include_tests) {
|
|||||||
"../../api:transport_api",
|
"../../api:transport_api",
|
||||||
"../../api/video:video_bitrate_allocation",
|
"../../api/video:video_bitrate_allocation",
|
||||||
"../../api/video:video_bitrate_allocator",
|
"../../api/video:video_bitrate_allocator",
|
||||||
|
"../../api/video:video_codec_constants",
|
||||||
"../../api/video:video_frame",
|
"../../api/video:video_frame",
|
||||||
"../../api/video_codecs:video_codecs_api",
|
"../../api/video_codecs:video_codecs_api",
|
||||||
"../../call:rtp_receiver",
|
"../../call:rtp_receiver",
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
|
#include "api/video/video_codec_constants.h"
|
||||||
#include "api/video/video_timing.h"
|
#include "api/video/video_timing.h"
|
||||||
#include "logging/rtc_event_log/events/rtc_event.h"
|
#include "logging/rtc_event_log/events/rtc_event.h"
|
||||||
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
|
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
|
||||||
|
|||||||
@ -12,6 +12,8 @@
|
|||||||
#define SDK_ANDROID_SRC_JNI_ENCODED_IMAGE_H_
|
#define SDK_ANDROID_SRC_JNI_ENCODED_IMAGE_H_
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "common_types.h" // NOLINT(build/include)
|
#include "common_types.h" // NOLINT(build/include)
|
||||||
|
|
||||||
#include "sdk/android/native_api/jni/scoped_java_ref.h"
|
#include "sdk/android/native_api/jni/scoped_java_ref.h"
|
||||||
|
|||||||
@ -499,6 +499,7 @@ if (rtc_include_tests) {
|
|||||||
"../api/test/video:function_video_factory",
|
"../api/test/video:function_video_factory",
|
||||||
"../api/video:builtin_video_bitrate_allocator_factory",
|
"../api/video:builtin_video_bitrate_allocator_factory",
|
||||||
"../api/video:encoded_image",
|
"../api/video:encoded_image",
|
||||||
|
"../api/video:video_bitrate_allocation",
|
||||||
"../api/video:video_frame",
|
"../api/video:video_frame",
|
||||||
"../api/video:video_frame_i420",
|
"../api/video:video_frame_i420",
|
||||||
"../api/video_codecs:create_vp8_temporal_layers",
|
"../api/video_codecs:create_vp8_temporal_layers",
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "api/test/simulated_network.h"
|
#include "api/test/simulated_network.h"
|
||||||
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
||||||
|
#include "api/video/video_bitrate_allocation.h"
|
||||||
#include "call/fake_network_pipe.h"
|
#include "call/fake_network_pipe.h"
|
||||||
#include "call/simulated_network.h"
|
#include "call/simulated_network.h"
|
||||||
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
|
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "api/test/simulated_network.h"
|
#include "api/test/simulated_network.h"
|
||||||
#include "api/video/encoded_image.h"
|
#include "api/video/encoded_image.h"
|
||||||
|
#include "api/video/video_bitrate_allocation.h"
|
||||||
#include "call/call.h"
|
#include "call/call.h"
|
||||||
#include "call/fake_network_pipe.h"
|
#include "call/fake_network_pipe.h"
|
||||||
#include "call/rtp_transport_controller_send.h"
|
#include "call/rtp_transport_controller_send.h"
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
||||||
#include "api/video/i420_buffer.h"
|
#include "api/video/i420_buffer.h"
|
||||||
|
#include "api/video/video_bitrate_allocation.h"
|
||||||
#include "api/video_codecs/create_vp8_temporal_layers.h"
|
#include "api/video_codecs/create_vp8_temporal_layers.h"
|
||||||
#include "api/video_codecs/vp8_temporal_layers.h"
|
#include "api/video_codecs/vp8_temporal_layers.h"
|
||||||
#include "media/base/video_adapter.h"
|
#include "media/base/video_adapter.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user