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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 "timestamp", decodedImage.timestamp()); | 52 "timestamp", decodedImage.timestamp()); |
53 // TODO(holmer): We should improve this so that we can handle multiple | 53 // TODO(holmer): We should improve this so that we can handle multiple |
54 // callbacks from one call to Decode(). | 54 // callbacks from one call to Decode(). |
55 VCMFrameInformation* frameInfo; | 55 VCMFrameInformation* frameInfo; |
56 VCMReceiveCallback* callback; | 56 VCMReceiveCallback* callback; |
57 { | 57 { |
58 CriticalSectionScoped cs(_critSect); | 58 CriticalSectionScoped cs(_critSect); |
59 frameInfo = _timestampMap.Pop(decodedImage.timestamp()); | 59 frameInfo = _timestampMap.Pop(decodedImage.timestamp()); |
60 callback = _receiveCallback; | 60 callback = _receiveCallback; |
61 } | 61 } |
62 RTC_DCHECK(callback != nullptr); | |
63 | 62 |
64 if (frameInfo == NULL) { | 63 if (frameInfo == NULL) { |
65 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " | 64 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " |
66 "this one."; | 65 "this one."; |
67 return WEBRTC_VIDEO_CODEC_OK; | 66 return WEBRTC_VIDEO_CODEC_OK; |
68 } | 67 } |
69 | 68 |
70 const int64_t now_ms = _clock->TimeInMilliseconds(); | 69 const int64_t now_ms = _clock->TimeInMilliseconds(); |
71 if (decode_time_ms < 0) { | 70 if (decode_time_ms < 0) { |
72 decode_time_ms = | 71 decode_time_ms = |
73 static_cast<int32_t>(now_ms - frameInfo->decodeStartTimeMs); | 72 static_cast<int32_t>(now_ms - frameInfo->decodeStartTimeMs); |
74 } | 73 } |
75 _timing->StopDecodeTimer(decodedImage.timestamp(), decode_time_ms, now_ms, | 74 _timing->StopDecodeTimer(decodedImage.timestamp(), decode_time_ms, now_ms, |
76 frameInfo->renderTimeMs); | 75 frameInfo->renderTimeMs); |
77 | 76 |
78 decodedImage.set_render_time_ms(frameInfo->renderTimeMs); | 77 decodedImage.set_render_time_ms(frameInfo->renderTimeMs); |
79 decodedImage.set_rotation(frameInfo->rotation); | 78 decodedImage.set_rotation(frameInfo->rotation); |
80 callback->FrameToRender(decodedImage); | 79 // TODO(sakal): Investigate why callback is NULL sometimes and replace if |
| 80 // statement with a DCHECK. |
| 81 if (callback) { |
| 82 callback->FrameToRender(decodedImage); |
| 83 } else { |
| 84 LOG(LS_WARNING) << "No callback, dropping frame."; |
| 85 } |
81 return WEBRTC_VIDEO_CODEC_OK; | 86 return WEBRTC_VIDEO_CODEC_OK; |
82 } | 87 } |
83 | 88 |
84 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( | 89 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( |
85 const uint64_t pictureId) { | 90 const uint64_t pictureId) { |
86 CriticalSectionScoped cs(_critSect); | 91 CriticalSectionScoped cs(_critSect); |
87 if (_receiveCallback != NULL) { | 92 if (_receiveCallback != NULL) { |
88 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId); | 93 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId); |
89 } | 94 } |
90 return -1; | 95 return -1; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 185 |
181 bool VCMGenericDecoder::External() const { | 186 bool VCMGenericDecoder::External() const { |
182 return _isExternal; | 187 return _isExternal; |
183 } | 188 } |
184 | 189 |
185 bool VCMGenericDecoder::PrefersLateDecoding() const { | 190 bool VCMGenericDecoder::PrefersLateDecoding() const { |
186 return _decoder->PrefersLateDecoding(); | 191 return _decoder->PrefersLateDecoding(); |
187 } | 192 } |
188 | 193 |
189 } // namespace webrtc | 194 } // namespace webrtc |
OLD | NEW |