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 35 matching lines...) Loading... |
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 // TODO(holmer): We should improve this so that we can handle multiple | 50 // TODO(holmer): We should improve this so that we can handle multiple |
51 // callbacks from one call to Decode(). | 51 // callbacks from one call to Decode(). |
52 VCMFrameInformation* frameInfo; | 52 VCMFrameInformation* frameInfo; |
53 VCMReceiveCallback* callback; | 53 VCMReceiveCallback* callback; |
54 { | 54 { |
55 CriticalSectionScoped cs(_critSect); | 55 CriticalSectionScoped cs(_critSect); |
56 frameInfo = static_cast<VCMFrameInformation*>( | 56 frameInfo = _timestampMap.Pop(decodedImage.timestamp()); |
57 _timestampMap.Pop(decodedImage.timestamp())); | |
58 callback = _receiveCallback; | 57 callback = _receiveCallback; |
59 } | 58 } |
60 | 59 |
61 if (frameInfo == NULL) { | 60 if (frameInfo == NULL) { |
62 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " | 61 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " |
63 "this one."; | 62 "this one."; |
64 return WEBRTC_VIDEO_CODEC_OK; | 63 return WEBRTC_VIDEO_CODEC_OK; |
65 } | 64 } |
66 | 65 |
67 _timing.StopDecodeTimer( | 66 _timing.StopDecodeTimer( |
(...skipping 28 matching lines...) Loading... |
96 { | 95 { |
97 _lastReceivedPictureID = pictureId; | 96 _lastReceivedPictureID = pictureId; |
98 return 0; | 97 return 0; |
99 } | 98 } |
100 | 99 |
101 uint64_t VCMDecodedFrameCallback::LastReceivedPictureID() const | 100 uint64_t VCMDecodedFrameCallback::LastReceivedPictureID() const |
102 { | 101 { |
103 return _lastReceivedPictureID; | 102 return _lastReceivedPictureID; |
104 } | 103 } |
105 | 104 |
106 int32_t VCMDecodedFrameCallback::Map(uint32_t timestamp, VCMFrameInformation* fr
ameInfo) | 105 void VCMDecodedFrameCallback::Map(uint32_t timestamp, |
107 { | 106 VCMFrameInformation* frameInfo) { |
108 CriticalSectionScoped cs(_critSect); | 107 CriticalSectionScoped cs(_critSect); |
109 return _timestampMap.Add(timestamp, frameInfo); | 108 _timestampMap.Add(timestamp, frameInfo); |
110 } | 109 } |
111 | 110 |
112 int32_t VCMDecodedFrameCallback::Pop(uint32_t timestamp) | 111 int32_t VCMDecodedFrameCallback::Pop(uint32_t timestamp) |
113 { | 112 { |
114 CriticalSectionScoped cs(_critSect); | 113 CriticalSectionScoped cs(_critSect); |
115 if (_timestampMap.Pop(timestamp) == NULL) | 114 if (_timestampMap.Pop(timestamp) == NULL) |
116 { | 115 { |
117 return VCM_GENERAL_ERROR; | 116 return VCM_GENERAL_ERROR; |
118 } | 117 } |
119 return VCM_OK; | 118 return VCM_OK; |
(...skipping 70 matching lines...) Loading... |
190 _callback = callback; | 189 _callback = callback; |
191 return _decoder.RegisterDecodeCompleteCallback(callback); | 190 return _decoder.RegisterDecodeCompleteCallback(callback); |
192 } | 191 } |
193 | 192 |
194 bool VCMGenericDecoder::External() const | 193 bool VCMGenericDecoder::External() const |
195 { | 194 { |
196 return _isExternal; | 195 return _isExternal; |
197 } | 196 } |
198 | 197 |
199 } // namespace | 198 } // namespace |
OLD | NEW |