ivica | 7f6a6fc | 2015-09-08 02:40:29 -0700 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 10 | #ifndef TEST_LAYER_FILTERING_TRANSPORT_H_ |
| 11 | #define TEST_LAYER_FILTERING_TRANSPORT_H_ |
ivica | 7f6a6fc | 2015-09-08 02:40:29 -0700 | [diff] [blame] | 12 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 13 | #include <stddef.h> |
| 14 | #include <stdint.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 15 | |
Ilya Nikolaevskiy | 16cba5c | 2018-03-14 10:51:50 +0000 | [diff] [blame] | 16 | #include <map> |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 17 | #include <memory> |
Ilya Nikolaevskiy | 16cba5c | 2018-03-14 10:51:50 +0000 | [diff] [blame] | 18 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 19 | #include "api/call/transport.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 20 | #include "api/media_types.h" |
Erik Språng | 0970851 | 2018-03-14 15:16:50 +0100 | [diff] [blame] | 21 | #include "call/call.h" |
Artem Titov | 46c4e60 | 2018-08-17 14:26:54 +0200 | [diff] [blame] | 22 | #include "call/simulated_packet_receiver.h" |
Erik Språng | 0970851 | 2018-03-14 15:16:50 +0100 | [diff] [blame] | 23 | #include "test/direct_transport.h" |
Erik Språng | 0970851 | 2018-03-14 15:16:50 +0100 | [diff] [blame] | 24 | |
ivica | 7f6a6fc | 2015-09-08 02:40:29 -0700 | [diff] [blame] | 25 | namespace webrtc { |
| 26 | |
| 27 | namespace test { |
| 28 | |
| 29 | class LayerFilteringTransport : public test::DirectTransport { |
| 30 | public: |
Artem Titov | 46c4e60 | 2018-08-17 14:26:54 +0200 | [diff] [blame] | 31 | LayerFilteringTransport( |
Danil Chapovalov | 85a1000 | 2019-10-21 15:00:53 +0200 | [diff] [blame] | 32 | TaskQueueBase* task_queue, |
Artem Titov | 46c4e60 | 2018-08-17 14:26:54 +0200 | [diff] [blame] | 33 | 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 Chapovalov | 85a1000 | 2019-10-21 15:00:53 +0200 | [diff] [blame] | 43 | TaskQueueBase* task_queue, |
Artem Titov | 46c4e60 | 2018-08-17 14:26:54 +0200 | [diff] [blame] | 44 | 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); |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 51 | bool DiscardedLastPacket() const; |
stefan | 1d8a506 | 2015-10-02 03:39:33 -0700 | [diff] [blame] | 52 | bool SendRtp(const uint8_t* data, |
| 53 | size_t length, |
| 54 | const PacketOptions& options) override; |
ivica | 7f6a6fc | 2015-09-08 02:40:29 -0700 | [diff] [blame] | 55 | |
| 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_; |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 60 | // 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_; |
“Michael | 23c5a99 | 2018-06-21 11:07:21 -0500 | [diff] [blame] | 65 | int num_active_spatial_layers_; |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 18:02:59 +0100 | [diff] [blame] | 66 | const uint32_t ssrc_to_filter_min_; |
| 67 | const uint32_t ssrc_to_filter_max_; |
ivica | 7f6a6fc | 2015-09-08 02:40:29 -0700 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | } // namespace test |
| 71 | } // namespace webrtc |
| 72 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 73 | #endif // TEST_LAYER_FILTERING_TRANSPORT_H_ |