blob: c19f5a4e50048a513774583ec2a2ef93bea0172c [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"
17#include "api/media_stream_interface.h"
18#include "api/peer_connection_interface.h"
Harald Alvestrand1090e442020-10-05 07:01:09 +000019#include "api/rtc_error.h"
20#include "api/stats_types.h"
Harald Alvestrand5761e7b2021-01-29 14:45:08 +000021#include "pc/stats_collector_interface.h"
Harald Alvestrand1090e442020-10-05 07:01:09 +000022#include "rtc_base/message_handler.h"
23#include "rtc_base/thread.h"
Harald Alvestrand5761e7b2021-01-29 14:45:08 +000024#include "rtc_base/thread_message.h"
Harald Alvestrand1090e442020-10-05 07:01:09 +000025
26namespace webrtc {
27
28class CreateSessionDescriptionObserver;
29class SetSessionDescriptionObserver;
30class StatsCollectorInterface;
31class StatsObserver;
32class MediaStreamTrackInterface;
33
34class PeerConnectionMessageHandler : public rtc::MessageHandler {
35 public:
36 explicit PeerConnectionMessageHandler(rtc::Thread* signaling_thread)
37 : signaling_thread_(signaling_thread) {}
38 ~PeerConnectionMessageHandler();
39
40 // Implements MessageHandler.
41 void OnMessage(rtc::Message* msg) override;
42 void PostSetSessionDescriptionSuccess(
43 SetSessionDescriptionObserver* observer);
44 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer,
45 RTCError&& error);
46 void PostCreateSessionDescriptionFailure(
47 CreateSessionDescriptionObserver* observer,
48 RTCError error);
49 void PostGetStats(StatsObserver* observer,
50 StatsCollectorInterface* stats,
51 MediaStreamTrackInterface* track);
52 void RequestUsagePatternReport(std::function<void()>, int delay_ms);
53
54 private:
55 rtc::Thread* signaling_thread() const { return signaling_thread_; }
56
57 rtc::Thread* const signaling_thread_;
58};
59
60} // namespace webrtc
61
62#endif // PC_PEER_CONNECTION_MESSAGE_HANDLER_H_