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