blob: 4606da5f7f7f3bcf18283cf6ed9ae45dbb2566b8 [file] [log] [blame]
ivica7f6a6fc2015-09-08 02:40:29 -07001/*
2 * Copyright (c) 2015 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 */
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020010#ifndef TEST_LAYER_FILTERING_TRANSPORT_H_
11#define TEST_LAYER_FILTERING_TRANSPORT_H_
ivica7f6a6fc2015-09-08 02:40:29 -070012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <stddef.h>
14#include <stdint.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020015
Ilya Nikolaevskiy16cba5c2018-03-14 10:51:50 +000016#include <map>
Yves Gerey3e707812018-11-28 16:47:49 +010017#include <memory>
Ilya Nikolaevskiy16cba5c2018-03-14 10:51:50 +000018
Yves Gerey3e707812018-11-28 16:47:49 +010019#include "api/call/transport.h"
Steve Anton10542f22019-01-11 09:11:00 -080020#include "api/media_types.h"
Erik Språng09708512018-03-14 15:16:50 +010021#include "call/call.h"
Artem Titov46c4e602018-08-17 14:26:54 +020022#include "call/simulated_packet_receiver.h"
Danil Chapovalova3ecb7a2019-12-09 10:24:47 +010023#include "modules/rtp_rtcp/source/video_rtp_depacketizer.h"
Erik Språng09708512018-03-14 15:16:50 +010024#include "test/direct_transport.h"
Erik Språng09708512018-03-14 15:16:50 +010025
ivica7f6a6fc2015-09-08 02:40:29 -070026namespace webrtc {
27
28namespace test {
29
30class LayerFilteringTransport : public test::DirectTransport {
31 public:
Artem Titov46c4e602018-08-17 14:26:54 +020032 LayerFilteringTransport(
Danil Chapovalov85a10002019-10-21 15:00:53 +020033 TaskQueueBase* task_queue,
Artem Titov46c4e602018-08-17 14:26:54 +020034 std::unique_ptr<SimulatedPacketReceiverInterface> pipe,
35 Call* send_call,
36 uint8_t vp8_video_payload_type,
37 uint8_t vp9_video_payload_type,
38 int selected_tl,
39 int selected_sl,
40 const std::map<uint8_t, MediaType>& payload_type_map,
41 uint32_t ssrc_to_filter_min,
42 uint32_t ssrc_to_filter_max);
43 LayerFilteringTransport(
Danil Chapovalov85a10002019-10-21 15:00:53 +020044 TaskQueueBase* task_queue,
Artem Titov46c4e602018-08-17 14:26:54 +020045 std::unique_ptr<SimulatedPacketReceiverInterface> pipe,
46 Call* send_call,
47 uint8_t vp8_video_payload_type,
48 uint8_t vp9_video_payload_type,
49 int selected_tl,
50 int selected_sl,
51 const std::map<uint8_t, MediaType>& payload_type_map);
sprangce4aef12015-11-02 07:23:20 -080052 bool DiscardedLastPacket() const;
stefan1d8a5062015-10-02 03:39:33 -070053 bool SendRtp(const uint8_t* data,
54 size_t length,
55 const PacketOptions& options) override;
ivica7f6a6fc2015-09-08 02:40:29 -070056
57 private:
58 // Used to distinguish between VP8 and VP9.
59 const uint8_t vp8_video_payload_type_;
60 const uint8_t vp9_video_payload_type_;
Danil Chapovalova3ecb7a2019-12-09 10:24:47 +010061 const std::unique_ptr<VideoRtpDepacketizer> vp8_depacketizer_;
62 const std::unique_ptr<VideoRtpDepacketizer> vp9_depacketizer_;
sprangce4aef12015-11-02 07:23:20 -080063 // Discard or invalidate all temporal/spatial layers with id greater than the
64 // selected one. -1 to disable filtering.
65 const int selected_tl_;
66 const int selected_sl_;
67 bool discarded_last_packet_;
“Michael23c5a992018-06-21 11:07:21 -050068 int num_active_spatial_layers_;
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +010069 const uint32_t ssrc_to_filter_min_;
70 const uint32_t ssrc_to_filter_max_;
ivica7f6a6fc2015-09-08 02:40:29 -070071};
72
73} // namespace test
74} // namespace webrtc
75
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020076#endif // TEST_LAYER_FILTERING_TRANSPORT_H_