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 if (callback) |
stefan-webrtc
2016/10/03 09:30:32
{}
| |
80 callback->FrameToRender(decodedImage); | |
81 else | |
stefan-webrtc
2016/10/03 09:30:32
} else {
| |
82 LOG(LS_WARNING) << "No callback, dropping frame."; | |
81 return WEBRTC_VIDEO_CODEC_OK; | 83 return WEBRTC_VIDEO_CODEC_OK; |
82 } | 84 } |
83 | 85 |
84 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( | 86 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( |
85 const uint64_t pictureId) { | 87 const uint64_t pictureId) { |
86 CriticalSectionScoped cs(_critSect); | 88 CriticalSectionScoped cs(_critSect); |
87 if (_receiveCallback != NULL) { | 89 if (_receiveCallback != NULL) { |
88 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId); | 90 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId); |
89 } | 91 } |
90 return -1; | 92 return -1; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 | 182 |
181 bool VCMGenericDecoder::External() const { | 183 bool VCMGenericDecoder::External() const { |
182 return _isExternal; | 184 return _isExternal; |
183 } | 185 } |
184 | 186 |
185 bool VCMGenericDecoder::PrefersLateDecoding() const { | 187 bool VCMGenericDecoder::PrefersLateDecoding() const { |
186 return _decoder->PrefersLateDecoding(); | 188 return _decoder->PrefersLateDecoding(); |
187 } | 189 } |
188 | 190 |
189 } // namespace webrtc | 191 } // namespace webrtc |
OLD | NEW |