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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 assert(number_of_cores >= 0); | 83 assert(number_of_cores >= 0); |
84 } | 84 } |
85 | 85 |
86 VCMExtDecoderMapItem::VCMExtDecoderMapItem( | 86 VCMExtDecoderMapItem::VCMExtDecoderMapItem( |
87 VideoDecoder* external_decoder_instance, | 87 VideoDecoder* external_decoder_instance, |
88 uint8_t payload_type) | 88 uint8_t payload_type) |
89 : payload_type(payload_type), | 89 : payload_type(payload_type), |
90 external_decoder_instance(external_decoder_instance) {} | 90 external_decoder_instance(external_decoder_instance) {} |
91 | 91 |
92 VCMCodecDataBase::VCMCodecDataBase( | 92 VCMCodecDataBase::VCMCodecDataBase( |
93 VideoEncoderRateObserver* encoder_rate_observer, | |
94 VCMEncodedFrameCallback* encoded_frame_callback) | 93 VCMEncodedFrameCallback* encoded_frame_callback) |
95 : number_of_cores_(0), | 94 : number_of_cores_(0), |
96 max_payload_size_(kDefaultPayloadSize), | 95 max_payload_size_(kDefaultPayloadSize), |
97 periodic_key_frames_(false), | 96 periodic_key_frames_(false), |
98 pending_encoder_reset_(true), | 97 pending_encoder_reset_(true), |
99 send_codec_(), | 98 send_codec_(), |
100 receive_codec_(), | 99 receive_codec_(), |
101 encoder_payload_type_(0), | 100 encoder_payload_type_(0), |
102 external_encoder_(nullptr), | 101 external_encoder_(nullptr), |
103 internal_source_(false), | 102 internal_source_(false), |
104 encoder_rate_observer_(encoder_rate_observer), | |
105 encoded_frame_callback_(encoded_frame_callback), | 103 encoded_frame_callback_(encoded_frame_callback), |
106 ptr_decoder_(nullptr), | 104 ptr_decoder_(nullptr), |
107 dec_map_(), | 105 dec_map_(), |
108 dec_external_map_() {} | 106 dec_external_map_() {} |
109 | 107 |
110 VCMCodecDataBase::~VCMCodecDataBase() { | 108 VCMCodecDataBase::~VCMCodecDataBase() { |
111 DeleteEncoder(); | 109 DeleteEncoder(); |
112 ReleaseDecoder(ptr_decoder_); | 110 ReleaseDecoder(ptr_decoder_); |
113 for (auto& kv : dec_map_) | 111 for (auto& kv : dec_map_) |
114 delete kv.second; | 112 delete kv.second; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 memcpy(&send_codec_, &new_send_codec, sizeof(send_codec_)); | 236 memcpy(&send_codec_, &new_send_codec, sizeof(send_codec_)); |
239 | 237 |
240 if (!reset_required) { | 238 if (!reset_required) { |
241 return true; | 239 return true; |
242 } | 240 } |
243 | 241 |
244 // If encoder exists, will destroy it and create new one. | 242 // If encoder exists, will destroy it and create new one. |
245 DeleteEncoder(); | 243 DeleteEncoder(); |
246 RTC_DCHECK_EQ(encoder_payload_type_, send_codec_.plType) | 244 RTC_DCHECK_EQ(encoder_payload_type_, send_codec_.plType) |
247 << "Encoder not registered for payload type " << send_codec_.plType; | 245 << "Encoder not registered for payload type " << send_codec_.plType; |
248 ptr_encoder_.reset( | 246 ptr_encoder_.reset(new VCMGenericEncoder( |
249 new VCMGenericEncoder(external_encoder_, encoder_rate_observer_, | 247 external_encoder_, encoded_frame_callback_, internal_source_)); |
250 encoded_frame_callback_, internal_source_)); | |
251 encoded_frame_callback_->SetInternalSource(internal_source_); | 248 encoded_frame_callback_->SetInternalSource(internal_source_); |
252 if (ptr_encoder_->InitEncode(&send_codec_, number_of_cores_, | 249 if (ptr_encoder_->InitEncode(&send_codec_, number_of_cores_, |
253 max_payload_size_) < 0) { | 250 max_payload_size_) < 0) { |
254 LOG(LS_ERROR) << "Failed to initialize video encoder."; | 251 LOG(LS_ERROR) << "Failed to initialize video encoder."; |
255 DeleteEncoder(); | 252 DeleteEncoder(); |
256 return false; | 253 return false; |
257 } | 254 } |
258 | 255 |
259 // Intentionally don't check return value since the encoder registration | 256 // Intentionally don't check return value since the encoder registration |
260 // shouldn't fail because the codec doesn't support changing the periodic key | 257 // shouldn't fail because the codec doesn't support changing the periodic key |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 | 603 |
607 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( | 604 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( |
608 uint8_t payload_type) const { | 605 uint8_t payload_type) const { |
609 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); | 606 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); |
610 if (it != dec_external_map_.end()) { | 607 if (it != dec_external_map_.end()) { |
611 return (*it).second; | 608 return (*it).second; |
612 } | 609 } |
613 return nullptr; | 610 return nullptr; |
614 } | 611 } |
615 } // namespace webrtc | 612 } // namespace webrtc |
OLD | NEW |