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