Skip to content

Commit

Permalink
Cherry pick PR #3172: Import libwebm from Chromium 114 (#3307)
Browse files Browse the repository at this point in the history
Refer to the original PR: #3172

This includes commits to add new subtrees `third_party/libwebm` and
`third_party/libwebm/source`, and another commit using the library to
remove a Cobalt customization in `//media`.

Note that these should be merged using the "merge" strategy rather than
"squash", to preserve the commit history.

b/327449946
b/338100595
  • Loading branch information
osagie98 committed May 21, 2024
2 parents d3b5d42 + 97cadca commit 7923340
Show file tree
Hide file tree
Showing 901 changed files with 51,947 additions and 23 deletions.
11 changes: 8 additions & 3 deletions media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# limitations under the License.

config("media_config") {
include_dirs = [ "//third_party/abseil-cpp" ]
include_dirs = [
"//third_party/abseil-cpp",
"//third_party/libwebm/source",
]
if (is_win) {
cflags = [
"/wd4267", # Conversion from 'size_t' to 'type', possible loss of data.
Expand All @@ -37,15 +40,17 @@ config("media_config_public") {
# TODO: Make include_dirs other than the first one private.
include_dirs = [
"//third_party/abseil-cpp",
"//third_party/libwebm/source",
"//third_party/skia",
"..",
"cobalt",
"//third_party/skia",
]
}

config("external_config") {
include_dirs = [
"//third_party/abseil-cpp",
"//third_party/libwebm/source",
"..",
"cobalt",
"../../skia",
Expand Down Expand Up @@ -263,4 +268,4 @@ target(gtest_target_type, "chromium_media_test") {
"//testing/gmock",
"//testing/gtest",
]
}
}
20 changes: 0 additions & 20 deletions media/formats/webm/webm_colour_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,7 @@
#include "base/check.h"
#include "base/logging.h"
#include "media/formats/webm/webm_constants.h"

#if defined(STARBOARD)

// Taken from mkvmuxer.h as is to avoid introducing the whole libwebm library.
namespace mkvmuxer {

class Colour {
public:
enum Range {
kUnspecifiedCr = 0,
kBroadcastRange = 1,
kFullRange = 2,
kMcTcDefined = 3, // Defined by MatrixCoefficients/TransferCharacteristics.
};
};

} // namespace mkvmuxer

#else // defined(STARBOARD)
#include "third_party/libwebm/source/mkvmuxer/mkvmuxer.h"
#endif // defined(STARBOARD)

namespace media {

Expand Down
18 changes: 18 additions & 0 deletions third_party/libwebm/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

config("libwebm_config") {
include_dirs = [ "./source" ]
}

static_library("libwebm") {
configs += [ ":libwebm_config" ]
public_configs = [ ":libwebm_config" ]

sources = [
"source/mkvmuxer/mkvmuxer.cc",
"source/mkvmuxer/mkvmuxerutil.cc",
"source/mkvmuxer/mkvwriter.cc",
]
}
3 changes: 3 additions & 0 deletions third_party/libwebm/DIR_METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
monorail: {
component: "Blink>MediaRecording"
}
19 changes: 19 additions & 0 deletions third_party/libwebm/METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "third_party/libwebm"
description:
"Subtree at third_party/libwebm."

third_party {
identifier {
type: "ChromiumVersion"
value: "114.0.5735.358" # from https://chromereleases.googleblog.com/2024/03/long-term-support-channel-update-for_26.html
}
identifier {
type: "Git"
value: "https://chromium.googlesource.com/chromium/src.git"
version: "1759c6ae9316996b9f150c0ce9d0ca78a3d15c02"
}
identifier {
type: "UpstreamSubdir"
value: "third_party/libwebm"
}
}
9 changes: 9 additions & 0 deletions third_party/libwebm/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The following OWNERS refer to libwebm Chromium integration.
[email protected]

# The following OWNER refer to libwebm content.
[email protected]

# Original (legacy) owner.
[email protected]
[email protected]
14 changes: 14 additions & 0 deletions third_party/libwebm/README.chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Name: WebM container parser and writer.
Short Name: libwebm
URL: https://chromium.googlesource.com/webm/libwebm
Version: 1.0.0.28
Revision: e4fbea0c9751ae8aa86629b197a28d8276a2b0da
CPEPrefix: cpe:/a:webmproject:libwebm:1.0.0.28
License: BSD
License File: source/LICENSE.TXT
Security Critical: yes

Description:
libwebm is a library to read and write WebM files. It's used by MediaStream
Recording API to multiplex encoded audio and video into a WebM container. Only
the writing parts are used for this purpose, the rest is not compiled.
152 changes: 152 additions & 0 deletions third_party/libwebm/source/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
---
Language: Cpp
# BasedOnStyle: Google
# Generated with clang-format 7.0.1
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...
6 changes: 6 additions & 0 deletions third_party/libwebm/source/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.sln eol=crlf
*.vcproj eol=crlf
*.vsprops eol=crlf
*.vcxproj eol=crlf
*.mkv -text -diff
*.webm -text -diff
35 changes: 35 additions & 0 deletions third_party/libwebm/source/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*.mkv
*.MKV
core
*.a
*.d
*.so*
*.o
*~
*.swp
*.ncb
*.user
*.suo
*.exe
/*.webm
Debug
Release
*.sdf
*.opensdf
ipch
dumpvtt
mkvmuxer_sample
mkvparser_sample
vttdemux
mkvmuxer_tests
mkvparser_tests
webm_info
webm2pes
webm2pes_tests
webm2ts
vp9_header_parser_tests
vp9_level_stats_tests
Makefile
CMakeFiles
CMakeCache.txt
*.cmake
4 changes: 4 additions & 0 deletions third_party/libwebm/source/AUTHORS.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Names should be added to this file like so:
# Name or Organization <email address>

Google Inc.
17 changes: 17 additions & 0 deletions third_party/libwebm/source/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE:= libwebm
LOCAL_CPPFLAGS:=-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
LOCAL_CPPFLAGS+=-D__STDC_LIMIT_MACROS -std=c++11
LOCAL_C_INCLUDES:= $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES:= $(LOCAL_PATH)

LOCAL_SRC_FILES:= common/file_util.cc \
common/hdr_util.cc \
mkvparser/mkvparser.cc \
mkvparser/mkvreader.cc \
mkvmuxer/mkvmuxer.cc \
mkvmuxer/mkvmuxerutil.cc \
mkvmuxer/mkvwriter.cc
include $(BUILD_STATIC_LIBRARY)
Loading

0 comments on commit 7923340

Please sign in to comment.