16 #include <aws/core/Aws.h> 18 #include <gtest/gtest.h> 19 #include <gmock/gmock.h> 20 #include <kinesis-video-producer/KinesisVideoProducer.h> 21 #include <kinesis-video-producer/Logger.h> 25 #include <aws/kinesis/model/GetShardIteratorRequest.h> 26 #include <aws/kinesis/model/ListShardsRequest.h> 34 LOGGER_TAG(
"aws.kinesis.kinesis_manager_unittest");
36 #define PARAM_NS_SEPARATOR "/" 37 #define PARAM_NS_SEPARATOR_CHAR '/' 44 using ::testing::NiceMock;
47 using ::testing::Return;
49 using ::testing::StrEq;
50 using ::testing::InSequence;
51 using ::testing::DoAll;
52 using ::testing::SetArgReferee;
53 using ::testing::ContainerEq;
71 NAL_ADAPTATION_ANNEXB_NALS | NAL_ADAPTATION_ANNEXB_CPD_NALS},
104 map<string, string> string_map, map<
string, map<string, string>> map_map)
105 : int_map_(int_map), bool_map_(bool_map), string_map_(string_map), map_map_(map_map)
109 string Join(
const vector<string> & test_prefix)
112 for (
auto item = test_prefix.begin(); item != test_prefix.end(); item++) {
124 std::string name = FormatParameterPath(param_path);
125 if (int_map_.count(name) > 0) {
126 out = int_map_.at(name);
135 std::string name = FormatParameterPath(param_path);
136 if (bool_map_.count(name) > 0) {
137 out = bool_map_.at(name);
146 std::string name = FormatParameterPath(param_path);
147 if (string_map_.count(name) > 0) {
148 out = string_map_.at(name);
162 std::string name = FormatParameterPath(param_path);
163 if (map_map_.count(name) > 0) {
164 out = map_map_.at(name);
191 return DoFormatParameterPath(param_path);
202 unique_ptr<StreamDefinition> stream2)
205 StreamInfo stream1_info = stream1->getStreamInfo();
206 StreamInfo stream2_info = stream2->getStreamInfo();
210 if (stream1_info.streamCaps.trackInfoList[0].codecPrivateDataSize !=
211 stream2_info.streamCaps.trackInfoList[0].codecPrivateDataSize) {
214 result &= (0 == memcmp((
void *)&(stream1_info.streamCaps.trackInfoList[0].codecPrivateData),
215 (
void *)&(stream2_info.streamCaps.trackInfoList[0].codecPrivateData),
216 stream1_info.streamCaps.trackInfoList[0].codecPrivateDataSize));
218 if (stream1_info.tagCount != stream2_info.tagCount) {
221 for (
int tag_idx = 0; tag_idx < stream1_info.tagCount; tag_idx++) {
222 result &= (stream1_info.tags[tag_idx].version == stream2_info.tags[tag_idx].version);
223 result &= (0 == strncmp(stream1_info.tags[tag_idx].name, stream2_info.tags[tag_idx].name,
225 result &= (0 == strncmp(stream1_info.tags[tag_idx].value, stream2_info.tags[tag_idx].value,
232 stream1_info.streamCaps.trackInfoList =
nullptr;
233 stream2_info.streamCaps.trackInfoList =
nullptr;
234 stream1_info.tags =
nullptr;
235 stream2_info.tags =
nullptr;
236 result &= (0 == memcmp((
void *)&(stream1_info), (
void *)&(stream2_info),
sizeof(stream1_info)));
245 string region,
string test_prefix, std::shared_ptr<ParameterReaderInterface> parameter_reader,
248 #ifdef PLATFORM_TESTING_ACCESS_KEY 249 setenv(
"AWS_ACCESS_KEY_ID", PLATFORM_TESTING_ACCESS_KEY, 1);
251 #ifdef PLATFORM_TESTING_SECRET_KEY 252 setenv(
"AWS_SECRET_ACCESS_KEY", PLATFORM_TESTING_SECRET_KEY, 1);
257 unique_ptr<StreamDefinition> stream_definition = stream_definition_provider.
GetStreamDefinition(
258 ParameterPath(test_prefix.c_str()), *parameter_reader,
nullptr, 0);
259 return move(stream_definition);
267 string region,
string test_prefix,
270 std::shared_ptr<ParameterReaderInterface> parameter_reader =
271 std::make_shared<TestParameterReader>(test_prefix);
272 return DefaultProducerSetup(stream_manager, region, test_prefix, parameter_reader, video_producer_factory);
281 MOCK_CONST_METHOD0(GetServiceClientName,
const char *());
282 MOCK_CONST_METHOD1(ListShards, Model::ListShardsOutcome(
const Model::ListShardsRequest&));
283 MOCK_CONST_METHOD1(GetShardIterator,
284 Model::GetShardIteratorOutcome(
const Model::GetShardIteratorRequest&));
285 MOCK_CONST_METHOD1(GetRecords,
286 Model::GetRecordsOutcome(
const Model::GetRecordsRequest&));
292 MOCK_CONST_METHOD0(IsReady,
bool());
293 MOCK_METHOD0(Stop,
bool());
294 MOCK_CONST_METHOD1(PutFrame,
bool(KinesisVideoFrame));
295 MOCK_METHOD3(PutFragmentMetadata,
bool(
const std::string&,
const std::string&,
bool));
301 std::shared_ptr<KinesisVideoStreamInterface>
CreateStreamSync(std::unique_ptr<StreamDefinition> stream_definition) {
302 return CreateStreamSyncProxy(stream_definition.get());
304 MOCK_METHOD1(CreateStreamSyncProxy,
305 std::shared_ptr<KinesisVideoStreamInterface>(StreamDefinition* stream_definition));
306 MOCK_METHOD1(FreeStream,
void(std::shared_ptr<KinesisVideoStreamInterface> kinesis_video_stream));
318 result &= (left.GetSequenceNumber() == right.GetSequenceNumber());
319 result &= (left.GetApproximateArrivalTimestamp() == right.GetApproximateArrivalTimestamp());
320 result &= (left.GetData() == right.GetData());
321 result &= (left.GetPartitionKey() == right.GetPartitionKey());
322 result &= (left.GetEncryptionType() == right.GetEncryptionType());
335 MOCK_METHOD1(Uninstall,
void(
const std::string &
topic_name));
341 MOCK_CONST_METHOD4(GetCodecPrivateData,
348 MOCK_CONST_METHOD4(GetCodecPrivateData,
351 MOCK_CONST_METHOD4(GetStreamDefinitionProxy,
356 uint32_t codec_private_data_size)
const override 358 StreamDefinition* stream_definition = GetStreamDefinitionProxy(prefix, reader,
359 codec_private_data, codec_private_data_size);
360 return std::unique_ptr<StreamDefinition>(stream_definition);
365 unique_ptr<KinesisVideoProducerInterface> video_producer)
367 return [& video_producer](
369 unique_ptr<com::amazonaws::kinesis::video::DeviceInfoProvider> device_info_provider,
370 unique_ptr<com::amazonaws::kinesis::video::ClientCallbackProvider> client_callback_provider,
371 unique_ptr<com::amazonaws::kinesis::video::StreamCallbackProvider> stream_callback_provider,
372 unique_ptr<com::amazonaws::kinesis::video::CredentialProvider> credential_provider
373 ) -> unique_ptr<KinesisVideoProducerInterface> {
374 return std::move(video_producer);
383 parameter_reader_ = std::make_shared<TestParameterReader>(int_map_, bool_map_, string_map_, map_map_);
387 string test_prefix_ =
"some/test/prefix";
388 string encoded_string_ =
"aGVsbG8gd29ybGQ=";
389 map<string, int> int_map_ = {};
390 map<string, bool> bool_map_ = {};
392 map<string, map<string, string>> map_map_ = {};
393 map<string, string> string_map_ = {
394 {test_prefix_ +
"codecPrivateData", encoded_string_},
405 std::unique_ptr<NiceMock<KinesisClientMock>> kinesis_client = std::unique_ptr<NiceMock<KinesisClientMock>>{};
407 & subscription_installer_, std::move(kinesis_client));
409 std::string metadata_name =
"metadata_name";
410 std::string metadata_value =
"metadata_value";
412 auto status = stream_manager.PutMetadata(stream_name, metadata_name, metadata_value);
420 std::string test_prefix =
"kinesis_video";
421 std::shared_ptr<ParameterReaderInterface> parameter_reader = std::make_shared<TestParameterReader>(test_prefix);
424 std::string metadata_name =
"metadata_name";
425 std::string metadata_value =
"metadata_value";
426 auto video_producer = std::make_unique<KinesisVideoProducerMock>();
427 auto video_stream_mock = std::make_shared<KinesisVideoStreamMock>();
429 EXPECT_CALL(*video_producer.get(), CreateStreamSyncProxy(_))
430 .WillOnce(Return(video_stream_mock));
431 EXPECT_CALL(*video_stream_mock, IsReady())
432 .WillOnce(Return(
false));
434 auto stream_definition =
DefaultProducerSetup(stream_manager, std::string(
"us-west-2"), test_prefix,
440 status = stream_manager.
PutMetadata(stream_name, metadata_name, metadata_value);
447 std::string test_prefix =
"kinesis_video";
448 std::shared_ptr<ParameterReaderInterface> parameter_reader = std::make_shared<TestParameterReader>(test_prefix);
451 std::string metadata_name =
"metadata_name";
452 std::string metadata_value =
"metadata_value";
453 auto video_producer = std::make_unique<KinesisVideoProducerMock>();
454 auto video_stream_mock = std::make_shared<KinesisVideoStreamMock>();
456 EXPECT_CALL(*video_producer.get(), CreateStreamSyncProxy(_))
457 .WillOnce(Return(video_stream_mock));
463 ON_CALL(*video_stream_mock, IsReady())
464 .WillByDefault(Return(
true));
466 InSequence video_stream_mock_seq;
468 EXPECT_CALL(*video_stream_mock, PutFragmentMetadata(StrEq(metadata_name), StrEq(metadata_value), _))
469 .WillOnce(Return(
false));
471 EXPECT_CALL(*video_stream_mock, PutFragmentMetadata(StrEq(metadata_name), StrEq(metadata_value), _))
472 .WillOnce(Return(
true));
475 auto stream_definition =
DefaultProducerSetup(stream_manager, std::string(
"us-west-2"), test_prefix,
480 status = stream_manager.
PutMetadata(stream_name, metadata_name, metadata_value);
482 status = stream_manager.
PutMetadata(stream_name, metadata_name, metadata_value);
489 std::string test_prefix =
"kinesis_video";
490 std::shared_ptr<ParameterReaderInterface> parameter_reader = std::make_shared<TestParameterReader>(test_prefix);
493 auto video_producer = std::make_unique<KinesisVideoProducerMock>();
494 auto video_stream_mock = std::make_shared<KinesisVideoStreamMock>();
496 EXPECT_CALL(*video_producer.get(), CreateStreamSyncProxy(_))
497 .WillOnce(Return(video_stream_mock));
498 EXPECT_CALL(*video_producer.get(), FreeStream(_)).Times(1);
500 auto stream_definition =
DefaultProducerSetup(stream_manager, std::string(
"us-west-2"), test_prefix,
505 ON_CALL(*video_stream_mock, IsReady())
506 .WillByDefault(Return(
true));
507 EXPECT_CALL(*video_stream_mock, Stop()).Times(1);
516 std::vector<uint8_t> codec_private_data = {1,2,3};
518 int stream_count_param = 1;
519 map<string, int> int_map = {
523 map<string, bool> bool_map;
524 map<string, string> string_map = {
530 map<string, map<string, string>> map_map;
534 std::unique_ptr<NiceMock<KinesisClientMock>> kinesis_client = std::unique_ptr<NiceMock<KinesisClientMock>>{};
536 & stream_definition_provider, & subscription_installer_, std::move(kinesis_client));
539 EXPECT_CALL(stream_definition_provider, GetStreamDefinitionProxy(_,_,_,_))
540 .WillOnce(Return(
nullptr));
542 EXPECT_CALL(subscription_installer_, Uninstall(StrEq(topic_name)))
552 map<string, int> int_map = {
555 auto parameter_reader = std::make_shared<TestParameterReader>(int_map, bool_map_, string_map_, map_map_);
556 std::unique_ptr<NiceMock<KinesisClientMock>> kinesis_client = std::unique_ptr<NiceMock<KinesisClientMock>>{};
558 & subscription_installer_, std::move(kinesis_client));
567 map<string, int> int_map = {
570 auto parameter_reader = std::make_shared<TestParameterReader>(int_map, bool_map_, string_map_, map_map_);
572 std::unique_ptr<NiceMock<KinesisClientMock>> kinesis_client = std::unique_ptr<NiceMock<KinesisClientMock>>{};
574 & subscription_installer_, std::move(kinesis_client));
576 EXPECT_CALL(stream_definition_provider, GetCodecPrivateData(_,_,_,_))
588 map<string, int> int_map = {
592 map<string, string> string_map = {
598 "rekognition_data_stream"},
600 "rekognition_topic_name"},
604 Aws::Vector<Model::Record> kinesis_records;
607 auto kinesis_client = std::make_unique<NiceMock<KinesisClientMock>>();
608 NiceMock<KinesisClientMock> * kinesis_client_p = kinesis_client.get();
610 & subscription_installer_, std::move(kinesis_client));
611 auto video_producer = std::make_unique<KinesisVideoProducerMock>();
612 auto video_stream_mock = std::make_shared<KinesisVideoStreamMock>();
614 EXPECT_CALL(*video_producer.get(), CreateStreamSyncProxy(_))
615 .WillOnce(Return(video_stream_mock));
618 EXPECT_CALL(stream_definition_provider, GetCodecPrivateData(_,_,_,_))
620 EXPECT_CALL(subscription_installer_, Install(_))
631 Model::ListShardsResult list_shards_result;
633 shard1.SetShardId(
"shard1Id");
634 list_shards_result.SetShards({shard1});
635 Model::ListShardsOutcome list_shards_outcome(list_shards_result);
637 EXPECT_CALL(*kinesis_client_p, ListShards(_))
638 .WillRepeatedly(Return(list_shards_outcome));
639 Model::GetShardIteratorResult get_shard_iterator_result;
640 get_shard_iterator_result.SetShardIterator(
"shardIterator");
641 Model::GetShardIteratorOutcome get_shard_iterator_outcome(get_shard_iterator_result);
642 EXPECT_CALL(*kinesis_client_p, GetShardIterator(_))
643 .WillRepeatedly(Return(get_shard_iterator_outcome));
645 Model::Record record1;
646 record1.SetSequenceNumber(
"seq_number1");
647 Aws::Vector<Model::Record> expected_kinesis_records = {record1};
648 Model::GetRecordsResult get_records_result;
649 get_records_result.SetRecords(expected_kinesis_records);
651 InSequence get_records_seq;
653 Model::GetRecordsOutcome get_records_outcome_ok(get_records_result);
654 EXPECT_CALL(*kinesis_client_p, GetRecords(_))
655 .WillOnce(Return(get_records_outcome_ok));
657 AWSError<KinesisErrors> get_records_error1(Aws::Kinesis::KinesisErrors::PROVISIONED_THROUGHPUT_EXCEEDED,
true);
658 Model::GetRecordsOutcome get_records_outcome_error1(get_records_error1);
659 EXPECT_CALL(*kinesis_client_p, GetRecords(_))
660 .WillOnce(Return(get_records_outcome_error1));
662 AWSError<KinesisErrors> get_records_error2(Aws::Kinesis::KinesisErrors::EXPIRED_ITERATOR,
true);
663 Model::GetRecordsOutcome get_records_outcome_error2(get_records_error2);
664 EXPECT_CALL(*kinesis_client_p, GetRecords(_))
665 .WillOnce(Return(get_records_outcome_error2));
667 AWSError<KinesisErrors> get_records_error3(Aws::Kinesis::KinesisErrors::ACCESS_DENIED,
true);
668 Model::GetRecordsOutcome get_records_outcome_error3(get_records_error3);
669 EXPECT_CALL(*kinesis_client_p, GetRecords(_))
670 .WillOnce(Return(get_records_outcome_error3));
676 ASSERT_EQ(expected_kinesis_records, kinesis_records);
677 ASSERT_THAT(kinesis_records, ContainerEq(expected_kinesis_records));
694 std::unique_ptr<NiceMock<KinesisClientMock>> kinesis_client = std::unique_ptr<NiceMock<KinesisClientMock>>{};
696 & subscription_installer_, std::move(kinesis_client));
704 ASSERT_FALSE(stream_manager.get_video_producer());
705 unique_ptr<StreamDefinition> stream_definition =
706 DefaultProducerSetup(stream_manager,
string(
"us-west-2"),
string(
"stream/test"), parameter_reader_,
708 KinesisStreamManagerInterface::CreateDefaultVideoProducer);
709 ASSERT_TRUE(stream_manager.get_video_producer());
712 status = stream_manager.InitializeVideoStream(unique_ptr<StreamDefinition>{});
721 auto video_producer = std::make_unique<KinesisVideoProducerMock>();
722 auto video_stream_mock = std::make_shared<KinesisVideoStreamMock>();
724 EXPECT_CALL(*video_producer.get(), CreateStreamSyncProxy(_))
725 .WillOnce(Return(video_stream_mock));
727 auto stream_definition =
728 DefaultProducerSetup(stream_manager,
string(
"us-west-2"),
string(
"stream/test"), parameter_reader_,
745 auto video_producer = std::make_unique<KinesisVideoProducerMock>();
746 auto video_stream_mock = std::make_shared<KinesisVideoStreamMock>();
750 EXPECT_CALL(*video_producer.get(), CreateStreamSyncProxy(_))
751 .WillOnce(Return(video_stream_mock));
759 auto stream_definition =
762 status = stream_manager.
PutFrame(
string(stream_name), frame);
770 InSequence video_stream_mock_seq;
772 EXPECT_CALL(*video_stream_mock, IsReady())
773 .WillOnce(Return(
false));
775 EXPECT_CALL(*video_stream_mock, IsReady())
776 .WillOnce(Return(
true));
778 EXPECT_CALL(*video_stream_mock, PutFrame(_))
779 .WillOnce(Return(
false));
781 EXPECT_CALL(*video_stream_mock, IsReady())
782 .WillOnce(Return(
true));
784 EXPECT_CALL(*video_stream_mock, PutFrame(_))
785 .WillOnce(Return(
true));
789 status = stream_manager.
PutFrame(stream_name, frame);
794 status = stream_manager.
PutFrame(stream_name, frame);
798 status = stream_manager.
PutFrame(stream_name, frame);
805 TEST(StreamDefinitionProviderSuite, getCodecPrivateDataTest)
807 string test_prefix =
"some/test/prefix";
808 vector<string> test_prefix_list{
"some",
"test",
"prefix"};
811 string decoded_string =
"hello world";
812 string encoded_string =
"aGVsbG8gd29ybGQ=";
813 map<string, int> int_map = {};
814 map<string, bool> bool_map = {};
815 map<string, string> tags;
816 map<string, map<string, string>> map_map = {};
817 map<string, string> string_map = {
822 PBYTE codec_private_data;
823 uint32_t codec_private_data_size;
825 ParameterPath(test_prefix_list), parameter_reader, &codec_private_data,
826 &codec_private_data_size)));
827 ASSERT_EQ(decoded_string.length(), codec_private_data_size);
828 ASSERT_TRUE(0 == strncmp(decoded_string.c_str(), (
const char *)codec_private_data,
829 codec_private_data_size));
833 ParameterPath(test_prefix_list), parameter_reader,
nullptr, &codec_private_data_size);
837 ParameterPath(test_prefix_list), parameter_reader, &codec_private_data,
nullptr);
844 codec_private_data =
nullptr;
846 ParameterPath(test_prefix_list), empty_parameter_reader, &codec_private_data,
847 &codec_private_data_size)) && !codec_private_data);
853 TestParameterReader parameter_reader_with_invalid_values(int_map, bool_map, string_map, map_map);
855 parameter_reader_with_invalid_values, &codec_private_data, &codec_private_data_size);
864 TEST(StreamDefinitionProviderSuite, getStreamDefinitionTest)
866 string test_prefix =
"some/test/prefix";
867 vector<string> test_prefix_list{
"some",
"test",
"prefix"};
871 map<string, string> string_map = parameter_reader.
string_map_;
872 map<string, bool> bool_map = parameter_reader.
bool_map_;
873 map<string, int> int_map = parameter_reader.
int_map_;
874 map<string, map<string, string>> map_map = parameter_reader.
map_map_;
876 unique_ptr<StreamDefinition> generated_stream_definition =
878 parameter_reader,
nullptr, 0);
879 auto equivalent_stream_definition = make_unique<StreamDefinition>(
884 static_cast<STREAMING_TYPE
>(int_map[test_prefix +
PARAM_NS_SEPARATOR "streaming_type"]),
895 static_cast<NAL_ADAPTATION_FLAGS
>(int_map[test_prefix +
PARAM_NS_SEPARATOR "nal_adaptation_flags"]),
906 auto different_stream_definition = make_unique<StreamDefinition>(
911 static_cast<STREAMING_TYPE
>(int_map[test_prefix +
PARAM_NS_SEPARATOR "streaming_type"]),
922 static_cast<NAL_ADAPTATION_FLAGS
>(int_map[test_prefix +
PARAM_NS_SEPARATOR "nal_adaptation_flags"]), 4914918,
930 ParameterPath(test_prefix_list), parameter_reader,
nullptr, 0);
936 ParameterPath(test_prefix_list), parameter_reader,
nullptr, 100);
937 ASSERT_FALSE(generated_stream_definition);
946 #ifdef PLATFORM_TESTING_ACCESS_KEY 947 setenv(
"AWS_ACCESS_KEY_ID", PLATFORM_TESTING_ACCESS_KEY, 1);
949 #ifdef PLATFORM_TESTING_SECRET_KEY 950 setenv(
"AWS_SECRET_ACCESS_KEY", PLATFORM_TESTING_SECRET_KEY, 1);
956 unique_ptr<StreamDefinition> stream_definition = stream_definition_provider.
GetStreamDefinition(
958 return move(stream_definition);
964 TEST(KinesisStreamManagerSuite, videoInitializationTest)
966 string test_prefix =
"some/test/prefix";
989 ASSERT_EQ(video_producer, video_producer_post_call);
992 #ifdef BUILD_AWS_TESTING 1000 TEST(KinesisStreamManagerSuite, streamInitializationTest)
1010 unique_ptr<StreamDefinition> stream_definition =
1027 TEST(KinesisStreamManagerSuite, putFrameTest)
1038 unique_ptr<StreamDefinition> stream_definition =
1040 status = stream_manager.
PutFrame(
string(stream_name), frame);
1049 status = stream_manager.
PutFrame(stream_name, frame);
1055 std::vector<uint8_t> bytes = {0x00, 0x01, 0x02, 0x03};
1056 frame.frameData =
reinterpret_cast<PBYTE
>((
void *)(bytes.data()));
1057 frame.duration = 5000000;
1059 UINT64 timestamp = 0;
1060 timestamp = std::chrono::duration_cast<std::chrono::nanoseconds>(
1061 std::chrono::system_clock::now().time_since_epoch())
1063 DEFAULT_TIME_UNIT_IN_NANOS;
1064 frame.decodingTs = timestamp;
1065 frame.presentationTs = timestamp;
1066 frame.flags = (FRAME_FLAGS)0;
1068 status = stream_manager.
PutFrame(stream_name, frame);
1075 LOG_CONFIGURE_STDOUT(
"ERROR");
1076 Aws::SDKOptions options;
1077 Aws::InitAPI(options);
1078 testing::InitGoogleTest(&argc, argv);
1079 return RUN_ALL_TESTS();
std::shared_ptr< KinesisVideoStreamInterface > CreateStreamSync(std::unique_ptr< StreamDefinition > stream_definition)
TestParameterReader(const vector< string > &test_prefix)
KinesisStreamManagerInterface::VideoProducerFactory ConstVideoProducerFactory(unique_ptr< KinesisVideoProducerInterface > video_producer)
std::shared_ptr< ParameterReaderInterface > parameter_reader_
#define KINESIS_MANAGER_STATUS_FAILED(status)
AwsError ReadParam(const ParameterPath ¶m_path, map< string, string > &out) const
KinesisManagerStatus PutFrame(std::string stream_name, Frame &frame) const override
enum Aws::Kinesis::kinesis_manager_status_e KinesisManagerStatus
StreamDefinitionProvider stream_definition_provider_
map< string, string > tags_
TestParameterReader(map< string, int > int_map, map< string, bool > bool_map, map< string, string > string_map, map< string, map< string, string >> map_map)
static bool are_streams_equivalent(unique_ptr< StreamDefinition > stream1, unique_ptr< StreamDefinition > stream2)
KinesisManagerStatus InitializeVideoProducer(std::string region, std::unique_ptr< com::amazonaws::kinesis::video::DeviceInfoProvider > device_info_provider, std::unique_ptr< com::amazonaws::kinesis::video::ClientCallbackProvider > client_callback_provider, std::unique_ptr< com::amazonaws::kinesis::video::StreamCallbackProvider > stream_callback_provider, std::unique_ptr< com::amazonaws::kinesis::video::CredentialProvider > credential_provider, KinesisStreamManagerInterface::VideoProducerFactory video_producer_factory=KinesisStreamManagerInterface::CreateDefaultVideoProducer) override
void FreeStream(std::string stream_name) override
#define KINESIS_MANAGER_STATUS_SUCCEEDED(status)
virtual KinesisManagerStatus GetCodecPrivateData(const Aws::Client::ParameterPath &prefix, const Aws::Client::ParameterReaderInterface &reader, PBYTE *out_codec_private_data, uint32_t *out_codec_private_data_size) const
unique_ptr< StreamDefinition > DefaultProducerSetup(KinesisStreamManager &stream_manager, string region, string test_prefix, std::shared_ptr< ParameterReaderInterface > parameter_reader, KinesisStreamManagerInterface::VideoProducerFactory video_producer_factory)
virtual std::unique_ptr< com::amazonaws::kinesis::video::StreamDefinition > GetStreamDefinition(const Aws::Client::ParameterPath &prefix, const Aws::Client::ParameterReaderInterface &reader, const PBYTE codec_private_data, uint32_t codec_private_data_size) const
AwsError ReadParam(const ParameterPath ¶m_path, string &out) const
KinesisManagerStatus KinesisVideoStreamerSetup() override
map< string, map< string, string > > map_map_
std::function< std::unique_ptr< KinesisVideoProducerInterface >(std::string, std::unique_ptr< com::amazonaws::kinesis::video::DeviceInfoProvider >, std::unique_ptr< com::amazonaws::kinesis::video::ClientCallbackProvider >, std::unique_ptr< com::amazonaws::kinesis::video::StreamCallbackProvider >, std::unique_ptr< com::amazonaws::kinesis::video::CredentialProvider >)> VideoProducerFactory
LOGGER_TAG("aws.kinesis.kinesis_manager_unittest")
TEST(StreamDefinitionProviderSuite, getCodecPrivateDataTest)
KinesisStreamManagerMockingFixture()
KinesisManagerStatus ProcessCodecPrivateDataForStream(const std::string &stream_name, std::vector< uint8_t > codec_private_data) override
static string DoFormatParameterPath(const ParameterPath ¶m_path)
map< string, string > string_map_
TestParameterReader(string test_prefix)
int main(int argc, char **argv)
std::string get_resolved_path(char node_namespace_separator, char parameter_namespace_separator) const
map< string, bool > bool_map_
#define PARAM_NS_SEPARATOR_CHAR
Aws::Client::ParameterPath GetStreamParameterPath(int stream_idx, const char *parameter_name)
#define PARAM_NS_SEPARATOR
AwsError ReadParam(const ParameterPath ¶m_path, std::vector< std::string > &out) const
string FormatParameterPath(const ParameterPath ¶m_path) const
Aws::Client::ParameterPath GetKinesisVideoParameter(const char *parameter_name)
KinesisVideoProducerInterface * get_video_producer()
TEST_F(KinesisStreamManagerMockingFixture, testPutMetadataNotInitialized)
string Join(const vector< string > &test_prefix)
map< string, int > int_map_
AwsError ReadParam(const ParameterPath ¶m_path, double &out) const
unique_ptr< StreamDefinition > GetStreamDefinition(const ParameterPath &prefix, const ParameterReaderInterface &reader, const PBYTE codec_private_data, uint32_t codec_private_data_size) const override
StreamSubscriptionInstallerMock subscription_installer_
KinesisManagerStatus PutMetadata(std::string stream_name, const std::string &name, const std::string &value) const override
KinesisManagerStatus FetchRekognitionResults(const std::string &stream_name, Aws::Vector< Model::Record > *records) override
AwsError ReadParam(const ParameterPath ¶m_path, int &out) const
AwsError ReadParam(const ParameterPath ¶m_path, Aws::String &out) const
AwsError ReadParam(const ParameterPath ¶m_path, bool &out) const
KinesisManagerStatus InitializeVideoStream(std::unique_ptr< com::amazonaws::kinesis::video::StreamDefinition > stream_definition) override
bool operator==(const Record &left, const Record &right)