Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
90031b5
add sleep in destructor of test
preeja33 Aug 20, 2025
0c277fd
Update MiracastServiceImplementation.cpp
preeja33 Aug 20, 2025
c361e04
Update L1-tests.yml
preeja33 Aug 20, 2025
ed8950a
Update MiracastController.cpp
preeja33 Aug 20, 2025
6d1817d
Update MiracastController.cpp
preeja33 Aug 20, 2025
d7c93e9
Update MiracastController.cpp
preeja33 Aug 20, 2025
b960740
Update MiracastP2P.cpp
preeja33 Aug 21, 2025
256de6d
Update MiracastController.cpp
preeja33 Aug 21, 2025
b6616ae
Update MiracastP2P.cpp
preeja33 Aug 21, 2025
18377be
Update MiracastCommon.cpp
preeja33 Aug 21, 2025
97bf9d1
Update MiracastLogger.cpp
preeja33 Aug 21, 2025
5b72bc0
Update MiracastP2P.cpp
preeja33 Aug 21, 2025
4834db8
Update MiracastController.cpp
preeja33 Aug 21, 2025
c431142
Update MiracastController.cpp
preeja33 Aug 21, 2025
2cfd0c0
Update MiracastCommon.cpp
preeja33 Aug 21, 2025
e4b52b9
Update MiracastController.cpp
preeja33 Aug 21, 2025
d07c743
Update MiracastCommon.cpp
preeja33 Aug 21, 2025
052b64c
Update MiracastCommon.cpp
preeja33 Aug 21, 2025
a6c22d8
Update MiracastCommon.cpp
preeja33 Aug 21, 2025
32d7992
Update MiracastCommon.cpp
preeja33 Aug 21, 2025
cd44116
Update MiracastCommon.cpp
preeja33 Aug 21, 2025
7eaab09
Update MiracastController.cpp
preeja33 Aug 21, 2025
82774d1
Update MiracastController.cpp
preeja33 Aug 21, 2025
b64725b
Update MiracastController.cpp
preeja33 Aug 21, 2025
5739a01
Update MiracastController.cpp
preeja33 Aug 21, 2025
2088ce2
Update MiracastController.cpp
preeja33 Aug 21, 2025
5a9936a
Update MiracastCommon.cpp
preeja33 Aug 21, 2025
b4fa0eb
Update MiracastCommon.cpp
preeja33 Aug 21, 2025
1a0e2bf
Update MiracastCommon.cpp
preeja33 Aug 22, 2025
7979434
Update MiracastCommon.cpp
preeja33 Aug 22, 2025
a2fa25c
Update MiracastController.cpp
preeja33 Aug 22, 2025
fa8e4bf
Update MiracastServiceImplementation.cpp
preeja33 Aug 22, 2025
07cb92a
Update test_MiracastService.cpp
preeja33 Aug 22, 2025
c5339da
Update test_MiracastService.cpp
preeja33 Aug 22, 2025
85ccdca
Update test_MiracastService.cpp
preeja33 Aug 22, 2025
e83e97f
Update test_MiracastService.cpp
preeja33 Aug 22, 2025
93329d9
Update MiracastServiceImplementation.cpp
preeja33 Aug 27, 2025
873d70d
remove sleep hack
preeja33 Aug 27, 2025
85d314d
comment plyaer test
preeja33 Aug 27, 2025
a07917b
Update test_MiracastPlayer.cpp
preeja33 Aug 27, 2025
f2b9040
Update MiracastService.cpp
preeja33 Aug 28, 2025
8f933c6
Update MiracastServiceImplementation.cpp
preeja33 Aug 28, 2025
c908a60
Update MiracastServiceImplementation.cpp
preeja33 Aug 28, 2025
829410b
Update MiracastService.cpp
preeja33 Aug 28, 2025
09fe767
Update MiracastService.cpp
preeja33 Aug 28, 2025
682f835
Update MiracastService.cpp
preeja33 Aug 28, 2025
5286bc1
Update MiracastService.cpp
preeja33 Aug 28, 2025
43653bb
Update MiracastService.cpp
preeja33 Aug 28, 2025
e379875
Update MiracastController.cpp
preeja33 Aug 29, 2025
11728ad
Update MiracastService.cpp
balav08 Aug 29, 2025
70c35a2
Update test_MiracastService.cpp
balav08 Aug 29, 2025
f18129e
Update MiracastServiceImplementation.cpp
preeja33 Aug 29, 2025
fae9ae2
Update MiracastService.cpp
preeja33 Aug 29, 2025
ce3b0ee
Merge branch 'develop' into test_malloc
preeja33 Sep 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/L1-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
with:
repository: rdkcentral/entservices-casting
path: entservices-casting
ref: develop
ref: test_malloc

