Skip to content

Conversation

@kiruba115
Copy link
Contributor

RDKEMW-9781 : [Sharp HG]Video Format not updated properly in Input Signal Overlay

Enhance the retry mechanism for AudioPort and VideoDeviceInit as well
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an issue where video format is not updated properly in the Input Signal Overlay on Sharp HG devices. The fix refactors the initialization logic to apply retry mechanisms to all port initialization functions (audio, video, and video device), not just display initialization.

Key Changes:

  • Introduced a reusable retryInitialization helper function that encapsulates retry logic with configurable parameters
  • Extended retry logic from just dsDisplayInit to also cover dsAudioPortInit, dsVideoPortInit, and dsVideoDeviceInit
  • Refactored the initialization code for better maintainability and consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

printf("Manager::Initialize:%s result :%d retryCount :%d\n",
functionName, err, retryCount);
if (dsERR_NONE == err) break;
usleep(100000);
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

The retry delay is hardcoded to 100ms (100000 microseconds). Consider making this configurable as a parameter to the retryInitialization function, allowing different initialization functions to use different backoff strategies if needed.

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +100
} while ((checkInvalidState ? (dsERR_INVALID_STATE == err) : true) &&
(retryCount++ < maxRetries));
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

The condition logic is overly complex and potentially incorrect. When checkInvalidState is false, the loop will continue regardless of the error type, retrying even for errors that shouldn't be retried (like parameter validation errors). The loop should only retry when either: (1) checkInvalidState is true AND error is dsERR_INVALID_STATE, OR (2) a general retry is appropriate. Consider simplifying to: while ((err != dsERR_NONE) && (retryCount++ < maxRetries) && (!checkInvalidState || err == dsERR_INVALID_STATE)).

Suggested change
} while ((checkInvalidState ? (dsERR_INVALID_STATE == err) : true) &&
(retryCount++ < maxRetries));
} while ((err != dsERR_NONE) &&
(retryCount++ < maxRetries) &&
(!checkInvalidState || err == dsERR_INVALID_STATE));

Copilot uses AI. Check for mistakes.
Comment on lines 138 to 151
// This retry logic will wait for the device manager initialization from the client side
// until the device manager service initialization is completed. The retry mechanism checks
// only for dsERR_INVALID_STATE, which is reported if the underlying service is not ready.
err = retryInitialization("dsDisplayInit", dsDisplayInit, 25, true);
CHECK_RET_VAL(err);

err = retryInitialization("dsAudioPortInit", dsAudioPortInit);
CHECK_RET_VAL(err);
err = dsAudioPortInit();

err = retryInitialization("dsVideoPortInit", dsVideoPortInit);
CHECK_RET_VAL(err);
err = dsVideoPortInit();

err = retryInitialization("dsVideoDeviceInit", dsVideoDeviceInit);
CHECK_RET_VAL(err);
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

The comment states that retry logic is applied because the underlying service might not be ready, but now retry logic is applied to all initialization functions (dsAudioPortInit, dsVideoPortInit, dsVideoDeviceInit) without the checkInvalidState flag. This means these functions will retry up to 25 times for ANY error, not just dsERR_INVALID_STATE. This could mask real errors and add unnecessary delays (up to 2.5 seconds) when there are actual problems. Consider either: (1) passing true for checkInvalidState to these calls as well, or (2) updating the comment to explain why generic retries are now being applied to all initialization functions.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI commented Jan 12, 2026

@kiruba115 I've opened a new pull request, #198, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 5 commits January 12, 2026 16:15
Co-authored-by: kiruba115 <239660954+kiruba115@users.noreply.github.com>
Co-authored-by: kiruba115 <239660954+kiruba115@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: kiruba115 <239660954+kiruba115@users.noreply.github.com>
[WIP] Update video port initialization retry documentation/comments based on feedback
@github-actions
Copy link


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 2 committers have signed the CLA.
✅ (kiruba115)[https://github.com/kiruba115]
❌ @Copilot
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@rdkcmf-jenkins
Copy link
Contributor

b'## Copyright scan failure
Commit: cf64ded
Report detail: https://gist.github.com/rdkcmf-jenkins/231505d9e26aa13aa855e5a94ec20fbd'

@mhughesacn
Copy link

Hi @kiruba115 :
How many of these new files are output (generated) files which would not normally be checked in? Please remove any such files, logs, traces etc.
Can you remove the _codeql_detected_source_root link as this will cause confusion? (Some tools will break because of the self-reference.)
The autogenerated files are breaking the scan; I have configured several files to ignore because they are autogenerated, but you will need to add proper credits for external source. This means updates to NOTICE and LICENSE. I need to gather my thoughts here - it will be at least tomorrow.
Thank you,

  • MartinH, RDK CMF Compliance Team

@kiruba115
Copy link
Contributor Author

Closing this as Copilot has added more files to the changeset automatically when accepting the review suggestion.

@kiruba115 kiruba115 closed this Jan 13, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2026
@mhughesacn
Copy link

I worked out the credits that should be added earlier before the PR was closed, and I will add them here as a placeholder:

In NOTICE:

Copyright (C) 1992-2021 Free Software Foundation, Inc.
Licensed under the FSF Unlimited License

Copyright (C) 1994-2022 Free Software Foundation, Inc.
Licensed under the FSF Unlimited License (with License Retention)

Copyright (C) 1994 X Consortium
Licensed under the X Consortium License

Copyright (C) 2014-2022 Free Software Foundation, Inc.
Licensed under the GNU GPLv2 with Libtool exception

Copyright 1992-2022 Free Software Foundation, Inc.
Licensed under the GNU GPLv2 with Autoconf generic exception

Copyright 1992-2022 Free Software Foundation, Inc.
Licensed under the GNU GPLv3 with Autoconf generic exception

Copyright (C) 2004-2019, 2021 Bootstrap Authors
Redistribution chooses MIT license

Copyright (C) 2004 Scott James Remnant <scott@netsplit.com>.
Copyright (C) 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
GNU GPLv2 with Autoconf generic exception

and in LICENSE, the associated license text, but leaving out GPLv2 or v3 as they do not apply because of the exception:

Autoconf generic exception

As a special exception to the GNU General Public License, if you
distribute this file as part of a program that contains a
configuration script generated by Autoconf, you may include it under
the same distribution terms that you use for the rest of that program.


GNU GPLv2 with Libtool exception

As a special exception to the GNU General Public License, if you
distribute this file as part of a program or library that is built
using GNU Libtool, you may include this file under the  same
distribution terms that you use for the rest of that program.


X Consortium License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall not
be used in advertising or otherwise to promote the sale, use or other deal-
ings in this Software without prior written authorization from the X Consor-
tium.


FSF Unlimited License

This configure script is free software; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.


FSF Unlimited License (with License Retention)

This file is free software; the Free Software Foundation gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.


MIT License

Copyright <YEAR> <COPYRIGHT HOLDER>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the “Software”),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RDKEMW-9781: [Sharp HG]Video Format not updated properly in Input Signal Overlay

4 participants