Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions AVOutput/AVOutputTV.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ class AVOutputTV : public AVOutputBase {
*/
int updateAVoutputTVParam( std::string action, std::string tr181ParamName, capDetails_t info, tvPQParameterIndex_t pqParamIndex, int level );

int updateAVoutputTVParamImplementation( std::string action, std::string tr181ParamName, capDetails_t info, tvPQParameterIndex_t pqParamIndex, int level );

/* Every bootup this function is called to sync TR181 to TVSettings HAL for saving the value */
tvError_t syncAvoutputTVParamsToHAL(std::string pqmode, std::string source, std::string format);
/* Every Bootup this function is called to sync TR181 to TVSettings HAL for saving the picture mode assiocation to source */
Expand Down
56 changes: 55 additions & 1 deletion AVOutput/AVOutputTVHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "AVOutputTV.h"
#include "UtilsIarm.h"
#include "rfcapi.h"
#include <thread>

#define CAPABLITY_FILE_NAME "pq_capabilities.ini"

Expand Down Expand Up @@ -944,7 +945,7 @@ namespace Plugin {
return ret;
}

int AVOutputTV::updateAVoutputTVParam( std::string action, std::string tr181ParamName, capDetails_t info, tvPQParameterIndex_t pqParamIndex, int level )
int AVOutputTV::updateAVoutputTVParamImplementation( std::string action, std::string tr181ParamName, capDetails_t info, tvPQParameterIndex_t pqParamIndex, int level )
{
LOGINFO("Entry : %s\n",__FUNCTION__);
valueVectors_t values;
Expand Down Expand Up @@ -1137,6 +1138,59 @@ namespace Plugin {
return ret;
}

int AVOutputTV::updateAVoutputTVParam( std::string action, std::string tr181ParamName, capDetails_t info, tvPQParameterIndex_t pqParamIndex, int level )
{
LOGINFO("Entry : %s\n",__FUNCTION__);

int ret = 0;
tvError_t retVal = tvERROR_NONE;
std::string currentPicMode;
std::string currentSource;
std::string currentFormat;
tvVideoSrcType_t sourceIndex = VIDEO_SOURCE_IP;
char picMode[PIC_MODE_NAME_MAX]={0};

//GetCurrent pqmode
if(!getCurrentPictureMode(picMode)) {
LOGERR("Failed to get the current picture mode\n");
}
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

Inconsistent indentation - uses tabs instead of spaces like the rest of the code.

Suggested change
}
}

Copilot uses AI. Check for mistakes.


currentPicMode = picMode; //Convert to string

//GetCurrentVideoSource
retVal = GetCurrentVideoSource(&sourceIndex);
if(retVal != tvERROR_NONE) {
LOGERR("%s : GetCurrentVideoSource( ) Failed\n",__FUNCTION__);
return false;
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

The function return type is int but returning false (boolean). This should return an integer error code instead.

Suggested change
return false;
return -1;

Copilot uses AI. Check for mistakes.

}
currentSource = convertSourceIndexToString(sourceIndex);

//GetCurrentFormat
tvVideoFormatType_t formatIndex = VIDEO_FORMAT_NONE;
GetCurrentVideoFormat(&formatIndex);
if ( formatIndex == VIDEO_FORMAT_NONE) {
formatIndex = VIDEO_FORMAT_SDR;
}
Comment on lines +1172 to +1173
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

Inconsistent indentation - uses tabs instead of spaces like the rest of the code.

Suggested change
formatIndex = VIDEO_FORMAT_SDR;
}
formatIndex = VIDEO_FORMAT_SDR;
}

Copilot uses AI. Check for mistakes.

Comment on lines +1172 to +1173
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

Inconsistent indentation - uses tabs instead of spaces like the rest of the code.

Suggested change
formatIndex = VIDEO_FORMAT_SDR;
}
formatIndex = VIDEO_FORMAT_SDR;
}

Copilot uses AI. Check for mistakes.

currentFormat = convertVideoFormatToString(formatIndex);

LOGINFO("%s: Entry param : %s Action : %s pqmode : %s source :%s format :%s color:%s component:%s control:%s currentPicMode = %s currentSource = %s currentFormat = %s\n",
__FUNCTION__,tr181ParamName.c_str(),action.c_str(),info.pqmode.c_str(),info.source.c_str(),info.format.c_str(),info.color.c_str(),info.component.c_str(),info.control.c_str(),
currentPicMode.c_str(), currentSource.c_str(), currentFormat.c_str());

if(currentPicMode == info.pqmode && currentSource == info.source && currentFormat == info.format)
{
ret = updateAVoutputTVParamImplementation( action, tr181ParamName, info, pqParamIndex, level);
}
else
{
LOGINFO("Starting thread : %s\n",__FUNCTION__);
std::thread updateAVoutputTVParam_thread(&WPEFramework::Plugin::AVOutputTV::updateAVoutputTVParamImplementation, this, action, tr181ParamName, info, pqParamIndex, level);
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

Using detached threads without proper lifecycle management can lead to issues if the AVOutputTV object is destroyed while the thread is still running. Consider using a thread pool or ensuring proper cleanup.

Copilot uses AI. Check for mistakes.

updateAVoutputTVParam_thread.detach();

Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

When executing in thread mode (else branch), ret remains 0 but the actual operation result is lost since the thread is detached. Consider returning a different value to indicate async execution or implement a callback mechanism.

Suggested change
// Return -1 to indicate asynchronous execution
return -1;

Copilot uses AI. Check for mistakes.

}
return ret;
}

tvError_t AVOutputTV::syncAvoutputTVParamsToHAL(std::string pqmode,std::string source,std::string format)
{
int level={0};
Expand Down
Loading