Chromium Code Reviews| 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 |
| 11 #include "webrtc/base/checks.h" | |
| 11 #include "webrtc/base/logging.h" | 12 #include "webrtc/base/logging.h" |
| 12 #include "webrtc/base/trace_event.h" | 13 #include "webrtc/base/trace_event.h" |
| 13 #include "webrtc/modules/video_coding/include/video_coding.h" | 14 #include "webrtc/modules/video_coding/include/video_coding.h" |
| 14 #include "webrtc/modules/video_coding/generic_decoder.h" | 15 #include "webrtc/modules/video_coding/generic_decoder.h" |
| 15 #include "webrtc/modules/video_coding/internal_defines.h" | 16 #include "webrtc/modules/video_coding/internal_defines.h" |
| 16 #include "webrtc/system_wrappers/include/clock.h" | 17 #include "webrtc/system_wrappers/include/clock.h" |
| 17 | 18 |
| 18 namespace webrtc { | 19 namespace webrtc { |
| 19 | 20 |
| 20 VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming* timing, | 21 VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming* timing, |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 51 "timestamp", decodedImage.timestamp()); | 52 "timestamp", decodedImage.timestamp()); |
| 52 // 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 |
| 53 // callbacks from one call to Decode(). | 54 // callbacks from one call to Decode(). |
| 54 VCMFrameInformation* frameInfo; | 55 VCMFrameInformation* frameInfo; |
| 55 VCMReceiveCallback* callback; | 56 VCMReceiveCallback* callback; |
| 56 { | 57 { |
| 57 CriticalSectionScoped cs(_critSect); | 58 CriticalSectionScoped cs(_critSect); |
| 58 frameInfo = _timestampMap.Pop(decodedImage.timestamp()); | 59 frameInfo = _timestampMap.Pop(decodedImage.timestamp()); |
| 59 callback = _receiveCallback; | 60 callback = _receiveCallback; |
| 60 } | 61 } |
| 62 RTC_DCHECK(callback != nullptr); | |
|
Taylor Brandstetter
2016/09/30 21:05:57
This DCHECK seems to be being hit by libjingle_pee
| |
| 61 | 63 |
| 62 if (frameInfo == NULL) { | 64 if (frameInfo == NULL) { |
| 63 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " | 65 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " |
| 64 "this one."; | 66 "this one."; |
| 65 return WEBRTC_VIDEO_CODEC_OK; | 67 return WEBRTC_VIDEO_CODEC_OK; |
| 66 } | 68 } |
| 67 | 69 |
| 68 const int64_t now_ms = _clock->TimeInMilliseconds(); | 70 const int64_t now_ms = _clock->TimeInMilliseconds(); |
| 69 if (decode_time_ms < 0) { | 71 if (decode_time_ms < 0) { |
| 70 decode_time_ms = | 72 decode_time_ms = |
| 71 static_cast<int32_t>(now_ms - frameInfo->decodeStartTimeMs); | 73 static_cast<int32_t>(now_ms - frameInfo->decodeStartTimeMs); |
| 72 } | 74 } |
| 73 _timing->StopDecodeTimer(decodedImage.timestamp(), decode_time_ms, now_ms, | 75 _timing->StopDecodeTimer(decodedImage.timestamp(), decode_time_ms, now_ms, |
| 74 frameInfo->renderTimeMs); | 76 frameInfo->renderTimeMs); |
| 75 | 77 |
| 76 if (callback != NULL) { | 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 callback->FrameToRender(decodedImage); | |
| 80 } | |
| 81 return WEBRTC_VIDEO_CODEC_OK; | 81 return WEBRTC_VIDEO_CODEC_OK; |
| 82 } | 82 } |
| 83 | 83 |
| 84 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( | 84 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( |
| 85 const uint64_t pictureId) { | 85 const uint64_t pictureId) { |
| 86 CriticalSectionScoped cs(_critSect); | 86 CriticalSectionScoped cs(_critSect); |
| 87 if (_receiveCallback != NULL) { | 87 if (_receiveCallback != NULL) { |
| 88 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId); | 88 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId); |
| 89 } | 89 } |
| 90 return -1; | 90 return -1; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 | 179 |
| 180 bool VCMGenericDecoder::External() const { | 180 bool VCMGenericDecoder::External() const { |
| 181 return _isExternal; | 181 return _isExternal; |
| 182 } | 182 } |
| 183 | 183 |
| 184 bool VCMGenericDecoder::PrefersLateDecoding() const { | 184 bool VCMGenericDecoder::PrefersLateDecoding() const { |
| 185 return _decoder->PrefersLateDecoding(); | 185 return _decoder->PrefersLateDecoding(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace webrtc | 188 } // namespace webrtc |
| OLD | NEW |