blob: 5703da8ea1d260d71d95bb7cde17c5a406ffd0a2 [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"
Erik Språng09708512018-03-14 15:16:50 +010023#include "test/direct_transport.h"
Erik Språng09708512018-03-14 15:16:50 +010024
ivica7f6a6fc2015-09-08 02:40:29 -070025namespace webrtc {
26
27namespace test {
28
29class LayerFilteringTransport : public test::DirectTransport {
30 public:
Artem Titov46c4e602018-08-17 14:26:54 +020031 LayerFilteringTransport(
Danil Chapovalov85a10002019-10-21 15:00:53 +020032 TaskQueueBase* task_queue,
Artem Titov46c4e602018-08-17 14:26:54 +020033 std::unique_ptr<SimulatedPacketReceiverInterface> pipe,
34 Call* send_call,
35 uint8_t vp8_video_payload_type,
36 uint8_t vp9_video_payload_type,
37 int selected_tl,
38 int selected_sl,
39 const std::map<uint8_t, MediaType>& payload_type_map,
40 uint32_t ssrc_to_filter_min,
41 uint32_t ssrc_to_filter_max);
42 LayerFilteringTransport(
Danil Chapovalov85a10002019-10-21 15:00:53 +020043 TaskQueueBase* task_queue,
Artem Titov46c4e602018-08-17 14:26:54 +020044 std::unique_ptr<SimulatedPacketReceiverInterface> pipe,
45 Call* send_call,
46 uint8_t vp8_video_payload_type,
47 uint8_t vp9_video_payload_type,
48 int selected_tl,
49 int selected_sl,
50 const std::map<uint8_t, MediaType>& payload_type_map);
sprangce4aef12015-11-02 07:23:20 -080051 bool DiscardedLastPacket() const;
stefan1d8a5062015-10-02 03:39:33 -070052 bool SendRtp(const uint8_t* data,
53 size_t length,
54 const PacketOptions& options) override;
ivica7f6a6fc2015-09-08 02:40:29 -070055
56 private:
57 // Used to distinguish between VP8 and VP9.
58 const uint8_t vp8_video_payload_type_;
59 const uint8_t vp9_video_payload_type_;
sprangce4aef12015-11-02 07:23:20 -080060 // Discard or invalidate all temporal/spatial layers with id greater than the
61 // selected one. -1 to disable filtering.
62 const int selected_tl_;
63 const int selected_sl_;
64 bool discarded_last_packet_;
“Michael23c5a992018-06-21 11:07:21 -050065 int num_active_spatial_layers_;
Ilya Nikolaevskiy255d1cd2017-12-21 18:02:59 +010066 const uint32_t ssrc_to_filter_min_;
67 const uint32_t ssrc_to_filter_max_;
ivica7f6a6fc2015-09-08 02:40:29 -070068};
69
70} // namespace test
71} // namespace webrtc
72
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020073#endif // TEST_LAYER_FILTERING_TRANSPORT_H_