- name: Checkout googletest
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
49 changes: 30 additions & 19 deletions Miracast/MiracastService/MiracastController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ MiracastController *MiracastController::getInstance(MiracastError &error_code, M

void MiracastController::destroyInstance()
{
MIRACASTLOG_TRACE("Entering...");
MIRACASTLOG_INFO("Entering...");
if (nullptr != m_miracast_ctrl_obj)
{
m_miracast_ctrl_obj->destroy_ControllerFramework();
delete m_miracast_ctrl_obj;
m_miracast_ctrl_obj = nullptr;
}
MIRACASTLOG_TRACE("Exiting...");

MIRACASTLOG_INFO("Exiting...");
}

MiracastController::MiracastController(void)
Expand All @@ -71,7 +72,7 @@ MiracastController::MiracastController(void)

MiracastController::~MiracastController()
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Uncaught exception

An exception of type "std::regex_error" is thrown but the exception specification "/implicit/noexcept" doesn't allow it to be thrown. This will result in a call to terminate().

Medium Impact, CWE-248
UNCAUGHT_EXCEPT

{
MIRACASTLOG_TRACE("Entering...");
MIRACASTLOG_INFO("Entering...");

while (!m_deviceInfoList.empty())
{
Expand All @@ -85,13 +86,17 @@ MiracastController::~MiracastController()
m_groupInfo = nullptr;
}

MIRACASTLOG_TRACE("Exiting...");


// ControllerThreadCallback(this);
//destroy_ControllerFramework();
MIRACASTLOG_INFO("Exiting...");
}

MiracastError MiracastController::create_ControllerFramework(std::string p2p_ctrl_iface)
{
MiracastError ret_code = MIRACAST_OK;
MIRACASTLOG_TRACE("Entering...");
MIRACASTLOG_INFO("Entering...start controller thread");

m_controller_thread = new MiracastThread(CONTROLLER_THREAD_NAME,
CONTROLLER_THREAD_STACK,
Expand Down Expand Up @@ -503,7 +508,7 @@ void MiracastController::event_handler(P2P_EVENTS eventId, void *data, size_t le
std::string event_buffer;
MIRACASTLOG_TRACE("Entering...");

event_buffer = (char *)data;
event_buffer = static_cast<char*>(data);
free(data);

if ( false == m_start_discovering_enabled )
Expand All @@ -518,8 +523,8 @@ void MiracastController::event_handler(P2P_EVENTS eventId, void *data, size_t le
controller_msgq_data.state = convertP2PtoSessionActions(eventId);
strncpy(controller_msgq_data.msg_buffer, event_buffer.c_str(), sizeof(controller_msgq_data.msg_buffer));
controller_msgq_data.msg_buffer[sizeof(controller_msgq_data.msg_buffer) - 1] = '\0';

MIRACASTLOG_INFO("event_handler to Controller Action[%#08X] buffer:%s ", controller_msgq_data.state, event_buffer.c_str());
MIRACASTLOG_INFO("event_handler to Controller Action[%#08X] buffer:%s len %d", controller_msgq_data.state, event_buffer.c_str(),len);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Invalid type in argument to printf format specifier

Argument "len" to format specifier "%d" was expected to have type "int" but has type "unsigned long".

Medium Impact, CWE-686
PRINTF_ARGS

m_controller_thread->send_message(&controller_msgq_data, sizeof(controller_msgq_data));
MIRACASTLOG_VERBOSE("event received : %d buffer:%s ", eventId, event_buffer.c_str());
}
Expand Down Expand Up @@ -642,7 +647,7 @@ bool MiracastController::get_connection_status()
void MiracastController::create_DeviceCacheData(std::string deviceMAC,std::string authType,std::string modelName,std::string deviceType, bool force_overwrite)
{
bool new_device_entry = false;
MIRACASTLOG_TRACE("Entering...");
MIRACASTLOG_INFO("Entering...");
DeviceInfo *cur_device_info_ptr = MiracastController::get_device_details(deviceMAC);

// Allocate memory and update the device cache info
Expand All @@ -651,7 +656,7 @@ void MiracastController::create_DeviceCacheData(std::string deviceMAC,std::strin
cur_device_info_ptr = new DeviceInfo;
new_device_entry = true;
force_overwrite = true;
MIRACASTLOG_VERBOSE("#### Creating Device Cache ####");
MIRACASTLOG_INFO("#### Creating Device Cache ####");
}

if (( nullptr != cur_device_info_ptr ) && (force_overwrite))
Expand All @@ -673,24 +678,25 @@ void MiracastController::create_DeviceCacheData(std::string deviceMAC,std::strin
{
m_deviceInfoList.push_back(cur_device_info_ptr);
}
MIRACASTLOG_TRACE("Exiting...");
MIRACASTLOG_INFO("Exiting...");
}

DeviceInfo *MiracastController::get_device_details(std::string MAC)
{
DeviceInfo *deviceInfo = nullptr;
std::size_t found;
MIRACASTLOG_TRACE("Entering...");
MIRACASTLOG_INFO("Entering...");
for (auto device : m_deviceInfoList)
{
MIRACASTLOG_INFO("Entering device info list");
found = device->deviceMAC.find(MAC);
if (found != std::string::npos)
{
deviceInfo = device;
break;
}
}
MIRACASTLOG_TRACE("Exiting...");
MIRACASTLOG_INFO("Exiting...");
return deviceInfo;
}

Expand Down Expand Up @@ -784,19 +790,19 @@ void MiracastController::Controller_Thread(void *args)
session_restart_required = false,
p2p_group_instance_alive = false;

MIRACASTLOG_TRACE("Entering...");
MIRACASTLOG_INFO("Entering...");

while (nullptr != m_controller_thread)
{
std::string event_buffer;
event_buffer.clear();

MIRACASTLOG_TRACE("!!! Waiting for Event !!!\n");
MIRACASTLOG_INFO("!!! Waiting for Event !!!\n");
m_controller_thread->receive_message(&controller_msgq_data, CONTROLLER_MSGQ_SIZE, THREAD_RECV_MSG_INDEFINITE_WAIT);

event_buffer = controller_msgq_data.msg_buffer;

MIRACASTLOG_TRACE("!!! Received Action[%#08X]Data[%s] !!!\n", controller_msgq_data.state, event_buffer.c_str());
MIRACASTLOG_INFO("!!! Received Action[%#08X]Data[%s] !!!\n", controller_msgq_data.state, event_buffer.c_str());

if (CONTROLLER_SELF_ABORT == controller_msgq_data.state)
{
Expand Down Expand Up @@ -1099,6 +1105,7 @@ void MiracastController::Controller_Thread(void *args)
else
{
error_code = WPEFramework::Exchange::IMiracastService::REASON_CODE_GENERIC_FAILURE;
MIRACASTLOG_INFO("predebug session restart");
session_restart_required = true;
MIRACASTLOG_ERROR("!!!! Unable to get the Source Device IP and Terminating Group Here !!!!");
remove_P2PGroupInstance();
Expand All @@ -1124,6 +1131,7 @@ void MiracastController::Controller_Thread(void *args)
p2p_group_instance_alive = false;
}
m_connect_req_notified = false;
MIRACASTLOG_ERROR("####exit from failure condition");
}

if ( true == session_restart_required )
Expand All @@ -1142,6 +1150,7 @@ void MiracastController::Controller_Thread(void *args)
session_restart_required = false;
}
}
MIRACASTLOG_ERROR("####exit from CONTROLLER_GO_GROUP_FORMATION_FAILURE");
break;
case CONTROLLER_GO_GROUP_REMOVED:
{
Expand Down Expand Up @@ -1247,6 +1256,7 @@ void MiracastController::Controller_Thread(void *args)
}
new_thunder_req_client_connection_sent = false;
another_thunder_req_client_connection_sent = false;
MIRACASTLOG_INFO("predebug session_restart_required\n");
session_restart_required = true;
p2p_group_instance_alive = false;
m_connect_req_notified = false;
Expand Down Expand Up @@ -1336,7 +1346,8 @@ void MiracastController::Controller_Thread(void *args)
MIRACASTLOG_ERROR("!!! Invalid MsgType Received[%#08X]Data[%s] !!!", controller_msgq_data.msg_type, event_buffer.c_str());
}
break;
}
}
MIRACASTLOG_ERROR("!!! exit from outer switch");
}
MIRACASTLOG_TRACE("Exiting...");
}
Expand Down Expand Up @@ -1605,10 +1616,10 @@ void ControllerThreadCallback(void *args)
{
MiracastController *miracast_ctrler_obj = (MiracastController *)args;
MIRACASTLOG_TRACE("Entering...");
sleep(1);
sleep(1);
if ( nullptr != miracast_ctrler_obj )
{
miracast_ctrler_obj->Controller_Thread(nullptr);
}
MIRACASTLOG_TRACE("Exiting...");
}
}
23 changes: 16 additions & 7 deletions Miracast/MiracastService/MiracastService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace WPEFramework
Exchange::JMiracastService::Register(*this, mMiracastServiceImpl);
mRegisterEvents = true;
}
mConfigure->Release();
//mConfigure->Release();
}
else
{
Expand Down Expand Up @@ -130,7 +130,7 @@ namespace WPEFramework
void MiracastService::Deinitialize(PluginHost::IShell* service)
{
SYSLOG(Logging::Startup, (_T("MiracastService::Deinitialize: PID=%u"), getpid()));

LOGINFO("MiracastService::Deinitialize in");
ASSERT(mCurrentService == service);
ASSERT(0 == mConnectionId);

Expand Down Expand Up @@ -172,11 +172,20 @@ namespace WPEFramework
if (nullptr != mCurrentService)
{
/* Make sure the Activated and Deactivated are no longer called before we start cleaning up.. */
mCurrentService->Unregister(&mMiracastServiceNotification);
mCurrentService->Release();
mCurrentService = nullptr;
}
mCurrentService->Unregister(&mMiracastServiceNotification);

if (mConfigure)
{
uint32_t result = mConfigure->Configure(NULL);
if (result == Core::ERROR_NONE) {
SYSLOG(Logging::Shutdown, (string(_T("MiracastService successfully destructed"))));
}
mConfigure->Release();
mConfigure = NULL;
}
}
mConnectionId = 0;

SYSLOG(Logging::Shutdown, (string(_T("MiracastService de-initialised"))));
}

Expand All @@ -194,4 +203,4 @@ namespace WPEFramework
}
}
} // namespace Plugin
} // namespace WPEFramework
} // namespace WPEFramework
Loading
Loading