blob: 027fbea6c3978edea7ac60e926eaee58188be71a [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
14#include "api/rtc_error.h"
15#include "api/stats_types.h"
16#include "rtc_base/message_handler.h"
17#include "rtc_base/thread.h"
18
19namespace webrtc {
20
21class CreateSessionDescriptionObserver;
22class SetSessionDescriptionObserver;
23class StatsCollectorInterface;
24class StatsObserver;
25class MediaStreamTrackInterface;
26
27class PeerConnectionMessageHandler : public rtc::MessageHandler {
28 public:
29 explicit PeerConnectionMessageHandler(rtc::Thread* signaling_thread)
30 : signaling_thread_(signaling_thread) {}
31 ~PeerConnectionMessageHandler();
32
33 // Implements MessageHandler.
34 void OnMessage(rtc::Message* msg) override;
35 void PostSetSessionDescriptionSuccess(
36 SetSessionDescriptionObserver* observer);
37 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer,
38 RTCError&& error);
39 void PostCreateSessionDescriptionFailure(
40 CreateSessionDescriptionObserver* observer,
41 RTCError error);
42 void PostGetStats(StatsObserver* observer,
43 StatsCollectorInterface* stats,
44 MediaStreamTrackInterface* track);
45 void RequestUsagePatternReport(std::function<void()>, int delay_ms);
46
47 private:
48 rtc::Thread* signaling_thread() const { return signaling_thread_; }
49
50 rtc::Thread* const signaling_thread_;
51};
52
53} // namespace webrtc
54
55#endif // PC_PEER_CONNECTION_MESSAGE_HANDLER_H_