Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: webrtc/common_types.cc

Issue 2489843002: Revert of Extract bitrate allocation of spatial/temporal layers out of codec impl. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/common_types.h ('k') | webrtc/common_video/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_types.cc
diff --git a/webrtc/common_types.cc b/webrtc/common_types.cc
index c63bb9970680d3ef1c66fdd7f88f47b550bd1116..e78a4aacca75f538e663dcf00732a691ad9570f8 100644
--- a/webrtc/common_types.cc
+++ b/webrtc/common_types.cc
@@ -11,7 +11,6 @@
#include "webrtc/base/checks.h"
#include "webrtc/common_types.h"
-#include <limits>
#include <string.h>
namespace webrtc {
@@ -60,7 +59,6 @@
simulcastStream(),
spatialLayers(),
mode(kRealtimeVideo),
- expect_encode_from_texture(false),
codecSpecific() {}
VideoCodecVP8* VideoCodec::VP8() {
@@ -93,89 +91,4 @@
return codecSpecific.H264;
}
-static const char* kPayloadNameVp8 = "VP8";
-static const char* kPayloadNameVp9 = "VP9";
-static const char* kPayloadNameH264 = "H264";
-static const char* kPayloadNameI420 = "I420";
-static const char* kPayloadNameRED = "RED";
-static const char* kPayloadNameULPFEC = "ULPFEC";
-static const char* kPayloadNameGeneric = "Generic";
-
-rtc::Optional<std::string> CodecTypeToPayloadName(VideoCodecType type) {
- switch (type) {
- case kVideoCodecVP8:
- return rtc::Optional<std::string>(kPayloadNameVp8);
- case kVideoCodecVP9:
- return rtc::Optional<std::string>(kPayloadNameVp9);
- case kVideoCodecH264:
- return rtc::Optional<std::string>(kPayloadNameH264);
- case kVideoCodecI420:
- return rtc::Optional<std::string>(kPayloadNameI420);
- case kVideoCodecRED:
- return rtc::Optional<std::string>(kPayloadNameRED);
- case kVideoCodecULPFEC:
- return rtc::Optional<std::string>(kPayloadNameULPFEC);
- case kVideoCodecGeneric:
- return rtc::Optional<std::string>(kPayloadNameGeneric);
- default:
- return rtc::Optional<std::string>();
- }
-}
-
-rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name) {
- if (name == kPayloadNameVp8)
- return rtc::Optional<VideoCodecType>(kVideoCodecVP8);
- if (name == kPayloadNameVp9)
- return rtc::Optional<VideoCodecType>(kVideoCodecVP9);
- if (name == kPayloadNameH264)
- return rtc::Optional<VideoCodecType>(kVideoCodecH264);
- if (name == kPayloadNameI420)
- return rtc::Optional<VideoCodecType>(kVideoCodecI420);
- if (name == kPayloadNameRED)
- return rtc::Optional<VideoCodecType>(kVideoCodecRED);
- if (name == kPayloadNameULPFEC)
- return rtc::Optional<VideoCodecType>(kVideoCodecULPFEC);
- if (name == kPayloadNameGeneric)
- return rtc::Optional<VideoCodecType>(kVideoCodecGeneric);
- return rtc::Optional<VideoCodecType>();
-}
-
-const size_t BitrateAllocation::kMaxBitrateBps =
- std::numeric_limits<size_t>::max();
-
-BitrateAllocation::BitrateAllocation() : sum_(0), bitrates_{} {}
-
-bool BitrateAllocation::SetBitrate(size_t spatial_index,
- size_t temporal_index,
- uint32_t bitrate_bps) {
- RTC_DCHECK_LT(spatial_index, static_cast<size_t>(kMaxSpatialLayers));
- RTC_DCHECK_LT(temporal_index, static_cast<size_t>(kMaxTemporalStreams));
- RTC_DCHECK_LE(bitrates_[spatial_index][temporal_index], sum_);
- uint64_t new_bitrate_sum_bps = sum_;
- new_bitrate_sum_bps -= bitrates_[spatial_index][temporal_index];
- new_bitrate_sum_bps += bitrate_bps;
- if (new_bitrate_sum_bps > kMaxBitrateBps)
- return false;
-
- bitrates_[spatial_index][temporal_index] = bitrate_bps;
- sum_ = static_cast<uint32_t>(new_bitrate_sum_bps);
- return true;
-}
-
-uint32_t BitrateAllocation::GetBitrate(size_t spatial_index,
- size_t temporal_index) const {
- RTC_DCHECK_LT(spatial_index, static_cast<size_t>(kMaxSpatialLayers));
- RTC_DCHECK_LT(temporal_index, static_cast<size_t>(kMaxTemporalStreams));
- return bitrates_[spatial_index][temporal_index];
-}
-
-// Get the sum of all the temporal layer for a specific spatial layer.
-uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const {
- RTC_DCHECK_LT(spatial_index, static_cast<size_t>(kMaxSpatialLayers));
- uint32_t sum = 0;
- for (int i = 0; i < kMaxTemporalStreams; ++i)
- sum += bitrates_[spatial_index][i];
- return sum;
-}
-
} // namespace webrtc
« no previous file with comments | « webrtc/common_types.h ('k') | webrtc/common_video/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698