Harald Alvestrand | 1090e44 | 2020-10-05 07:01:09 +0000 | [diff] [blame] | 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 | |
Harald Alvestrand | 5761e7b | 2021-01-29 14:45:08 +0000 | [diff] [blame] | 14 | #include <functional> |
| 15 | |
| 16 | #include "api/jsep.h" |
Henrik Boström | 3e6931b | 2022-11-11 10:07:34 +0100 | [diff] [blame^] | 17 | #include "api/legacy_stats_types.h" |
Harald Alvestrand | 5761e7b | 2021-01-29 14:45:08 +0000 | [diff] [blame] | 18 | #include "api/media_stream_interface.h" |
| 19 | #include "api/peer_connection_interface.h" |
Harald Alvestrand | 1090e44 | 2020-10-05 07:01:09 +0000 | [diff] [blame] | 20 | #include "api/rtc_error.h" |
Danil Chapovalov | 5d37ba2 | 2022-08-17 14:58:40 +0200 | [diff] [blame] | 21 | #include "api/task_queue/pending_task_safety_flag.h" |
| 22 | #include "api/task_queue/task_queue_base.h" |
Henrik Boström | f785989 | 2022-07-04 14:36:37 +0200 | [diff] [blame] | 23 | #include "pc/legacy_stats_collector_interface.h" |
Harald Alvestrand | 1090e44 | 2020-10-05 07:01:09 +0000 | [diff] [blame] | 24 | |
| 25 | namespace webrtc { |
| 26 | |
Danil Chapovalov | 5d37ba2 | 2022-08-17 14:58:40 +0200 | [diff] [blame] | 27 | class PeerConnectionMessageHandler { |
Harald Alvestrand | 1090e44 | 2020-10-05 07:01:09 +0000 | [diff] [blame] | 28 | public: |
| 29 | explicit PeerConnectionMessageHandler(rtc::Thread* signaling_thread) |
| 30 | : signaling_thread_(signaling_thread) {} |
Danil Chapovalov | 5d37ba2 | 2022-08-17 14:58:40 +0200 | [diff] [blame] | 31 | ~PeerConnectionMessageHandler() = default; |
Harald Alvestrand | 1090e44 | 2020-10-05 07:01:09 +0000 | [diff] [blame] | 32 | |
Harald Alvestrand | 1090e44 | 2020-10-05 07:01:09 +0000 | [diff] [blame] | 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, |
Henrik Boström | f785989 | 2022-07-04 14:36:37 +0200 | [diff] [blame] | 41 | LegacyStatsCollectorInterface* legacy_stats, |
Harald Alvestrand | 1090e44 | 2020-10-05 07:01:09 +0000 | [diff] [blame] | 42 | MediaStreamTrackInterface* track); |
| 43 | void RequestUsagePatternReport(std::function<void()>, int delay_ms); |
| 44 | |
| 45 | private: |
Danil Chapovalov | 5d37ba2 | 2022-08-17 14:58:40 +0200 | [diff] [blame] | 46 | ScopedTaskSafety safety_; |
| 47 | TaskQueueBase* const signaling_thread_; |
Harald Alvestrand | 1090e44 | 2020-10-05 07:01:09 +0000 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | } // namespace webrtc |
| 51 | |
| 52 | #endif // PC_PEER_CONNECTION_MESSAGE_HANDLER_H_ |