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 // Returns the current decoder (i.e. the same value as was last returned from | 110 // Deletes the memory of the decoder instance |decoder|. Used to delete |
111 // GetDecoder(); | 111 // deep copies returned by CreateDecoderCopy(). |
112 VCMGenericDecoder* GetCurrentDecoder(); | 112 void ReleaseDecoder(VCMGenericDecoder* decoder) const; |
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 std::unique_ptr<VCMGenericDecoder> CreateAndInitDecoder( | 124 VCMGenericDecoder* CreateAndInitDecoder(const VCMEncodedFrame& frame, |
125 const VCMEncodedFrame& frame, | 125 VideoCodec* new_codec) const; |
126 VideoCodec* new_codec) const; | |
127 | 126 |
128 // Determines whether a new codec has to be created or not. | 127 // Determines whether a new codec has to be created or not. |
129 // Checks every setting apart from maxFramerate and startBitrate. | 128 // Checks every setting apart from maxFramerate and startBitrate. |
130 bool RequiresEncoderReset(const VideoCodec& send_codec); | 129 bool RequiresEncoderReset(const VideoCodec& send_codec); |
131 | 130 |
132 void DeleteEncoder(); | 131 void DeleteEncoder(); |
133 | 132 |
| 133 // Create an internal Decoder given a codec type |
| 134 VCMGenericDecoder* CreateDecoder(VideoCodecType type) const; |
| 135 |
134 const VCMDecoderMapItem* FindDecoderItem(uint8_t payload_type) const; | 136 const VCMDecoderMapItem* FindDecoderItem(uint8_t payload_type) const; |
135 | 137 |
136 const VCMExtDecoderMapItem* FindExternalDecoderItem( | 138 const VCMExtDecoderMapItem* FindExternalDecoderItem( |
137 uint8_t payload_type) const; | 139 uint8_t payload_type) const; |
138 | 140 |
139 int number_of_cores_; | 141 int number_of_cores_; |
140 size_t max_payload_size_; | 142 size_t max_payload_size_; |
141 bool periodic_key_frames_; | 143 bool periodic_key_frames_; |
142 bool pending_encoder_reset_; | 144 bool pending_encoder_reset_; |
143 VideoCodec send_codec_; | 145 VideoCodec send_codec_; |
144 VideoCodec receive_codec_; | 146 VideoCodec receive_codec_; |
145 uint8_t encoder_payload_type_; | 147 uint8_t encoder_payload_type_; |
146 VideoEncoder* external_encoder_; | 148 VideoEncoder* external_encoder_; |
147 bool internal_source_; | 149 bool internal_source_; |
148 VCMEncodedFrameCallback* const encoded_frame_callback_; | 150 VCMEncodedFrameCallback* const encoded_frame_callback_; |
149 std::unique_ptr<VCMGenericEncoder> ptr_encoder_; | 151 std::unique_ptr<VCMGenericEncoder> ptr_encoder_; |
150 std::unique_ptr<VCMGenericDecoder> ptr_decoder_; | 152 VCMGenericDecoder* ptr_decoder_; |
151 DecoderMap dec_map_; | 153 DecoderMap dec_map_; |
152 ExternalDecoderMap dec_external_map_; | 154 ExternalDecoderMap dec_external_map_; |
153 }; // VCMCodecDataBase | 155 }; // VCMCodecDataBase |
154 | 156 |
155 } // namespace webrtc | 157 } // namespace webrtc |
156 | 158 |
157 #endif // WEBRTC_MODULES_VIDEO_CODING_CODEC_DATABASE_H_ | 159 #endif // WEBRTC_MODULES_VIDEO_CODING_CODEC_DATABASE_H_ |
OLD | NEW |