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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 int64_t nextRenderTimeMs; | 284 int64_t nextRenderTimeMs; |
285 bool supports_render_scheduling; | 285 bool supports_render_scheduling; |
286 { | 286 { |
287 CriticalSectionScoped cs(_receiveCritSect); | 287 CriticalSectionScoped cs(_receiveCritSect); |
288 supports_render_scheduling = _codecDataBase.SupportsRenderScheduling(); | 288 supports_render_scheduling = _codecDataBase.SupportsRenderScheduling(); |
289 } | 289 } |
290 | 290 |
291 VCMEncodedFrame* frame = _receiver.FrameForDecoding( | 291 VCMEncodedFrame* frame = _receiver.FrameForDecoding( |
292 maxWaitTimeMs, nextRenderTimeMs, supports_render_scheduling); | 292 maxWaitTimeMs, nextRenderTimeMs, supports_render_scheduling); |
293 | 293 |
294 if (frame == NULL) { | 294 if (frame == NULL) |
295 return VCM_FRAME_NOT_READY; | 295 return VCM_FRAME_NOT_READY; |
296 } else { | |
297 CriticalSectionScoped cs(_receiveCritSect); | |
298 | 296 |
299 // If this frame was too late, we should adjust the delay accordingly | 297 CriticalSectionScoped cs(_receiveCritSect); |
300 _timing.UpdateCurrentDelay(frame->RenderTimeMs(), | |
301 clock_->TimeInMilliseconds()); | |
302 | 298 |
303 if (pre_decode_image_callback_) { | 299 // If this frame was too late, we should adjust the delay accordingly |
304 EncodedImage encoded_image(frame->EncodedImage()); | 300 _timing.UpdateCurrentDelay(frame->RenderTimeMs(), |
305 pre_decode_image_callback_->Encoded(encoded_image, NULL, NULL); | 301 clock_->TimeInMilliseconds()); |
306 } | 302 |
| 303 if (pre_decode_image_callback_) { |
| 304 EncodedImage encoded_image(frame->EncodedImage()); |
| 305 pre_decode_image_callback_->Encoded(encoded_image, NULL, NULL); |
| 306 } |
307 | 307 |
308 #ifdef DEBUG_DECODER_BIT_STREAM | 308 #ifdef DEBUG_DECODER_BIT_STREAM |
309 if (_bitStreamBeforeDecoder != NULL) { | 309 if (_bitStreamBeforeDecoder != NULL) { |
310 // Write bit stream to file for debugging purposes | 310 // Write bit stream to file for debugging purposes |
311 if (fwrite( | 311 if (fwrite(frame->Buffer(), 1, frame->Length(), _bitStreamBeforeDecoder) != |
312 frame->Buffer(), 1, frame->Length(), _bitStreamBeforeDecoder) != | 312 frame->Length()) { |
313 frame->Length()) { | 313 return -1; |
314 return -1; | |
315 } | |
316 } | |
317 #endif | |
318 const int32_t ret = Decode(*frame); | |
319 _receiver.ReleaseFrame(frame); | |
320 frame = NULL; | |
321 if (ret != VCM_OK) { | |
322 return ret; | |
323 } | 314 } |
324 } | 315 } |
325 return VCM_OK; | 316 #endif |
| 317 const int32_t ret = Decode(*frame); |
| 318 _receiver.ReleaseFrame(frame); |
| 319 return ret; |
326 } | 320 } |
327 | 321 |
328 int32_t VideoReceiver::RequestSliceLossIndication( | 322 int32_t VideoReceiver::RequestSliceLossIndication( |
329 const uint64_t pictureID) const { | 323 const uint64_t pictureID) const { |
330 TRACE_EVENT1("webrtc", "RequestSLI", "picture_id", pictureID); | 324 TRACE_EVENT1("webrtc", "RequestSLI", "picture_id", pictureID); |
331 CriticalSectionScoped cs(process_crit_sect_.get()); | 325 CriticalSectionScoped cs(process_crit_sect_.get()); |
332 if (_frameTypeCallback != NULL) { | 326 if (_frameTypeCallback != NULL) { |
333 const int32_t ret = | 327 const int32_t ret = |
334 _frameTypeCallback->SliceLossIndicationRequest(pictureID); | 328 _frameTypeCallback->SliceLossIndicationRequest(pictureID); |
335 if (ret < 0) { | 329 if (ret < 0) { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 } | 558 } |
565 | 559 |
566 void VideoReceiver::RegisterPreDecodeImageCallback( | 560 void VideoReceiver::RegisterPreDecodeImageCallback( |
567 EncodedImageCallback* observer) { | 561 EncodedImageCallback* observer) { |
568 CriticalSectionScoped cs(_receiveCritSect); | 562 CriticalSectionScoped cs(_receiveCritSect); |
569 pre_decode_image_callback_ = observer; | 563 pre_decode_image_callback_ = observer; |
570 } | 564 } |
571 | 565 |
572 } // namespace vcm | 566 } // namespace vcm |
573 } // namespace webrtc | 567 } // namespace webrtc |
OLD | NEW |