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:
Erik Språng
2019-01-16 17:10:57 +01:00
committed by Commit Bot
parent 74ba99062c
commit f93eda1705
18 changed files with 50 additions and 12 deletions

View File

@ -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") {
visibility = [ "*" ]
sources = [
@ -109,6 +117,7 @@ rtc_source_set("video_bitrate_allocation") {
"video_bitrate_allocation.h",
]
deps = [
":video_codec_constants",
"../../rtc_base:checks",
"../../rtc_base:safe_conversions",
"../../rtc_base:stringutils",

View File

@ -18,14 +18,10 @@
#include <vector>
#include "absl/types/optional.h"
#include "api/video/video_codec_constants.h"
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
// 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.

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

View File

@ -38,6 +38,7 @@ rtc_source_set("video_codecs_api") {
"../../rtc_base/system:rtc_export",
"../video:encoded_image",
"../video:video_bitrate_allocation",
"../video:video_codec_constants",
"../video:video_frame",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",

View File

@ -18,6 +18,7 @@
#include "absl/types/optional.h"
#include "api/video/encoded_image.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video/video_codec_constants.h"
#include "api/video/video_frame.h"
#include "api/video_codecs/video_codec.h"
#include "rtc_base/checks.h"

View File

@ -14,8 +14,6 @@
#include <stddef.h> // For size_t
#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.
#include "api/video/video_codec_type.h"

View File

@ -190,7 +190,7 @@ rtc_static_library("rtc_simulcast_encoder_adapter") {
"engine/simulcast_encoder_adapter.h",
]
deps = [
"../api/video:video_bitrate_allocation",
"../api/video:video_codec_constants",
"../api/video:video_frame",
"../api/video:video_frame_i420",
"../api/video_codecs:video_codecs_api",
@ -374,6 +374,7 @@ rtc_static_library("rtc_audio_video") {
"../api:transport_api",
"../api/audio_codecs:audio_codecs_api",
"../api/video:builtin_video_bitrate_allocator_factory",
"../api/video:video_codec_constants",
"../api/video:video_frame",
"../api/video:video_frame_i420",
"../api/video_codecs:rtc_software_fallback_wrappers",

View File

@ -14,7 +14,7 @@
#include <string>
#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/engine/constants.h"
#include "media/engine/simulcast.h"

View File

@ -18,7 +18,7 @@
#include <utility>
#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_rotation.h"
#include "api/video_codecs/video_encoder_factory.h"

View File

@ -17,6 +17,7 @@
#include <utility>
#include "absl/strings/match.h"
#include "api/video/video_codec_constants.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder.h"
@ -246,8 +247,8 @@ bool GetVp9LayersFromFieldTrialGroup(size_t* num_spatial_layers,
num_temporal_layers) != 2) {
return false;
}
const size_t kMaxSpatialLayers = 3;
if (*num_spatial_layers > kMaxSpatialLayers || *num_spatial_layers < 1)
if (*num_spatial_layers > webrtc::kMaxSpatialLayers ||
*num_spatial_layers < 1)
return false;
const size_t kMaxTemporalLayers = 3;

View File

@ -13,6 +13,7 @@
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include "api/rtp_headers.h"
#include "common_types.h" // NOLINT(build/include)

View File

@ -426,6 +426,7 @@ if (rtc_include_tests) {
"../../api:transport_api",
"../../api/video:video_bitrate_allocation",
"../../api/video:video_bitrate_allocator",
"../../api/video:video_codec_constants",
"../../api/video:video_frame",
"../../api/video_codecs:video_codecs_api",
"../../call:rtp_receiver",

View File

@ -12,6 +12,7 @@
#include <vector>
#include "absl/memory/memory.h"
#include "api/video/video_codec_constants.h"
#include "api/video/video_timing.h"
#include "logging/rtc_event_log/events/rtc_event.h"
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"

View File

@ -12,6 +12,8 @@
#define SDK_ANDROID_SRC_JNI_ENCODED_IMAGE_H_
#include <jni.h>
#include <vector>
#include "common_types.h" // NOLINT(build/include)
#include "sdk/android/native_api/jni/scoped_java_ref.h"

View File

@ -499,6 +499,7 @@ if (rtc_include_tests) {
"../api/test/video:function_video_factory",
"../api/video:builtin_video_bitrate_allocator_factory",
"../api/video:encoded_image",
"../api/video:video_bitrate_allocation",
"../api/video:video_frame",
"../api/video:video_frame_i420",
"../api/video_codecs:create_vp8_temporal_layers",

View File

@ -11,6 +11,7 @@
#include "absl/memory/memory.h"
#include "api/test/simulated_network.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/simulated_network.h"
#include "modules/rtp_rtcp/include/rtp_rtcp.h"

View File

@ -14,6 +14,7 @@
#include "absl/memory/memory.h"
#include "api/test/simulated_network.h"
#include "api/video/encoded_image.h"
#include "api/video/video_bitrate_allocation.h"
#include "call/call.h"
#include "call/fake_network_pipe.h"
#include "call/rtp_transport_controller_send.h"

View File

@ -16,6 +16,7 @@
#include "api/video/builtin_video_bitrate_allocator_factory.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/vp8_temporal_layers.h"
#include "media/base/video_adapter.h"