OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 313 |
314 // Must be called from inside the receive side critical section. | 314 // Must be called from inside the receive side critical section. |
315 int32_t VideoReceiver::Decode(const VCMEncodedFrame& frame) { | 315 int32_t VideoReceiver::Decode(const VCMEncodedFrame& frame) { |
316 TRACE_EVENT0("webrtc", "VideoReceiver::Decode"); | 316 TRACE_EVENT0("webrtc", "VideoReceiver::Decode"); |
317 // Change decoder if payload type has changed | 317 // Change decoder if payload type has changed |
318 VCMGenericDecoder* decoder = | 318 VCMGenericDecoder* decoder = |
319 _codecDataBase.GetDecoder(frame, &_decodedFrameCallback); | 319 _codecDataBase.GetDecoder(frame, &_decodedFrameCallback); |
320 if (decoder == nullptr) { | 320 if (decoder == nullptr) { |
321 return VCM_NO_CODEC_REGISTERED; | 321 return VCM_NO_CODEC_REGISTERED; |
322 } | 322 } |
323 // Decode a frame | 323 return decoder->Decode(frame, clock_->TimeInMilliseconds()); |
324 int32_t ret = decoder->Decode(frame, clock_->TimeInMilliseconds()); | |
325 | |
326 // Check for failed decoding, run frame type request callback if needed. | |
327 bool request_key_frame = false; | |
328 if (ret < 0) { | |
329 request_key_frame = true; | |
330 } | |
331 | |
332 if (!frame.Complete() || frame.MissingFrame()) { | |
333 request_key_frame = true; | |
334 ret = VCM_OK; | |
335 } | |
336 if (request_key_frame) { | |
337 rtc::CritScope cs(&process_crit_); | |
338 _scheduleKeyRequest = true; | |
339 } | |
340 return ret; | |
341 } | 324 } |
342 | 325 |
343 // Register possible receive codecs, can be called multiple times | 326 // Register possible receive codecs, can be called multiple times |
344 int32_t VideoReceiver::RegisterReceiveCodec(const VideoCodec* receiveCodec, | 327 int32_t VideoReceiver::RegisterReceiveCodec(const VideoCodec* receiveCodec, |
345 int32_t numberOfCores, | 328 int32_t numberOfCores, |
346 bool requireKeyFrame) { | 329 bool requireKeyFrame) { |
347 RTC_DCHECK(construction_thread_.CalledOnValidThread()); | 330 RTC_DCHECK(construction_thread_.CalledOnValidThread()); |
348 // TODO(tommi): This method must only be called when the decoder thread | 331 // TODO(tommi): This method must only be called when the decoder thread |
349 // is not running. Do we need a lock? If not, it looks like we might not need | 332 // is not running. Do we need a lock? If not, it looks like we might not need |
350 // a lock at all for |_codecDataBase|. | 333 // a lock at all for |_codecDataBase|. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, | 431 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, |
449 max_incomplete_time_ms); | 432 max_incomplete_time_ms); |
450 } | 433 } |
451 | 434 |
452 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { | 435 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { |
453 return _receiver.SetMinReceiverDelay(desired_delay_ms); | 436 return _receiver.SetMinReceiverDelay(desired_delay_ms); |
454 } | 437 } |
455 | 438 |
456 } // namespace vcm | 439 } // namespace vcm |
457 } // namespace webrtc | 440 } // namespace webrtc |
OLD | NEW |