OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // Returns a decoder specified by |payload_type|. The decoded frame callback | 101 // Returns a decoder specified by |payload_type|. The decoded frame callback |
102 // of the encoder is set to |decoded_frame_callback|. If no such decoder | 102 // of the encoder is set to |decoded_frame_callback|. If no such decoder |
103 // already exists an instance will be created and initialized. | 103 // already exists an instance will be created and initialized. |
104 // NULL is returned if no encoder with the specified payload type was found | 104 // NULL is returned if no encoder with the specified payload type was found |
105 // and the function failed to create one. | 105 // and the function failed to create one. |
106 VCMGenericDecoder* GetDecoder( | 106 VCMGenericDecoder* GetDecoder( |
107 const VCMEncodedFrame& frame, | 107 const VCMEncodedFrame& frame, |
108 VCMDecodedFrameCallback* decoded_frame_callback); | 108 VCMDecodedFrameCallback* decoded_frame_callback); |
109 | 109 |
110 // Deletes the memory of the decoder instance |decoder|. Used to delete | 110 // Returns the current decoder (i.e. the same value as was last returned from |
111 // deep copies returned by CreateDecoderCopy(). | 111 // GetDecoder(); |
112 void ReleaseDecoder(VCMGenericDecoder* decoder) const; | 112 VCMGenericDecoder* GetCurrentDecoder(); |
113 | 113 |
114 // Returns true if the currently active decoder prefer to decode frames late. | 114 // Returns true if the currently active decoder prefer to decode frames late. |
115 // That means that frames must be decoded near the render times stamp. | 115 // That means that frames must be decoded near the render times stamp. |
116 bool PrefersLateDecoding() const; | 116 bool PrefersLateDecoding() const; |
117 | 117 |
118 bool MatchesCurrentResolution(int width, int height) const; | 118 bool MatchesCurrentResolution(int width, int height) const; |
119 | 119 |
120 private: | 120 private: |
121 typedef std::map<uint8_t, VCMDecoderMapItem*> DecoderMap; | 121 typedef std::map<uint8_t, VCMDecoderMapItem*> DecoderMap; |
122 typedef std::map<uint8_t, VCMExtDecoderMapItem*> ExternalDecoderMap; | 122 typedef std::map<uint8_t, VCMExtDecoderMapItem*> ExternalDecoderMap; |
123 | 123 |
124 VCMGenericDecoder* CreateAndInitDecoder(const VCMEncodedFrame& frame, | 124 std::unique_ptr<VCMGenericDecoder> CreateAndInitDecoder( |
125 VideoCodec* new_codec) const; | 125 const VCMEncodedFrame& frame, |
| 126 VideoCodec* new_codec) const; |
126 | 127 |
127 // Determines whether a new codec has to be created or not. | 128 // Determines whether a new codec has to be created or not. |
128 // Checks every setting apart from maxFramerate and startBitrate. | 129 // Checks every setting apart from maxFramerate and startBitrate. |
129 bool RequiresEncoderReset(const VideoCodec& send_codec); | 130 bool RequiresEncoderReset(const VideoCodec& send_codec); |
130 | 131 |
131 void DeleteEncoder(); | 132 void DeleteEncoder(); |
132 | 133 |
133 // Create an internal Decoder given a codec type | |
134 VCMGenericDecoder* CreateDecoder(VideoCodecType type) const; | |
135 | |
136 const VCMDecoderMapItem* FindDecoderItem(uint8_t payload_type) const; | 134 const VCMDecoderMapItem* FindDecoderItem(uint8_t payload_type) const; |
137 | 135 |
138 const VCMExtDecoderMapItem* FindExternalDecoderItem( | 136 const VCMExtDecoderMapItem* FindExternalDecoderItem( |
139 uint8_t payload_type) const; | 137 uint8_t payload_type) const; |
140 | 138 |
141 int number_of_cores_; | 139 int number_of_cores_; |
142 size_t max_payload_size_; | 140 size_t max_payload_size_; |
143 bool periodic_key_frames_; | 141 bool periodic_key_frames_; |
144 bool pending_encoder_reset_; | 142 bool pending_encoder_reset_; |
145 VideoCodec send_codec_; | 143 VideoCodec send_codec_; |
146 VideoCodec receive_codec_; | 144 VideoCodec receive_codec_; |
147 uint8_t encoder_payload_type_; | 145 uint8_t encoder_payload_type_; |
148 VideoEncoder* external_encoder_; | 146 VideoEncoder* external_encoder_; |
149 bool internal_source_; | 147 bool internal_source_; |
150 VCMEncodedFrameCallback* const encoded_frame_callback_; | 148 VCMEncodedFrameCallback* const encoded_frame_callback_; |
151 std::unique_ptr<VCMGenericEncoder> ptr_encoder_; | 149 std::unique_ptr<VCMGenericEncoder> ptr_encoder_; |
152 VCMGenericDecoder* ptr_decoder_; | 150 std::unique_ptr<VCMGenericDecoder> ptr_decoder_; |
153 DecoderMap dec_map_; | 151 DecoderMap dec_map_; |
154 ExternalDecoderMap dec_external_map_; | 152 ExternalDecoderMap dec_external_map_; |
155 }; // VCMCodecDataBase | 153 }; // VCMCodecDataBase |
156 | 154 |
157 } // namespace webrtc | 155 } // namespace webrtc |
158 | 156 |
159 #endif // WEBRTC_MODULES_VIDEO_CODING_CODEC_DATABASE_H_ | 157 #endif // WEBRTC_MODULES_VIDEO_CODING_CODEC_DATABASE_H_ |
OLD | NEW |