Chromium Code Reviews| Index: webrtc/modules/video_coding/main/source/generic_decoder.cc |
| diff --git a/webrtc/modules/video_coding/main/source/generic_decoder.cc b/webrtc/modules/video_coding/main/source/generic_decoder.cc |
| index f874e163c83f6ad3a3362cefe32a014f23585059..c924b0ac2bd0dcfdeb59261033933d8b1461c23d 100644 |
| --- a/webrtc/modules/video_coding/main/source/generic_decoder.cc |
| +++ b/webrtc/modules/video_coding/main/source/generic_decoder.cc |
| @@ -46,36 +46,44 @@ VCMReceiveCallback* VCMDecodedFrameCallback::UserReceiveCallback() |
| return _receiveCallback; |
| } |
| -int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) { |
| - // TODO(holmer): We should improve this so that we can handle multiple |
| - // callbacks from one call to Decode(). |
| - VCMFrameInformation* frameInfo; |
| - VCMReceiveCallback* callback; |
| - { |
| - CriticalSectionScoped cs(_critSect); |
| - frameInfo = _timestampMap.Pop(decodedImage.timestamp()); |
| - callback = _receiveCallback; |
| - } |
| - |
| - if (frameInfo == NULL) { |
| - LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " |
| - "this one."; |
| - return WEBRTC_VIDEO_CODEC_OK; |
| - } |
| - |
| - _timing.StopDecodeTimer( |
| - decodedImage.timestamp(), |
| - frameInfo->decodeStartTimeMs, |
| - _clock->TimeInMilliseconds(), |
| - frameInfo->renderTimeMs); |
| +int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage, |
| + int decodeTimeInMs) { |
| + // TODO(holmer): We should improve this so that we can handle multiple |
| + // callbacks from one call to Decode(). |
| + VCMFrameInformation* frameInfo; |
| + VCMReceiveCallback* callback; |
| + { |
| + CriticalSectionScoped cs(_critSect); |
| + frameInfo = _timestampMap.Pop(decodedImage.timestamp()); |
| + callback = _receiveCallback; |
| + } |
| + |
| + if (frameInfo == NULL) { |
| + LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " |
| + "this one."; |
| + return WEBRTC_VIDEO_CODEC_OK; |
| + } |
| + |
| + int64_t stopTime = |
| + (decodeTimeInMs != 0) ? frameInfo->decodeStartTimeMs + decodeTimeInMs : |
|
magjed_webrtc
2015/10/28 11:57:16
I think you should make this lessy hacky and land
|
| + _clock->TimeInMilliseconds(); |
| + _timing.StopDecodeTimer( |
| + decodedImage.timestamp(), |
| + frameInfo->decodeStartTimeMs, |
| + stopTime, |
| + frameInfo->renderTimeMs); |
| + |
| + if (callback != NULL) |
| + { |
| + decodedImage.set_render_time_ms(frameInfo->renderTimeMs); |
| + decodedImage.set_rotation(frameInfo->rotation); |
| + callback->FrameToRender(decodedImage); |
| + } |
| + return WEBRTC_VIDEO_CODEC_OK; |
| +} |
| - if (callback != NULL) |
| - { |
| - decodedImage.set_render_time_ms(frameInfo->renderTimeMs); |
| - decodedImage.set_rotation(frameInfo->rotation); |
| - callback->FrameToRender(decodedImage); |
| - } |
| - return WEBRTC_VIDEO_CODEC_OK; |
| +int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) { |
| + return Decoded(decodedImage, 0); |
| } |
| int32_t |