blob: 8bd0e5ebb1495d8904d53c8486ec68e4fae3d897 [file] [log] [blame]
Harald Alvestrand1090e442020-10-05 07:01:09 +00001/*
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 Alvestrand5761e7b2021-01-29 14:45:08 +000014#include <functional>
15
16#include "api/jsep.h"
Henrik Boström3e6931b2022-11-11 10:07:34 +010017#include "api/legacy_stats_types.h"
Harald Alvestrand5761e7b2021-01-29 14:45:08 +000018#include "api/media_stream_interface.h"
19#include "api/peer_connection_interface.h"
Harald Alvestrand1090e442020-10-05 07:01:09 +000020#include "api/rtc_error.h"
Danil Chapovalov5d37ba22022-08-17 14:58:40 +020021#include "api/task_queue/pending_task_safety_flag.h"
22#include "api/task_queue/task_queue_base.h"
Henrik Boströmf7859892022-07-04 14:36:37 +020023#include "pc/legacy_stats_collector_interface.h"
Harald Alvestrand1090e442020-10-05 07:01:09 +000024
25namespace webrtc {
26
Danil Chapovalov5d37ba22022-08-17 14:58:40 +020027class PeerConnectionMessageHandler {
Harald Alvestrand1090e442020-10-05 07:01:09 +000028 public:
29 explicit PeerConnectionMessageHandler(rtc::Thread* signaling_thread)
30 : signaling_thread_(signaling_thread) {}
Danil Chapovalov5d37ba22022-08-17 14:58:40 +020031 ~PeerConnectionMessageHandler() = default;
Harald Alvestrand1090e442020-10-05 07:01:09 +000032
Harald Alvestrand1090e442020-10-05 07:01:09 +000033 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ömf7859892022-07-04 14:36:37 +020041 LegacyStatsCollectorInterface* legacy_stats,
Harald Alvestrand1090e442020-10-05 07:01:09 +000042 MediaStreamTrackInterface* track);
43 void RequestUsagePatternReport(std::function<void()>, int delay_ms);
44
45 private:
Danil Chapovalov5d37ba22022-08-17 14:58:40 +020046 ScopedTaskSafety safety_;
47 TaskQueueBase* const signaling_thread_;
Harald Alvestrand1090e442020-10-05 07:01:09 +000048};
49
50} // namespace webrtc
51
52#endif // PC_PEER_CONNECTION_MESSAGE_HANDLER_H_