Skip to content

Commit

Permalink
Format tst folder
Browse files Browse the repository at this point in the history
  • Loading branch information
stefankiesz committed Nov 29, 2023
1 parent 60f6242 commit 71ce830
Show file tree
Hide file tree
Showing 7 changed files with 522 additions and 756 deletions.
Empty file modified scripts/clang-format.sh
100644 → 100755
Empty file.
301 changes: 76 additions & 225 deletions tst/ProducerApiTest.cpp

Large diffs are not rendered by default.

208 changes: 77 additions & 131 deletions tst/ProducerFunctionalityTest.cpp

Large diffs are not rendered by default.

65 changes: 38 additions & 27 deletions tst/ProducerTestFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

using namespace std;

namespace com { namespace amazonaws { namespace kinesis { namespace video {

STATUS getProducerTestBase(UINT64 custom_handle, ProducerTestBase** ppTestBase) {
TestClientCallbackProvider* clientCallbackProvider = reinterpret_cast<TestClientCallbackProvider*> (custom_handle);
namespace com {
namespace amazonaws {
namespace kinesis {
namespace video {

STATUS getProducerTestBase(UINT64 custom_handle, ProducerTestBase** ppTestBase)
{
TestClientCallbackProvider* clientCallbackProvider = reinterpret_cast<TestClientCallbackProvider*>(custom_handle);
EXPECT_TRUE(clientCallbackProvider != nullptr);
if (clientCallbackProvider == nullptr) {
return STATUS_INVALID_OPERATION;
Expand All @@ -19,11 +23,11 @@ STATUS getProducerTestBase(UINT64 custom_handle, ProducerTestBase** ppTestBase)
return STATUS_SUCCESS;
}


/**
* Global write-once pointer to the tests
*/
STATUS TestClientCallbackProvider::storageOverflowPressure(UINT64 custom_handle, UINT64 remaining_bytes) {
STATUS TestClientCallbackProvider::storageOverflowPressure(UINT64 custom_handle, UINT64 remaining_bytes)
{
UNUSED_PARAM(custom_handle);
LOG_WARN("Reporting storage overflow. Bytes remaining " << remaining_bytes);
ProducerTestBase* testBase;
Expand All @@ -35,13 +39,16 @@ STATUS TestClientCallbackProvider::storageOverflowPressure(UINT64 custom_handle,
return STATUS_SUCCESS;
}

STATUS TestStreamCallbackProvider::streamConnectionStaleHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 last_buffering_ack) {
STATUS TestStreamCallbackProvider::streamConnectionStaleHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 last_buffering_ack)
{
UNUSED_PARAM(stream_handle);
LOG_WARN("Reporting stream stale. Last ACK received " << last_buffering_ack);
return validateCallback(custom_data);
}

STATUS TestStreamCallbackProvider::streamErrorReportHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UPLOAD_HANDLE upload_handle, UINT64 errored_timecode, STATUS status) {
STATUS TestStreamCallbackProvider::streamErrorReportHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UPLOAD_HANDLE upload_handle,
UINT64 errored_timecode, STATUS status)
{
UNUSED_PARAM(stream_handle);
LOG_ERROR("Reporting stream error. Errored timecode " << errored_timecode << " with status code " << status);
ProducerTestBase* testBase;
Expand All @@ -54,7 +61,8 @@ STATUS TestStreamCallbackProvider::streamErrorReportHandler(UINT64 custom_data,
return validateCallback(custom_data);
}

STATUS TestStreamCallbackProvider::droppedFrameReportHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 dropped_frame_timecode) {
STATUS TestStreamCallbackProvider::droppedFrameReportHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 dropped_frame_timecode)
{
UNUSED_PARAM(stream_handle);
LOG_WARN("Reporting dropped frame. Frame timecode " << dropped_frame_timecode);
ProducerTestBase* testBase;
Expand All @@ -67,7 +75,8 @@ STATUS TestStreamCallbackProvider::droppedFrameReportHandler(UINT64 custom_data,
return validateCallback(custom_data);
}

STATUS TestStreamCallbackProvider::streamLatencyPressureHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 duration) {
STATUS TestStreamCallbackProvider::streamLatencyPressureHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 duration)
{
UNUSED_PARAM(stream_handle);
LOG_WARN("Reporting stream latency pressure. Current buffer duration " << duration);

Expand All @@ -82,7 +91,8 @@ STATUS TestStreamCallbackProvider::streamLatencyPressureHandler(UINT64 custom_da
return validateCallback(custom_data);
}

STATUS TestStreamCallbackProvider::bufferDurationOverflowPressureHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 remaining_duration) {
STATUS TestStreamCallbackProvider::bufferDurationOverflowPressureHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 remaining_duration)
{
LOG_WARN("Reporting buffer duration overflow pressure. remaining duration " << remaining_duration);
ProducerTestBase* testBase;
STATUS ret = getProducerTestBase(custom_data, &testBase);
Expand All @@ -93,7 +103,9 @@ STATUS TestStreamCallbackProvider::bufferDurationOverflowPressureHandler(UINT64
return validateCallback(custom_data);
}

STATUS TestStreamCallbackProvider::fragmentAckReceivedHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UPLOAD_HANDLE upload_handle, PFragmentAck fragment_ack) {
STATUS TestStreamCallbackProvider::fragmentAckReceivedHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UPLOAD_HANDLE upload_handle,
PFragmentAck fragment_ack)
{
UNUSED_PARAM(stream_handle);
UNUSED_PARAM(fragment_ack);
LOG_TRACE("Reporting fragment ack");
Expand All @@ -107,7 +119,8 @@ STATUS TestStreamCallbackProvider::fragmentAckReceivedHandler(UINT64 custom_data
if (testBase->previous_buffering_ack_timestamp_.find(upload_handle) != testBase->previous_buffering_ack_timestamp_.end() &&
fragment_ack->timestamp != testBase->previous_buffering_ack_timestamp_[upload_handle] && // timestamp can be same when retransmit happens
fragment_ack->timestamp - testBase->previous_buffering_ack_timestamp_[upload_handle] > testBase->getFragmentDurationMs()) {
LOG_ERROR("Buffering ack not in sequence. Previous ack ts: " << testBase->previous_buffering_ack_timestamp_[upload_handle] << " Current ack ts: " << fragment_ack->timestamp);
LOG_ERROR("Buffering ack not in sequence. Previous ack ts: " << testBase->previous_buffering_ack_timestamp_[upload_handle]
<< " Current ack ts: " << fragment_ack->timestamp);
testBase->buffering_ack_in_sequence_ = false;
}

Expand All @@ -117,12 +130,9 @@ STATUS TestStreamCallbackProvider::fragmentAckReceivedHandler(UINT64 custom_data
return validateCallback(custom_data);
}

STATUS TestStreamCallbackProvider::streamDataAvailableHandler(UINT64 custom_data,
STREAM_HANDLE stream_handle,
PCHAR stream_name,
UPLOAD_HANDLE stream_upload_handle,
UINT64 duration_available,
UINT64 size_available) {
STATUS TestStreamCallbackProvider::streamDataAvailableHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, PCHAR stream_name,
UPLOAD_HANDLE stream_upload_handle, UINT64 duration_available, UINT64 size_available)
{
UNUSED_PARAM(stream_handle);
UNUSED_PARAM(stream_name);
UNUSED_PARAM(stream_upload_handle);
Expand All @@ -132,7 +142,8 @@ STATUS TestStreamCallbackProvider::streamDataAvailableHandler(UINT64 custom_data
return validateCallback(custom_data);
}

STATUS TestStreamCallbackProvider::streamClosedHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 stream_upload_handle) {
STATUS TestStreamCallbackProvider::streamClosedHandler(UINT64 custom_data, STREAM_HANDLE stream_handle, UINT64 stream_upload_handle)
{
UNUSED_PARAM(stream_handle);
UNUSED_PARAM(stream_upload_handle);
LOG_INFO("Reporting stream stopped.");
Expand All @@ -149,8 +160,9 @@ STATUS TestStreamCallbackProvider::streamClosedHandler(UINT64 custom_data, STREA
return STATUS_SUCCESS;
}

STATUS TestStreamCallbackProvider::validateCallback(UINT64 custom_data) {
TestStreamCallbackProvider* streamCallbackProvider = reinterpret_cast<TestStreamCallbackProvider*> (custom_data);
STATUS TestStreamCallbackProvider::validateCallback(UINT64 custom_data)
{
TestStreamCallbackProvider* streamCallbackProvider = reinterpret_cast<TestStreamCallbackProvider*>(custom_data);
EXPECT_TRUE(streamCallbackProvider != nullptr);
if (streamCallbackProvider == nullptr) {
return STATUS_INVALID_OPERATION;
Expand All @@ -167,8 +179,7 @@ STATUS TestStreamCallbackProvider::validateCallback(UINT64 custom_data) {
return STATUS_SUCCESS;
}


} // namespace video
} // namespace kinesis
} // namespace amazonaws
} // namespace com;
} // namespace video
} // namespace kinesis
} // namespace amazonaws
} // namespace com
Loading

0 comments on commit 71ce830

Please sign in to comment.