• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright (c) 2022-2025 Huawei Device Co., Ltd.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef OHOS_AVSESSION_ITEM_H
18 #define OHOS_AVSESSION_ITEM_H
19 
20 #include <dlfcn.h>
21 #include <string>
22 #include <map>
23 #include <mutex>
24 #include <shared_mutex>
25 
26 #include "avsession_stub.h"
27 #include "av_session_callback_proxy.h"
28 #include "avcontrol_command.h"
29 #include "audio_info.h"
30 #include "avcast_control_command.h"
31 #include "system_ability_definition.h"
32 #include "collaboration_manager_utils.h"
33 
34 #ifdef CASTPLUS_CAST_ENGINE_ENABLE
35 #include <condition_variable>
36 #include <chrono>
37 
38 #include "i_avcast_controller_proxy.h"
39 #include "avcast_controller_item.h"
40 #include "hw_cast_display_listener.h"
41 #endif
42 
43 namespace OHOS::AVSession {
44 class AVControllerItem;
45 class RemoteSessionSink;
46 class RemoteSessionSource;
47 class AVSessionItem : public AVSessionStub {
48 #ifdef CASTPLUS_CAST_ENGINE_ENABLE
49 class CssListener : public IAVRouterListener {
50 public:
CssListener(AVSessionItem * ptr)51     explicit CssListener(AVSessionItem *ptr)
52     {
53         ptr_ = ptr;
54     }
55 
OnCastStateChange(int32_t castState,DeviceInfo deviceInfo,bool isNeedRemove)56     void OnCastStateChange(int32_t castState, DeviceInfo deviceInfo, bool isNeedRemove)
57     {
58         ptr_->OnCastStateChange(castState, deviceInfo, isNeedRemove);
59     }
60 
OnCastEventRecv(int32_t errorCode,std::string & errorMsg)61     void OnCastEventRecv(int32_t errorCode, std::string& errorMsg)
62     {
63         ptr_->OnCastEventRecv(errorCode, errorMsg);
64     }
65 
66     AVSessionItem *ptr_;
67 };
68 #endif
69 public:
70     explicit AVSessionItem(const AVSessionDescriptor& descriptor, int32_t userId = DEFAULT_USER_ID);
71 
72     ~AVSessionItem() override;
73 
74 #ifdef CASTPLUS_CAST_ENGINE_ENABLE
75     void DealCastState(int32_t castState);
76 
77     void DealDisconnect(DeviceInfo deviceInfo, bool isNeedRemove);
78 
79     void DealCollaborationPublishState(int32_t castState, DeviceInfo deviceInfo);
80 
81     void DealLocalState(int32_t castState);
82 
83     void OnCastStateChange(int32_t castState, DeviceInfo deviceInfo, bool isNeedRemove);
84 
85     void OnCastEventRecv(int32_t errorCode, std::string& errorMsg);
86 
87     void ListenCollaborationApplyResult();
88 
89     void ListenCollaborationOnStop();
90 #endif
91 
92     std::string GetSessionId() override;
93 
94     std::string GetSessionType() override;
95 
96     int32_t SetAVCallMetaData(const AVCallMetaData& avCallMetaData) override;
97 
98     int32_t SetAVCallState(const AVCallState& avCallState) override;
99 
100     int32_t GetAVMetaData(AVMetaData& meta) override;
101 
102     int32_t SetAVMetaData(const AVMetaData& meta) override;
103 
104     int32_t UpdateAVQueueInfo(const AVQueueInfo& info) override;
105 
106     int32_t GetAVQueueItems(std::vector<AVQueueItem>& items) override;
107 
108     int32_t SetAVQueueItems(const std::vector<AVQueueItem>& items) override;
109 
110     int32_t GetAVQueueTitle(std::string& title) override;
111 
112     int32_t SetAVQueueTitle(const std::string& title) override;
113 
114     int32_t GetAVPlaybackState(AVPlaybackState& state) override;
115 
116     int32_t SendCustomData(const AAFwk::WantParams& data) override;
117 
118     void SendCustomDataInner(const AAFwk::WantParams& data);
119 
120     int32_t SetLaunchAbility(const AbilityRuntime::WantAgent::WantAgent& ability) override;
121 
122     int32_t GetExtras(AAFwk::WantParams& extras) override;
123 
124     int32_t SetExtras(const AAFwk::WantParams& extras) override;
125 
126     int32_t Activate() override;
127 
128     int32_t Deactivate() override;
129 
130     bool IsActive() override;
131 
132     int32_t Destroy() override;
133 
134     int32_t AddSupportCommand(int32_t cmd) override;
135 
136     int32_t DeleteSupportCommand(int32_t cmd) override;
137 
138     int32_t DestroyTask(bool continuePlay = false);
139 
140     AVSessionDescriptor GetDescriptor();
141 
142     int32_t SetAVPlaybackState(const AVPlaybackState& state) override;
143 
144     AVCallState GetAVCallState();
145 
146     AVCallMetaData GetAVCallMetaData();
147 
148     AVPlaybackState GetPlaybackState();
149 
150     AVMetaData GetMetaDataWithoutImg();
151 
152     AVMetaData GetMetaData();
153 
154     std::vector<AVQueueItem> GetQueueItems();
155 
156     std::string GetQueueTitle();
157 
158     AAFwk::WantParams GetExtras();
159 
160     void KeyEventExtras(AAFwk::IArray* list);
161 
162     void NotificationExtras(AAFwk::IArray* list);
163 
164     bool IsNotShowNotification();
165 
166     std::vector<int32_t> GetSupportCommand();
167 
168     AbilityRuntime::WantAgent::WantAgent GetLaunchAbility();
169 
170     void HandleMediaKeyEvent(const MMI::KeyEvent& keyEvent);
171 
172     void HandleOutputDeviceChange(const int32_t connectionState, const OutputDeviceInfo& outputDeviceInfo);
173 
174     void HandleSkipToQueueItem(const int32_t& itemId);
175 
176     void ExecuteControllerCommand(const AVControlCommand& cmd);
177 
178     void ExecueCommonCommand(const std::string& commonCommand, const AAFwk::WantParams& commandArgs);
179 
180     void ExecuteCustomData(const AAFwk::WantParams& data);
181 
182     int32_t AddController(pid_t pid, sptr<AVControllerItem>& controller);
183 
184     void SetPid(pid_t pid);
185 
186     void SetUid(pid_t uid);
187 
188     pid_t GetPid() const;
189 
190     pid_t GetUid() const;
191 
192     int32_t GetUserId() const;
193 
194     std::string GetAbilityName() const;
195 
196     std::string GetBundleName() const;
197 
198     void UpdateSessionElement(const AppExecFwk::ElementName& elementName);
199 
200     void SetPlayingTime(int64_t playingTime);
201 
202     int64_t GetPlayingTime() const;
203 
204     void SetTop(bool top);
205 
206     std::shared_ptr<RemoteSessionSource> GetRemoteSource();
207 
208     void HandleControllerRelease(pid_t pid);
209 
210     void SetServiceCallbackForRelease(const std::function<void(AVSessionItem&)>& callback);
211 
212     void SetServiceCallbackForCallStart(const std::function<void(AVSessionItem&)>& callback);
213 
214     void SetServiceCallbackForKeyEvent(const std::function<void(std::string)>& callback);
215 
216     void SetOutputDevice(const OutputDeviceInfo& info);
217 
218     void GetOutputDevice(OutputDeviceInfo& info);
219 
220     int32_t CastAudioToRemote(const std::string& sourceDevice, const std::string& sinkDevice,
221                               const std::string& sinkCapability);
222 
223     int32_t SourceCancelCastAudio(const std::string& sinkDevice);
224 
225     int32_t CastAudioFromRemote(const std::string& sourceSessionId, const std::string& sourceDevice,
226                                 const std::string& sinkDevice, const std::string& sourceCapability);
227 
228     int32_t SinkCancelCastAudio();
229 
230     int32_t SetSessionEvent(const std::string& event, const AAFwk::WantParams& args) override;
231 
232     void SetServiceCallbackForAVQueueInfo(const std::function<void(AVSessionItem&)>& callback);
233 
234     void SetServiceCallbackForUpdateSession(const std::function<void(std::string, bool)>& callback);
235 
236     void SetServiceCallbackForMediaSession(const std::function<void(std::string, bool, bool)>& callback);
237 
238     void SetServiceCallbackForNtfCapsule(const std::function<void(std::string, bool)>& callback);
239 
240     bool IsCasting();
241 
242     void GetCurrentCastItem(AVQueueItem& item);
243 
244     AVPlaybackState GetCastAVPlaybackState();
245 
246     void SendControlCommandToCast(AVCastControlCommand cmd);
247 
248     void SetServiceCallbackForUpdateExtras(const std::function<void(std::string)>& callback);
249 
250     void RegisterAVSessionCallback(std::shared_ptr<AVSessionCallback> callbackOfMigrate);
251 
252     void SetSupportCommand(std::vector<int32_t> cmds);
253 
254 #ifdef CASTPLUS_CAST_ENGINE_ENABLE
255     int32_t RegisterListenerStreamToCast(const std::pair<std::string, std::string>& serviceNameStatePair,
256         DeviceInfo deviceInfo);
257 
258     void InitializeCastCommands();
259 
260     void AddSessionCommandToCast(int32_t cmd);
261 
262     void RemoveSessionCommandFromCast(int32_t cmd);
263 
264     int32_t SessionCommandToCastCommand(int32_t cmd);
265 
266     int32_t AddSupportCastCommand(int32_t cmd);
267 
268     int32_t DeleteSupportCastCommand(int32_t cmd);
269 
270     void HandleCastValidCommandChange(const std::vector<int32_t>& cmds);
271 
272     int32_t ReleaseCast(bool continuePlay = false) override;
273 
274     int32_t StartCast(const OutputDeviceInfo& outputDeviceInfo);
275 
276     int32_t SubStartCast(const OutputDeviceInfo& outputDeviceInfo);
277 
278     int32_t CastAddToCollaboration(const OutputDeviceInfo& outputDeviceInfo);
279 
280     int32_t AddDevice(const int64_t castHandle, const OutputDeviceInfo& outputDeviceInfo,
281         uint32_t spid);
282 
283     int32_t StopCast(bool continuePlay = false);
284 
285     void dealValidCallback(int32_t cmd, std::vector<int32_t>& supportedCastCmds);
286 
287     sptr<IRemoteObject> GetAVCastControllerInner() override;
288 
289     void ReleaseAVCastControllerInner();
290 
291     void UpdateCastDeviceMap(DeviceInfo deviceInfo);
292 
293     void SetCastHandle(int64_t castHandle);
294 
295     void RegisterDeviceStateCallback();
296 
297     void UnRegisterDeviceStateCallback();
298 
299     void StopCastSession();
300 
301     int32_t StartCastDisplayListener() override;
302 
303     int32_t StopCastDisplayListener() override;
304 
305     void GetDisplayListener(sptr<IAVSessionCallback> callback);
306 
307     int32_t GetAllCastDisplays(std::vector<CastDisplayInfo>& castDisplays) override;
308 
309     void SetExtrasInner(AAFwk::IArray* list);
310 
311     void SetSpid(const AAFwk::WantParams& extras);
312 
313     uint32_t GetSpid();
314 
315     void SetServiceCallbackForStream(const std::function<void(std::string)>& callback);
316 
317     void SetServiceCallbackForCastNtfCapsule(const std::function<void(std::string, bool, bool)>& callback);
318 #endif
319 
320 #ifdef ENABLE_AVSESSION_SYSEVENT_CONTROL
321     void ReportPlaybackState(const AVPlaybackState& state);
322     void ReportMetadataChange(const AVMetaData& metadata);
323     void ReportCommandChange();
324     void ReportSessionControl(const std::string& bundleName, int32_t cmd);
325 #endif
326 
327     void ReadMetaDataImg(std::shared_ptr<AVSessionPixelMap>& innerPixelMap);
328     void ReadMetaDataAVQueueImg(std::shared_ptr<AVSessionPixelMap>& avQueuePixelMap);
329 
330 protected:
331     int32_t RegisterCallbackInner(const sptr<IAVSessionCallback>& callback) override;
332     sptr<IRemoteObject> GetControllerInner() override;
333 
334 private:
335     bool HasAvQueueInfo();
336     void HandleOnAVCallAnswer(const AVControlCommand& cmd);
337     void HandleOnAVCallHangUp(const AVControlCommand& cmd);
338     void HandleOnAVCallToggleCallMute(const AVControlCommand& cmd);
339     void HandleOnPlay(const AVControlCommand& cmd);
340     void HandleOnPause(const AVControlCommand& cmd);
341     void HandleOnPlayOrPause(const AVControlCommand& cmd);
342     void HandleOnStop(const AVControlCommand& cmd);
343     void HandleOnPlayNext(const AVControlCommand& cmd);
344     void HandleOnPlayPrevious(const AVControlCommand& cmd);
345     void HandleOnFastForward(const AVControlCommand& cmd);
346     void HandleOnRewind(const AVControlCommand& cmd);
347     void HandleOnSeek(const AVControlCommand& cmd);
348     void HandleOnSetSpeed(const AVControlCommand& cmd);
349     void HandleOnSetLoopMode(const AVControlCommand& cmd);
350     void HandleOnSetTargetLoopMode(const AVControlCommand& cmd);
351     void HandleOnToggleFavorite(const AVControlCommand& cmd);
352     void HandleOnPlayFromAssetId(const AVControlCommand& cmd);
353     void HandleOnPlayWithAssetId(const AVControlCommand& cmd);
354 
355     void ReportConnectFinish(const std::string func, const DeviceInfo &deviceInfo);
356     void ReportStopCastFinish(const std::string func, const DeviceInfo &deviceInfo);
357     void SaveLocalDeviceInfo();
358     int32_t ProcessFrontSession(const std::string& source);
359     void HandleFrontSession();
360     int32_t DoContinuousTaskRegister();
361     int32_t DoContinuousTaskUnregister();
362     void ReportSetAVMetaDataInfo(const AVMetaData& meta);
363     std::string GetAnonymousDeviceId(std::string deviceId);
364     void ReportAVCastControllerInfo();
365     void InitAVCastControllerProxy();
366     bool CheckTitleChange(const AVMetaData& meta);
367     void CheckUseAVMetaData(const AVMetaData& meta);
368     void PublishAVCastHa(int32_t castState, DeviceInfo deviceInfo);
369     void DelRecommend();
370     void UpdateRecommendInfo(bool needRecommend);
371     bool SearchSpidInCapability(const std::string& deviceId);
372     void CheckIfSendCapsule(const AVPlaybackState& state);
373 
374     using HandlerFuncType = std::function<void(const AVControlCommand&)>;
375     std::map<uint32_t, HandlerFuncType> cmdHandlers = {
376         {AVControlCommand::SESSION_CMD_PLAY,
377             [this](const AVControlCommand& cmd) { HandleOnPlay(cmd); }},
378         {AVControlCommand::SESSION_CMD_PAUSE,
379             [this](const AVControlCommand& cmd) { HandleOnPause(cmd); }},
380         {AVControlCommand::SESSION_CMD_STOP,
381             [this](const AVControlCommand& cmd) { HandleOnStop(cmd); }},
382         {AVControlCommand::SESSION_CMD_PLAY_NEXT,
383             [this](const AVControlCommand& cmd) { HandleOnPlayNext(cmd); }},
384         {AVControlCommand::SESSION_CMD_PLAY_PREVIOUS,
385             [this](const AVControlCommand& cmd) { HandleOnPlayPrevious(cmd); }},
386         {AVControlCommand::SESSION_CMD_FAST_FORWARD,
387             [this](const AVControlCommand& cmd) { HandleOnFastForward(cmd); }},
388         {AVControlCommand::SESSION_CMD_REWIND,
389             [this](const AVControlCommand& cmd) { HandleOnRewind(cmd); }},
390         {AVControlCommand::SESSION_CMD_SEEK,
391             [this](const AVControlCommand& cmd) { HandleOnSeek(cmd); }},
392         {AVControlCommand::SESSION_CMD_SET_SPEED,
393             [this](const AVControlCommand& cmd) { HandleOnSetSpeed(cmd); }},
394         {AVControlCommand::SESSION_CMD_SET_LOOP_MODE,
395             [this](const AVControlCommand& cmd) { HandleOnSetLoopMode(cmd); }},
396         {AVControlCommand::SESSION_CMD_SET_TARGET_LOOP_MODE,
397             [this](const AVControlCommand& cmd) { HandleOnSetTargetLoopMode(cmd); }},
398         {AVControlCommand::SESSION_CMD_TOGGLE_FAVORITE,
399             [this](const AVControlCommand& cmd) { HandleOnToggleFavorite(cmd); }},
400         {AVControlCommand::SESSION_CMD_PLAY_FROM_ASSETID,
401             [this](const AVControlCommand& cmd) { HandleOnPlayFromAssetId(cmd); }},
402         {AVControlCommand::SESSION_CMD_PLAY_WITH_ASSETID,
403             [this](const AVControlCommand& cmd) { HandleOnPlayWithAssetId(cmd); }},
404         {AVControlCommand::SESSION_CMD_AVCALL_ANSWER,
405             [this](const AVControlCommand& cmd) { HandleOnAVCallAnswer(cmd); }},
406         {AVControlCommand::SESSION_CMD_AVCALL_HANG_UP,
407             [this](const AVControlCommand& cmd) { HandleOnAVCallHangUp(cmd); }},
408         {AVControlCommand::SESSION_CMD_AVCALL_TOGGLE_CALL_MUTE,
409             [this](const AVControlCommand& cmd) { HandleOnAVCallToggleCallMute(cmd); }}
410     };
411 
412     std::map<int32_t, HandlerFuncType> keyEventCaller_ = {
413         {MMI::KeyEvent::KEYCODE_MEDIA_PLAY, [this](const AVControlCommand& cmd) { HandleOnPlay(cmd); }},
414         {MMI::KeyEvent::KEYCODE_MEDIA_PAUSE, [this](const AVControlCommand& cmd) { HandleOnPause(cmd); }},
415         {MMI::KeyEvent::KEYCODE_MEDIA_PLAY_PAUSE, [this](const AVControlCommand& cmd) { HandleOnPlayOrPause(cmd); }},
416         {MMI::KeyEvent::KEYCODE_MEDIA_STOP, [this](const AVControlCommand& cmd) { HandleOnPause(cmd); }},
417         {MMI::KeyEvent::KEYCODE_MEDIA_NEXT, [this](const AVControlCommand& cmd) { HandleOnPlayNext(cmd); }},
418         {MMI::KeyEvent::KEYCODE_MEDIA_PREVIOUS, [this](const AVControlCommand& cmd) { HandleOnPlayPrevious(cmd); }},
419         {MMI::KeyEvent::KEYCODE_MEDIA_REWIND, [this](const AVControlCommand& cmd) { HandleOnRewind(cmd); }},
420         {MMI::KeyEvent::KEYCODE_MEDIA_FAST_FORWARD, [this](const AVControlCommand& cmd) { HandleOnFastForward(cmd); }}
421     };
422 
423     std::map<pid_t, sptr<AVControllerItem>> controllers_;
424     AVCallMetaData avCallMetaData_;
425     AVCallState avCallState_;
426 
427     AVSessionDescriptor descriptor_;
428     int32_t userId_ = 0;
429     AVPlaybackState playbackState_;
430     AVMetaData metaData_;
431     AVMetaData lastMetaData_;
432     std::vector<AVQueueItem> queueItems_;
433     std::string queueTitle_;
434     AbilityRuntime::WantAgent::WantAgent launchAbility_;
435     AAFwk::WantParams extras_;
436     std::vector<int32_t> supportedCmd_;
437     std::vector<int32_t> supportedCastCmds_;
438     sptr<IAVSessionCallback> callback_;
439     std::shared_ptr<AVSessionCallback> callbackForMigrate_;
440     std::function<void(AVSessionItem&)> serviceCallback_;
441     std::function<void(AVSessionItem&)> callStartCallback_;
442     friend class AVSessionDumper;
443     int64_t playingTime_ = 0;
444 
445     std::shared_ptr<RemoteSessionSource> remoteSource_;
446     std::shared_ptr<RemoteSessionSink> remoteSink_;
447 
448     std::function<void(AVSessionItem&)> serviceCallbackForAddAVQueueInfo_;
449     std::function<void(std::string, bool)> serviceCallbackForUpdateSession_;
450     std::function<void(std::string, bool, bool)> serviceCallbackForMediaSession_;
451     std::function<void(std::string)> serviceCallbackForKeyEvent_;
452     std::function<void(std::string)> updateExtrasCallback_;
453     std::function<void(std::string, bool)> serviceCallbackForNtf_;
454     volatile bool isFirstAddToFront_ = true;
455     bool isMediaKeySupport = false;
456     bool isNotShowNotification_ = false;
457     bool isMediaChange_ = true;
458     bool isAssetChange_ = false;
459     bool isRecommend_ = false;
460     bool isPlayingState_ = false;
461 
462     int32_t disconnectStateFromCast_ = 5;
463     int32_t connectStateFromCast_ = 6;
464     int32_t authingStateFromCast_ = 10;
465     int32_t castDisconnectStateInAVSession_ = 6;
466     int32_t removeCmdStep_ = 1000;
467 
468     volatile bool isDestroyed_ = false;
469 
470     static const int32_t DEFAULT_USER_ID = 100;
471     static constexpr const int32_t audioBrokerUid = 5557;
472     static constexpr const char *defaultBundleName = "com.example.himusicdemo";
473     static constexpr const char *sessionCastState_ = "CAST_STATE";
474     static constexpr const int32_t cancelTimeout = 5000;
475 
476     // The following locks are used in the defined order of priority
477     std::recursive_mutex avsessionItemLock_;
478 
479     std::recursive_mutex controllersLock_;
480 
481     std::recursive_mutex callbackLock_;
482 
483     std::recursive_mutex destroyLock_;
484 
485     std::recursive_mutex remoteCallbackLock_;
486 
487     std::recursive_mutex remoteSourceLock_;
488 
489     std::recursive_mutex remoteSinkLock_;
490 
491     std::shared_ptr<bool> isAlivePtr_;
492 
493     std::recursive_mutex isAliveLock_;
494 
495     std::recursive_mutex callbackForCastCapLock_;
496 
497     std::recursive_mutex mediaSessionCallbackLock_;
498 
499     std::shared_mutex writeAndReadImgLock_;
500 
501 #ifdef CASTPLUS_CAST_ENGINE_ENABLE
502     std::recursive_mutex castLock_;
503     int64_t castHandle_ = 0;
504     std::string castHandleDeviceId_ = "-100";
505     const int32_t streamStateConnection = 6;
506     const std::string deviceStateConnection = "CONNECT_SUCC";
507     int32_t newCastState = -1;
508     std::pair<std::string, std::string> castServiceNameStatePair_;
509 
510     bool collaborationRejectFlag_ = false;
511     bool applyUserResultFlag_ = false;
512     bool applyResultFlag_ = false;
513     bool waitUserDecisionFlag_ = false;
514     bool mirrorToStreamFlag_ = false;
515     std::string collaborationNeedDeviceId_;
516     std::string collaborationNeedNetworkId_;
517     std::mutex collaborationApplyResultMutex_;
518     std::condition_variable connectWaitCallbackCond_;
519     const int32_t collaborationCallbackTimeOut_ = 10;
520     const int32_t collaborationUserCallbackTimeOut_ = 60;
521 
522     std::recursive_mutex castControllerProxyLock_;
523     std::shared_ptr<IAVCastControllerProxy> castControllerProxy_;
524     std::recursive_mutex castControllersLock_;
525     std::vector<std::shared_ptr<AVCastControllerItem>> castControllers_;
526     std::shared_ptr<CssListener> cssListener_;
527     sptr<HwCastDisplayListener> displayListener_;
528     std::recursive_mutex displayListenerLock_;
529     std::shared_ptr<IAVRouterListener> iAVRouterListener_;
530     std::recursive_mutex mirrorToStreamLock_;
531 
532     std::map<std::string, DeviceInfo> castDeviceInfoMap_;
533     uint32_t spid_ = 0;
534     std::mutex spidMutex_;
535     std::function<void(std::string)> serviceCallbackForStream_;
536     bool isSwitchNewDevice_ = false;
537     OutputDeviceInfo newOutputDeviceInfo_;
538     bool isFirstCallback_ = true;
539     const int32_t SWITCH_WAIT_TIME = 300;
540     std::function<void(std::string, bool, bool)> serviceCallbackForCastNtf_;
541 
542     const std::string MEDIA_CONTROL_BUNDLENAME = "com.ohos.mediacontroller";
543     const std::string SCENE_BOARD_BUNDLENAME = "com.ohos.sceneboard";
544 #endif
545 };
546 } // namespace OHOS::AVSession
547 #endif // OHOS_AVSESSION_ITEM_H
548