OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 29 matching lines...) Expand all Loading... |
40 _receiveCallback = receiveCallback; | 40 _receiveCallback = receiveCallback; |
41 } | 41 } |
42 | 42 |
43 VCMReceiveCallback* VCMDecodedFrameCallback::UserReceiveCallback() | 43 VCMReceiveCallback* VCMDecodedFrameCallback::UserReceiveCallback() |
44 { | 44 { |
45 CriticalSectionScoped cs(_critSect); | 45 CriticalSectionScoped cs(_critSect); |
46 return _receiveCallback; | 46 return _receiveCallback; |
47 } | 47 } |
48 | 48 |
49 int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) { | 49 int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) { |
| 50 return Decoded(decodedImage, -1); |
| 51 } |
| 52 |
| 53 int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage, |
| 54 int64_t decode_time_ms) { |
50 // TODO(holmer): We should improve this so that we can handle multiple | 55 // TODO(holmer): We should improve this so that we can handle multiple |
51 // callbacks from one call to Decode(). | 56 // callbacks from one call to Decode(). |
52 VCMFrameInformation* frameInfo; | 57 VCMFrameInformation* frameInfo; |
53 VCMReceiveCallback* callback; | 58 VCMReceiveCallback* callback; |
54 { | 59 { |
55 CriticalSectionScoped cs(_critSect); | 60 CriticalSectionScoped cs(_critSect); |
56 frameInfo = _timestampMap.Pop(decodedImage.timestamp()); | 61 frameInfo = _timestampMap.Pop(decodedImage.timestamp()); |
57 callback = _receiveCallback; | 62 callback = _receiveCallback; |
58 } | 63 } |
59 | 64 |
60 if (frameInfo == NULL) { | 65 if (frameInfo == NULL) { |
61 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " | 66 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " |
62 "this one."; | 67 "this one."; |
63 return WEBRTC_VIDEO_CODEC_OK; | 68 return WEBRTC_VIDEO_CODEC_OK; |
64 } | 69 } |
65 | 70 |
| 71 const int64_t now_ms = _clock->TimeInMilliseconds(); |
| 72 if (decode_time_ms < 0) { |
| 73 decode_time_ms = |
| 74 static_cast<int32_t>(now_ms - frameInfo->decodeStartTimeMs); |
| 75 } |
66 _timing.StopDecodeTimer( | 76 _timing.StopDecodeTimer( |
67 decodedImage.timestamp(), | 77 decodedImage.timestamp(), |
68 frameInfo->decodeStartTimeMs, | 78 decode_time_ms, |
69 _clock->TimeInMilliseconds(), | 79 now_ms, |
70 frameInfo->renderTimeMs); | 80 frameInfo->renderTimeMs); |
71 | 81 |
72 if (callback != NULL) | 82 if (callback != NULL) |
73 { | 83 { |
74 decodedImage.set_render_time_ms(frameInfo->renderTimeMs); | 84 decodedImage.set_render_time_ms(frameInfo->renderTimeMs); |
75 decodedImage.set_rotation(frameInfo->rotation); | 85 decodedImage.set_rotation(frameInfo->rotation); |
76 callback->FrameToRender(decodedImage); | 86 callback->FrameToRender(decodedImage); |
77 } | 87 } |
78 return WEBRTC_VIDEO_CODEC_OK; | 88 return WEBRTC_VIDEO_CODEC_OK; |
79 } | 89 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 _callback = callback; | 199 _callback = callback; |
190 return _decoder.RegisterDecodeCompleteCallback(callback); | 200 return _decoder.RegisterDecodeCompleteCallback(callback); |
191 } | 201 } |
192 | 202 |
193 bool VCMGenericDecoder::External() const | 203 bool VCMGenericDecoder::External() const |
194 { | 204 { |
195 return _isExternal; | 205 return _isExternal; |
196 } | 206 } |
197 | 207 |
198 } // namespace | 208 } // namespace |
OLD | NEW |