|
75 | 75 | #define HDMICECSINK_NUMBER_TV_ADDR 2
|
76 | 76 | #define HDMICECSINK_UPDATE_POWER_STATUS_INTERVA_MS (60 * 1000)
|
77 | 77 | #define HDMISINK_ARC_START_STOP_MAX_WAIT_MS 4000
|
| 78 | +#define HDMICECSINK_UPDATE_AUDIO_STATUS_INTERVAL_MS 500 |
78 | 79 |
|
79 | 80 |
|
80 | 81 | #define SAD_FMT_CODE_AC3 2
|
@@ -173,10 +174,8 @@ static std::vector<RcProfile> rcProfile = {RC_PROFILE_TV};
|
173 | 174 | static std::vector<DeviceFeatures> deviceFeatures = {DEVICE_FEATURES_TV};
|
174 | 175 |
|
175 | 176 | #define API_VERSION_NUMBER_MAJOR 1
|
176 |
| -#define API_VERSION_NUMBER_MINOR 3 |
177 |
| -#define API_VERSION_NUMBER_PATCH 8 |
178 |
| - |
179 |
| -using PowerState = WPEFramework::Exchange::IPowerManager::PowerState; |
| 177 | +#define API_VERSION_NUMBER_MINOR 4 |
| 178 | +#define API_VERSION_NUMBER_PATCH 0 |
180 | 179 |
|
181 | 180 | namespace WPEFramework
|
182 | 181 | {
|
@@ -710,7 +709,10 @@ namespace WPEFramework
|
710 | 709 | m_currentActiveSource = -1;
|
711 | 710 | m_isHdmiInConnected = false;
|
712 | 711 | hdmiCecAudioDeviceConnected = false;
|
713 |
| - m_audioDevicePowerStatusRequested = false; |
| 712 | + m_isAudioStatusInfoUpdated = false; |
| 713 | + m_audioStatusReceived = false; |
| 714 | + m_audioStatusTimerStarted = false; |
| 715 | + m_audioDevicePowerStatusRequested = false; |
714 | 716 | m_pollNextState = POLL_THREAD_STATE_NONE;
|
715 | 717 | m_pollThreadState = POLL_THREAD_STATE_NONE;
|
716 | 718 | m_video_latency = DEFAULT_VIDEO_LATENCY;
|
@@ -758,6 +760,8 @@ namespace WPEFramework
|
758 | 760 | m_semSignaltoArcRoutingThread.acquire();
|
759 | 761 | m_arcRoutingThread = std::thread(threadArcRouting);
|
760 | 762 |
|
| 763 | + m_audioStatusDetectionTimer.connect( std::bind( &HdmiCecSink::audioStatusTimerFunction, this ) ); |
| 764 | + m_audioStatusDetectionTimer.setSingleShot(true); |
761 | 765 | m_arcStartStopTimer.connect( std::bind( &HdmiCecSink::arcStartStopTimerFunction, this ) );
|
762 | 766 | m_arcStartStopTimer.setSingleShot(true);
|
763 | 767 | // get power state:
|
@@ -1146,6 +1150,18 @@ namespace WPEFramework
|
1146 | 1150 | JsonObject params;
|
1147 | 1151 | if(!HdmiCecSink::_instance)
|
1148 | 1152 | return;
|
| 1153 | + if (m_audioStatusTimerStarted) |
| 1154 | + { |
| 1155 | + m_audioStatusReceived = true; |
| 1156 | + m_isAudioStatusInfoUpdated = true; |
| 1157 | + m_audioStatusTimerStarted = false; |
| 1158 | + if (m_audioStatusDetectionTimer.isActive()) |
| 1159 | + { |
| 1160 | + LOGINFO("AudioStatus received from the Audio Device and the timer is still active. So stopping the timer!\n"); |
| 1161 | + m_audioStatusDetectionTimer.stop(); |
| 1162 | + } |
| 1163 | + LOGINFO("AudioStatus received from the Audio Device. Updating the AudioStatus info! m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted); |
| 1164 | + } |
1149 | 1165 | LOGINFO("Command: ReportAudioStatus %s audio Mute status %d means %s and current Volume level is %d \n",GetOpName(msg.opCode()),msg.status.getAudioMuteStatus(),msg.status.toString().c_str(),msg.status.getAudioVolume());
|
1150 | 1166 | params["muteStatus"] = msg.status.getAudioMuteStatus();
|
1151 | 1167 | params["volumeLevel"] = msg.status.getAudioVolume();
|
@@ -2476,7 +2492,14 @@ namespace WPEFramework
|
2476 | 2492 | params["status"] = string("success");
|
2477 | 2493 | params["audioDeviceConnected"] = string("false");
|
2478 | 2494 | hdmiCecAudioDeviceConnected = false;
|
2479 |
| - sendNotify(eventString[HDMICECSINK_EVENT_AUDIO_DEVICE_CONNECTED_STATUS], params); |
| 2495 | + if (m_audioStatusDetectionTimer.isActive()){ |
| 2496 | + m_audioStatusDetectionTimer.stop(); |
| 2497 | + } |
| 2498 | + m_isAudioStatusInfoUpdated = false; |
| 2499 | + m_audioStatusReceived = false; |
| 2500 | + m_audioStatusTimerStarted = false; |
| 2501 | + LOGINFO("Audio device removed, reset the audio status info. m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted); |
| 2502 | + sendNotify(eventString[HDMICECSINK_EVENT_AUDIO_DEVICE_CONNECTED_STATUS], params) |
2480 | 2503 | }
|
2481 | 2504 |
|
2482 | 2505 | _instance->deviceList[logicalAddress].m_isRequestRetry = 0;
|
@@ -3093,6 +3116,14 @@ namespace WPEFramework
|
3093 | 3116 |
|
3094 | 3117 | m_logicalAddressAllocated = LogicalAddress::UNREGISTERED;
|
3095 | 3118 | m_currentArcRoutingState = ARC_STATE_ARC_TERMINATED;
|
| 3119 | + if (m_audioStatusDetectionTimer.isActive()){ |
| 3120 | + m_audioStatusDetectionTimer.stop(); |
| 3121 | + } |
| 3122 | + m_isAudioStatusInfoUpdated = false; |
| 3123 | + m_audioStatusReceived = false; |
| 3124 | + m_audioStatusTimerStarted = false; |
| 3125 | + LOGINFO("CEC Disabled, reset the audio status info. m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted); |
| 3126 | + |
3096 | 3127 |
|
3097 | 3128 | for(int i=0; i< 16; i++)
|
3098 | 3129 | {
|
@@ -3348,12 +3379,43 @@ namespace WPEFramework
|
3348 | 3379 |
|
3349 | 3380 | if((_instance->m_SendKeyQueue.size()<=1 || (_instance->m_SendKeyQueue.size() % 2 == 0)) && ((keyInfo.keyCode == VOLUME_UP) || (keyInfo.keyCode == VOLUME_DOWN) || (keyInfo.keyCode == MUTE)) )
|
3350 | 3381 | {
|
3351 |
| - _instance->sendGiveAudioStatusMsg(); |
3352 |
| - } |
| 3382 | + if(keyInfo.keyCode == MUTE) |
| 3383 | + { |
| 3384 | + _instance->sendGiveAudioStatusMsg(); |
| 3385 | + } |
| 3386 | + else |
| 3387 | + { |
| 3388 | + LOGINFO("m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ",_instance->m_isAudioStatusInfoUpdated,_instance->m_audioStatusReceived,_instance->m_audioStatusTimerStarted); |
| 3389 | + if (!_instance->m_isAudioStatusInfoUpdated) |
| 3390 | + { |
| 3391 | + if ( !(_instance->m_audioStatusDetectionTimer.isActive())) |
| 3392 | + { |
| 3393 | + LOGINFO("Audio status info not updated. Starting the Timer!"); |
| 3394 | + _instance->m_audioStatusTimerStarted = true; |
| 3395 | + _instance->m_audioStatusDetectionTimer.start((HDMICECSINK_UPDATE_AUDIO_STATUS_INTERVAL_MS)); |
| 3396 | + } |
| 3397 | + LOGINFO("m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", _instance->m_isAudioStatusInfoUpdated,_instance->m_audioStatusReceived,_instance->m_audioStatusTimerStarted); |
| 3398 | + } |
| 3399 | + else |
| 3400 | + { |
| 3401 | + if (!_instance->m_audioStatusReceived){ |
| 3402 | + _instance->sendGiveAudioStatusMsg(); |
| 3403 | + } |
| 3404 | + } |
| 3405 | + } |
| 3406 | + } |
3353 | 3407 |
|
3354 | 3408 | }//while(!_instance->m_sendKeyEventThreadExit)
|
3355 | 3409 | }//threadSendKeyEvent
|
3356 | 3410 |
|
| 3411 | + void HdmiCecSink::audioStatusTimerFunction() |
| 3412 | + { |
| 3413 | + m_audioStatusTimerStarted = false; |
| 3414 | + m_isAudioStatusInfoUpdated = true; |
| 3415 | + LOGINFO("Timer Expired. Requesting the AudioStatus since not received.\n"); |
| 3416 | + sendGiveAudioStatusMsg(); |
| 3417 | + LOGINFO("m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted); |
| 3418 | + } |
3357 | 3419 |
|
3358 | 3420 | void HdmiCecSink::threadArcRouting()
|
3359 | 3421 | {
|
|
0 commit comments