1 /* 2 * Copyright 2020 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef PC_PEER_CONNECTION_MESSAGE_HANDLER_H_ 12 #define PC_PEER_CONNECTION_MESSAGE_HANDLER_H_ 13 14 #include <functional> 15 16 #include "api/jsep.h" 17 #include "api/legacy_stats_types.h" 18 #include "api/media_stream_interface.h" 19 #include "api/peer_connection_interface.h" 20 #include "api/rtc_error.h" 21 #include "api/task_queue/pending_task_safety_flag.h" 22 #include "api/task_queue/task_queue_base.h" 23 #include "pc/legacy_stats_collector_interface.h" 24 25 namespace webrtc { 26 27 class PeerConnectionMessageHandler { 28 public: PeerConnectionMessageHandler(rtc::Thread * signaling_thread)29 explicit PeerConnectionMessageHandler(rtc::Thread* signaling_thread) 30 : signaling_thread_(signaling_thread) {} 31 ~PeerConnectionMessageHandler() = default; 32 33 void PostSetSessionDescriptionSuccess( 34 SetSessionDescriptionObserver* observer); 35 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer, 36 RTCError&& error); 37 void PostCreateSessionDescriptionFailure( 38 CreateSessionDescriptionObserver* observer, 39 RTCError error); 40 void PostGetStats(StatsObserver* observer, 41 LegacyStatsCollectorInterface* legacy_stats, 42 MediaStreamTrackInterface* track); 43 void RequestUsagePatternReport(std::function<void()>, int delay_ms); 44 45 private: 46 ScopedTaskSafety safety_; 47 TaskQueueBase* const signaling_thread_; 48 }; 49 50 } // namespace webrtc 51 52 #endif // PC_PEER_CONNECTION_MESSAGE_HANDLER_H_ 53