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 return decoder->Decode(frame, clock_->TimeInMilliseconds()); | 323 // Decode a frame |
| 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; |
324 } | 341 } |
325 | 342 |
326 // Register possible receive codecs, can be called multiple times | 343 // Register possible receive codecs, can be called multiple times |
327 int32_t VideoReceiver::RegisterReceiveCodec(const VideoCodec* receiveCodec, | 344 int32_t VideoReceiver::RegisterReceiveCodec(const VideoCodec* receiveCodec, |
328 int32_t numberOfCores, | 345 int32_t numberOfCores, |
329 bool requireKeyFrame) { | 346 bool requireKeyFrame) { |
330 RTC_DCHECK(construction_thread_.CalledOnValidThread()); | 347 RTC_DCHECK(construction_thread_.CalledOnValidThread()); |
331 // TODO(tommi): This method must only be called when the decoder thread | 348 // TODO(tommi): This method must only be called when the decoder thread |
332 // is not running. Do we need a lock? If not, it looks like we might not need | 349 // is not running. Do we need a lock? If not, it looks like we might not need |
333 // a lock at all for |_codecDataBase|. | 350 // a lock at all for |_codecDataBase|. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, | 448 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, |
432 max_incomplete_time_ms); | 449 max_incomplete_time_ms); |
433 } | 450 } |
434 | 451 |
435 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { | 452 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { |
436 return _receiver.SetMinReceiverDelay(desired_delay_ms); | 453 return _receiver.SetMinReceiverDelay(desired_delay_ms); |
437 } | 454 } |
438 | 455 |
439 } // namespace vcm | 456 } // namespace vcm |
440 } // namespace webrtc | 457 } // namespace webrtc |
OLD | NEW |