blob: 9d695451a1691562eeccfd37466b80b824778bc0 [file] [log] [blame]
Danil Chapovalovc0fd5f92017-11-16 14:35:32 +01001/*
2 * Copyright (c) 2017 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 MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_H_
12#define MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_H_
13
14#include <memory>
15#include <string>
16#include <vector>
17
18#include "modules/rtp_rtcp/source/rtcp_transceiver_config.h"
19#include "modules/rtp_rtcp/source/rtcp_transceiver_impl.h"
20#include "rtc_base/constructormagic.h"
21#include "rtc_base/copyonwritebuffer.h"
22#include "rtc_base/task_queue.h"
23#include "rtc_base/weak_ptr.h"
24
25namespace webrtc {
26//
27// Manage incoming and outgoing rtcp messages for multiple BUNDLED streams.
28//
29// This class is thread-safe wrapper of RtcpTransceiverImpl
30class RtcpTransceiver {
31 public:
32 explicit RtcpTransceiver(const RtcpTransceiverConfig& config);
33 ~RtcpTransceiver();
34
35 // Handles incoming rtcp packets.
36 void ReceivePacket(rtc::CopyOnWriteBuffer packet);
37
38 // Sends RTCP packets starting with a sender or receiver report.
39 void SendCompoundPacket();
40
41 // (REMB) Receiver Estimated Max Bitrate.
42 // Includes REMB in following compound packets.
43 void SetRemb(int bitrate_bps, std::vector<uint32_t> ssrcs);
44 // Stops sending REMB in following compound packets.
45 void UnsetRemb();
46
Danil Chapovalov2ddf98d2017-11-22 14:00:41 +010047 // Request new key frame.
48 // using PLI, https://tools.ietf.org/html/rfc4585#section-6.3.1.1
49 void SendPictureLossIndication(std::vector<uint32_t> ssrcs);
50 // using FIR, https://tools.ietf.org/html/rfc5104#section-4.3.1.2
51 void SendFullIntraRequest(std::vector<uint32_t> ssrcs);
Danil Chapovalova7e418c2017-11-21 11:08:53 +010052
Danil Chapovalovc0fd5f92017-11-16 14:35:32 +010053 private:
54 rtc::TaskQueue* const task_queue_;
55 std::unique_ptr<RtcpTransceiverImpl> rtcp_transceiver_;
56 rtc::WeakPtrFactory<RtcpTransceiverImpl> ptr_factory_;
57 // TaskQueue, and thus tasks posted to it, may outlive this.
58 // Thus when Posting task class always pass copy of the weak_ptr to access
59 // the RtcpTransceiver and never guarantee it still will be alive when task
60 // runs.
61 rtc::WeakPtr<RtcpTransceiverImpl> ptr_;
62
63 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtcpTransceiver);
64};
65
66} // namespace webrtc
67
68#endif // MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_H_