Internal change
PiperOrigin-RevId: 503157344
This commit is contained in:
parent
e2dedcbfe5
commit
7a7cc77a81
|
@ -647,7 +647,7 @@ TEST_F(UnpackMediaSequenceCalculatorTest, GetAudioDecoderOptionsOverride) {
|
|||
|
||||
TEST_F(UnpackMediaSequenceCalculatorTest, GetPacketResamplingOptions) {
|
||||
// TODO: Suport proto3 proto.Any in CalculatorOptions.
|
||||
// TODO: Avoid proto2 extensions in "RESAMPLER_OPTIONS".
|
||||
// TODO: Avoid google::protobuf extensions in "RESAMPLER_OPTIONS".
|
||||
CalculatorOptions options;
|
||||
options.MutableExtension(UnpackMediaSequenceCalculatorOptions::ext)
|
||||
->set_padding_before_label(1);
|
||||
|
|
|
@ -131,10 +131,10 @@ TEST(CalculatorTest, GetOptions) {
|
|||
auto calculator_state_3 = MakeCalculatorState(config.node(3), 3);
|
||||
auto cc_3 = MakeCalculatorContext(&*calculator_state_3);
|
||||
|
||||
// Get a proto2 options extension from Node::options.
|
||||
// Get a google::protobuf options extension from Node::options.
|
||||
EXPECT_EQ(cc_0->Options<NightLightCalculatorOptions>().jitter(), 0.123);
|
||||
|
||||
// Get a proto2 options extension from Node::node_options.
|
||||
// Get a google::protobuf options extension from Node::node_options.
|
||||
EXPECT_EQ(cc_1->Options<NightLightCalculatorOptions>().jitter(), 0.123);
|
||||
|
||||
// Get a proto3 options protobuf::Any from Node::node_options.
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
// Temporary forward declarations for proto2 support on portable targets.
|
||||
// Use proto_ns inside namespace mediapipe instead of proto2 namespace.
|
||||
// Temporary forward declarations for google::protobuf support on portable
|
||||
// targets. Use proto_ns inside namespace mediapipe instead of google::protobuf
|
||||
// namespace.
|
||||
#include "google/protobuf/message.h"
|
||||
#include "google/protobuf/message_lite.h"
|
||||
#include "google/protobuf/repeated_field.h"
|
||||
|
|
|
@ -39,13 +39,15 @@ constexpr char kDummyTestCalculatorName[] = "DummyTestCalculator";
|
|||
CalculatorGraphConfig::Node CreateNodeConfig(
|
||||
const std::string& raw_node_config) {
|
||||
CalculatorGraphConfig::Node node_config;
|
||||
QCHECK(proto2::TextFormat::ParseFromString(raw_node_config, &node_config));
|
||||
QCHECK(google::protobuf::TextFormat::ParseFromString(raw_node_config,
|
||||
&node_config));
|
||||
return node_config;
|
||||
}
|
||||
|
||||
CalculatorGraphConfig CreateGraphConfig(const std::string& raw_graph_config) {
|
||||
CalculatorGraphConfig graph_config;
|
||||
QCHECK(proto2::TextFormat::ParseFromString(raw_graph_config, &graph_config));
|
||||
QCHECK(google::protobuf::TextFormat::ParseFromString(raw_graph_config,
|
||||
&graph_config));
|
||||
return graph_config;
|
||||
}
|
||||
|
||||
|
@ -1167,7 +1169,7 @@ TEST_F(GraphProfilerTestPeer, AddProcessSampleWithStreamLatency) {
|
|||
TEST(GraphProfilerTest, ParallelReads) {
|
||||
// A graph that processes a certain number of packets before finishing.
|
||||
CalculatorGraphConfig config;
|
||||
QCHECK(proto2::TextFormat::ParseFromString(R"(
|
||||
QCHECK(google::protobuf::TextFormat::ParseFromString(R"(
|
||||
profiler_config {
|
||||
enable_profiler: true
|
||||
}
|
||||
|
@ -1246,7 +1248,7 @@ std::set<std::string> GetCalculatorNames(const CalculatorGraphConfig& config) {
|
|||
|
||||
TEST(GraphProfilerTest, CalculatorProfileFilter) {
|
||||
CalculatorGraphConfig config;
|
||||
QCHECK(proto2::TextFormat::ParseFromString(R"(
|
||||
QCHECK(google::protobuf::TextFormat::ParseFromString(R"(
|
||||
profiler_config {
|
||||
enable_profiler: true
|
||||
}
|
||||
|
@ -1295,7 +1297,7 @@ TEST(GraphProfilerTest, CalculatorProfileFilter) {
|
|||
|
||||
TEST(GraphProfilerTest, CaptureProfilePopulateConfig) {
|
||||
CalculatorGraphConfig config;
|
||||
QCHECK(proto2::TextFormat::ParseFromString(R"(
|
||||
QCHECK(google::protobuf::TextFormat::ParseFromString(R"(
|
||||
profiler_config {
|
||||
enable_profiler: true
|
||||
trace_enabled: true
|
||||
|
|
|
@ -28,7 +28,7 @@ constexpr char kDescriptorContents[] =
|
|||
mediapipe::FieldData ReadFileDescriptorSet(const std::string& pb) {
|
||||
mediapipe::FieldData result;
|
||||
*result.mutable_message_value()->mutable_type_url() =
|
||||
"proto2.FileDescriptorSet";
|
||||
"google::protobuf.FileDescriptorSet";
|
||||
*result.mutable_message_value()->mutable_value() = pb;
|
||||
|
||||
// Force linking of the generated options protobuf.
|
||||
|
|
|
@ -66,26 +66,28 @@ std::string GetFieldString(const FieldData& message_data,
|
|||
void RegisterDescriptorProtos(
|
||||
absl::flat_hash_map<std::string, Descriptor>& result) {
|
||||
std::vector<Descriptor> descriptors = {
|
||||
{"proto2.FileDescriptorSet",
|
||||
{"google::protobuf.FileDescriptorSet",
|
||||
{
|
||||
{"file", 1, FieldType::TYPE_MESSAGE, "proto2.FileDescriptorProto"},
|
||||
{"file", 1, FieldType::TYPE_MESSAGE,
|
||||
"google::protobuf.FileDescriptorProto"},
|
||||
}},
|
||||
{"proto2.FileDescriptorProto",
|
||||
{"google::protobuf.FileDescriptorProto",
|
||||
{
|
||||
{"package", 2, FieldType::TYPE_STRING, ""},
|
||||
{"message_type", 4, FieldType::TYPE_MESSAGE,
|
||||
"proto2.DescriptorProto"},
|
||||
"google::protobuf.DescriptorProto"},
|
||||
}},
|
||||
{"proto2.DescriptorProto",
|
||||
{"google::protobuf.DescriptorProto",
|
||||
{
|
||||
{"name", 1, FieldType::TYPE_STRING, ""},
|
||||
{"field", 2, FieldType::TYPE_MESSAGE, "proto2.FieldDescriptorProto"},
|
||||
{"field", 2, FieldType::TYPE_MESSAGE,
|
||||
"google::protobuf.FieldDescriptorProto"},
|
||||
{"extension", 6, FieldType::TYPE_MESSAGE,
|
||||
"proto2.FieldDescriptorProto"},
|
||||
"google::protobuf.FieldDescriptorProto"},
|
||||
{"nested_type", 3, FieldType::TYPE_MESSAGE,
|
||||
"proto2.DescriptorProto"},
|
||||
"google::protobuf.DescriptorProto"},
|
||||
}},
|
||||
{"proto2.FieldDescriptorProto",
|
||||
{"google::protobuf.FieldDescriptorProto",
|
||||
{
|
||||
{"name", 1, FieldType::TYPE_STRING, ""},
|
||||
{"number", 3, FieldType::TYPE_INT32, ""},
|
||||
|
@ -140,7 +142,7 @@ void OptionsRegistry::Register(const FieldData& message_type,
|
|||
|
||||
const Descriptor* OptionsRegistry::GetProtobufDescriptor(
|
||||
const std::string& type_name) {
|
||||
if (descriptors().count("proto2.DescriptorProto") == 0) {
|
||||
if (descriptors().count("google::protobuf.DescriptorProto") == 0) {
|
||||
RegisterDescriptorProtos(descriptors());
|
||||
}
|
||||
absl::ReaderMutexLock lock(&mutex());
|
||||
|
|
|
@ -28,7 +28,7 @@ class OptionsRegistry {
|
|||
// Finds the descriptor for a protobuf.
|
||||
static const Descriptor* GetProtobufDescriptor(const std::string& type_name);
|
||||
|
||||
// Returns all known proto2 extensions to a type.
|
||||
// Returns all known google::protobuf extensions to a type.
|
||||
static void FindAllExtensions(absl::string_view extendee,
|
||||
std::vector<const FieldDescriptor*>* result);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user