• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2019 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 TEST_PC_E2E_ANALYZER_VIDEO_ENCODED_IMAGE_DATA_INJECTOR_H_
12 #define TEST_PC_E2E_ANALYZER_VIDEO_ENCODED_IMAGE_DATA_INJECTOR_H_
13 
14 #include <cstdint>
15 #include <utility>
16 
17 #include "api/video/encoded_image.h"
18 
19 namespace webrtc {
20 namespace webrtc_pc_e2e {
21 
22 // Injects frame id into EncodedImage on encoder side
23 class EncodedImageDataInjector {
24  public:
25   virtual ~EncodedImageDataInjector() = default;
26 
27   // Return encoded image with specified |id| and |discard| flag injected into
28   // its payload. |discard| flag mean does analyzing decoder should discard this
29   // encoded image because it belongs to unnecessary simulcast stream or spatial
30   // layer. |coding_entity_id| is unique id of decoder or encoder.
31   virtual EncodedImage InjectData(uint16_t id,
32                                   bool discard,
33                                   const EncodedImage& source,
34                                   int coding_entity_id) = 0;
35 };
36 
37 struct EncodedImageExtractionResult {
38   uint16_t id;
39   EncodedImage image;
40   // Is true if encoded image should be discarded. It is used to filter out
41   // unnecessary spatial layers and simulcast streams.
42   bool discard;
43 };
44 
45 // Extracts frame id from EncodedImage on decoder side.
46 class EncodedImageDataExtractor {
47  public:
48   virtual ~EncodedImageDataExtractor() = default;
49 
50   // Returns encoded image id, extracted from payload and also encoded image
51   // with its original payload. For concatenated spatial layers it should be the
52   // same id. |coding_entity_id| is unique id of decoder or encoder.
53   virtual EncodedImageExtractionResult ExtractData(const EncodedImage& source,
54                                                    int coding_entity_id) = 0;
55 };
56 
57 }  // namespace webrtc_pc_e2e
58 }  // namespace webrtc
59 
60 #endif  // TEST_PC_E2E_ANALYZER_VIDEO_ENCODED_IMAGE_DATA_INJECTOR_H_
61