| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 318 } |
| 319 _scheduleKeyRequest = false; | 319 _scheduleKeyRequest = false; |
| 320 } else { | 320 } else { |
| 321 return VCM_MISSING_CALLBACK; | 321 return VCM_MISSING_CALLBACK; |
| 322 } | 322 } |
| 323 return VCM_OK; | 323 return VCM_OK; |
| 324 } | 324 } |
| 325 | 325 |
| 326 // Must be called from inside the receive side critical section. | 326 // Must be called from inside the receive side critical section. |
| 327 int32_t VideoReceiver::Decode(const VCMEncodedFrame& frame) { | 327 int32_t VideoReceiver::Decode(const VCMEncodedFrame& frame) { |
| 328 TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame.TimeStamp(), "Decode", | 328 TRACE_EVENT0("webrtc", "VideoReceiver::Decode"); |
| 329 "type", frame.FrameType()); | |
| 330 // Change decoder if payload type has changed | 329 // Change decoder if payload type has changed |
| 331 _decoder = _codecDataBase.GetDecoder(frame, &_decodedFrameCallback); | 330 _decoder = _codecDataBase.GetDecoder(frame, &_decodedFrameCallback); |
| 332 if (_decoder == nullptr) { | 331 if (_decoder == nullptr) { |
| 333 return VCM_NO_CODEC_REGISTERED; | 332 return VCM_NO_CODEC_REGISTERED; |
| 334 } | 333 } |
| 335 // Decode a frame | 334 // Decode a frame |
| 336 int32_t ret = _decoder->Decode(frame, clock_->TimeInMilliseconds()); | 335 int32_t ret = _decoder->Decode(frame, clock_->TimeInMilliseconds()); |
| 337 | 336 |
| 338 // Check for failed decoding, run frame type request callback if needed. | 337 // Check for failed decoding, run frame type request callback if needed. |
| 339 bool request_key_frame = false; | 338 bool request_key_frame = false; |
| 340 if (ret < 0) { | 339 if (ret < 0) { |
| 341 if (ret == VCM_ERROR_REQUEST_SLI) { | 340 if (ret == VCM_ERROR_REQUEST_SLI) { |
| 342 return RequestSliceLossIndication( | 341 return RequestSliceLossIndication( |
| 343 _decodedFrameCallback.LastReceivedPictureID() + 1); | 342 _decodedFrameCallback.LastReceivedPictureID() + 1); |
| 344 } else { | 343 } else { |
| 345 request_key_frame = true; | 344 request_key_frame = true; |
| 346 } | 345 } |
| 347 } else if (ret == VCM_REQUEST_SLI) { | 346 } else if (ret == VCM_REQUEST_SLI) { |
| 348 ret = RequestSliceLossIndication( | 347 ret = RequestSliceLossIndication( |
| 349 _decodedFrameCallback.LastReceivedPictureID() + 1); | 348 _decodedFrameCallback.LastReceivedPictureID() + 1); |
| 350 } | 349 } |
| 351 if (!frame.Complete() || frame.MissingFrame()) { | 350 if (!frame.Complete() || frame.MissingFrame()) { |
| 352 request_key_frame = true; | 351 request_key_frame = true; |
| 353 ret = VCM_OK; | 352 ret = VCM_OK; |
| 354 } | 353 } |
| 355 if (request_key_frame) { | 354 if (request_key_frame) { |
| 356 rtc::CritScope cs(&process_crit_); | 355 rtc::CritScope cs(&process_crit_); |
| 357 _scheduleKeyRequest = true; | 356 _scheduleKeyRequest = true; |
| 358 } | 357 } |
| 359 TRACE_EVENT_ASYNC_END0("webrtc", "Video", frame.TimeStamp()); | |
| 360 return ret; | 358 return ret; |
| 361 } | 359 } |
| 362 | 360 |
| 363 // Register possible receive codecs, can be called multiple times | 361 // Register possible receive codecs, can be called multiple times |
| 364 int32_t VideoReceiver::RegisterReceiveCodec(const VideoCodec* receiveCodec, | 362 int32_t VideoReceiver::RegisterReceiveCodec(const VideoCodec* receiveCodec, |
| 365 int32_t numberOfCores, | 363 int32_t numberOfCores, |
| 366 bool requireKeyFrame) { | 364 bool requireKeyFrame) { |
| 367 rtc::CritScope cs(&receive_crit_); | 365 rtc::CritScope cs(&receive_crit_); |
| 368 if (receiveCodec == nullptr) { | 366 if (receiveCodec == nullptr) { |
| 369 return VCM_PARAMETER_ERROR; | 367 return VCM_PARAMETER_ERROR; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, | 496 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, |
| 499 max_incomplete_time_ms); | 497 max_incomplete_time_ms); |
| 500 } | 498 } |
| 501 | 499 |
| 502 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { | 500 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { |
| 503 return _receiver.SetMinReceiverDelay(desired_delay_ms); | 501 return _receiver.SetMinReceiverDelay(desired_delay_ms); |
| 504 } | 502 } |
| 505 | 503 |
| 506 } // namespace vcm | 504 } // namespace vcm |
| 507 } // namespace webrtc | 505 } // namespace webrtc |
| OLD | NEW |