Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/temporal_layers.h

Issue 2769263002: Base screenshare layers on TemporalReferences. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 1 /* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
2 * 2 *
3 * Use of this source code is governed by a BSD-style license 3 * Use of this source code is governed by a BSD-style license
4 * that can be found in the LICENSE file in the root of the source 4 * that can be found in the LICENSE file in the root of the source
5 * tree. An additional intellectual property rights grant can be found 5 * tree. An additional intellectual property rights grant can be found
6 * in the file PATENTS. All contributing project authors may 6 * in the file PATENTS. All contributing project authors may
7 * be found in the AUTHORS file in the root of the source tree. 7 * be found in the AUTHORS file in the root of the source tree.
8 */ 8 */
9 /* 9 /*
10 * This file defines the interface for doing temporal layers with VP8. 10 * This file defines the interface for doing temporal layers with VP8.
11 */ 11 */
12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_TEMPORAL_LAYERS_H_ 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_TEMPORAL_LAYERS_H_
13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_TEMPORAL_LAYERS_H_ 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_TEMPORAL_LAYERS_H_
14 14
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/common_video/include/video_image.h" 17 #include "webrtc/common_video/include/video_image.h"
18 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
19 19
20 struct vpx_codec_enc_cfg; 20 struct vpx_codec_enc_cfg;
21 typedef struct vpx_codec_enc_cfg vpx_codec_enc_cfg_t; 21 typedef struct vpx_codec_enc_cfg vpx_codec_enc_cfg_t;
22 22
23 namespace webrtc { 23 namespace webrtc {
24 24
25 struct CodecSpecificInfoVP8; 25 struct CodecSpecificInfoVP8;
26 26
27 enum TemporalBufferUsage {
28 kNone = 0,
29 kReference = 1,
30 kUpdate = 2,
31 kReferenceAndUpdate = kReference | kUpdate,
32 };
33
34 enum TemporalFlags { kLayerSync = 1, kFreezeEntropy = 2 };
35
36 struct TemporalReferences {
37 TemporalReferences(TemporalBufferUsage last,
38 TemporalBufferUsage golden,
39 TemporalBufferUsage arf);
40 TemporalReferences(TemporalBufferUsage last,
41 TemporalBufferUsage golden,
42 TemporalBufferUsage arf,
43 int extra_flags);
44
45 const bool drop_frame;
46 const bool reference_last;
47 const bool update_last;
48 const bool reference_golden;
49 const bool update_golden;
50 const bool reference_arf;
51 const bool update_arf;
sprang_webrtc 2017/03/26 12:20:08 Would it make sense to only store TemporalBufferUs
pbos-webrtc 2017/03/27 16:31:07 Yes, since they can be checked as a bitmask we hav
52
53 // TODO(pbos): Consider breaking these out of here and returning only a
54 // pattern index that needs to be returned to fill CodecSpecificInfoVP8 or
55 // EncodeFlags.
56 const bool layer_sync;
57 const bool freeze_entropy;
58
59 private:
60 TemporalReferences(TemporalBufferUsage last,
61 TemporalBufferUsage golden,
62 TemporalBufferUsage arf,
63 bool layer_sync,
64 bool freeze_entropy);
65 };
66
27 class TemporalLayers { 67 class TemporalLayers {
28 public: 68 public:
29 // Factory for TemporalLayer strategy. Default behavior is a fixed pattern 69 // Factory for TemporalLayer strategy. Default behavior is a fixed pattern
30 // of temporal layers. See default_temporal_layers.cc 70 // of temporal layers. See default_temporal_layers.cc
31 virtual ~TemporalLayers() {} 71 virtual ~TemporalLayers() {}
32 72
33 // Returns the recommended VP8 encode flags needed. May refresh the decoder 73 // Returns the recommended VP8 encode flags needed. May refresh the decoder
34 // and/or update the reference buffers. 74 // and/or update the reference buffers.
35 virtual int EncodeFlags(uint32_t timestamp) = 0; 75 virtual TemporalReferences GetLayerConfig(uint32_t timestamp) = 0;
76
77 int EncodeFlags(uint32_t timestamp);
36 78
37 // Update state based on new bitrate target and incoming framerate. 79 // Update state based on new bitrate target and incoming framerate.
38 // Returns the bitrate allocation for the active temporal layers. 80 // Returns the bitrate allocation for the active temporal layers.
39 virtual std::vector<uint32_t> OnRatesUpdated(int bitrate_kbps, 81 virtual std::vector<uint32_t> OnRatesUpdated(int bitrate_kbps,
40 int max_bitrate_kbps, 82 int max_bitrate_kbps,
41 int framerate) = 0; 83 int framerate) = 0;
42 84
43 // Update the encoder configuration with target bitrates or other parameters. 85 // Update the encoder configuration with target bitrates or other parameters.
44 // Returns true iff the configuration was actually modified. 86 // Returns true iff the configuration was actually modified.
45 virtual bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) = 0; 87 virtual bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) = 0;
46 88
47 virtual void PopulateCodecSpecific(bool base_layer_sync, 89 virtual void PopulateCodecSpecific(bool is_keyframe,
48 CodecSpecificInfoVP8* vp8_info, 90 CodecSpecificInfoVP8* vp8_info,
49 uint32_t timestamp) = 0; 91 uint32_t timestamp) = 0;
50 92
51 virtual void FrameEncoded(unsigned int size, uint32_t timestamp, int qp) = 0; 93 virtual void FrameEncoded(unsigned int size, int qp) = 0;
52 94
53 virtual int CurrentLayerId() const = 0; 95 virtual int CurrentLayerId() const = 0;
54 }; 96 };
55 97
56 class TemporalLayersListener; 98 class TemporalLayersListener;
57 class TemporalLayersFactory { 99 class TemporalLayersFactory {
58 public: 100 public:
59 TemporalLayersFactory() : listener_(nullptr) {} 101 TemporalLayersFactory() : listener_(nullptr) {}
60 virtual ~TemporalLayersFactory() {} 102 virtual ~TemporalLayersFactory() {}
61 virtual TemporalLayers* Create(int simulcast_id, 103 virtual TemporalLayers* Create(int simulcast_id,
(...skipping 19 matching lines...) Expand all
81 public: 123 public:
82 TemporalLayersListener() {} 124 TemporalLayersListener() {}
83 virtual ~TemporalLayersListener() {} 125 virtual ~TemporalLayersListener() {}
84 126
85 virtual void OnTemporalLayersCreated(int simulcast_id, 127 virtual void OnTemporalLayersCreated(int simulcast_id,
86 TemporalLayers* layers) = 0; 128 TemporalLayers* layers) = 0;
87 }; 129 };
88 130
89 } // namespace webrtc 131 } // namespace webrtc
90 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_TEMPORAL_LAYERS_H_ 132 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_TEMPORAL_LAYERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698