OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 int H264VideoToolboxDecoder::RegisterDecodeCompleteCallback( | 159 int H264VideoToolboxDecoder::RegisterDecodeCompleteCallback( |
160 DecodedImageCallback* callback) { | 160 DecodedImageCallback* callback) { |
161 RTC_DCHECK(!callback_); | 161 RTC_DCHECK(!callback_); |
162 callback_ = callback; | 162 callback_ = callback; |
163 return WEBRTC_VIDEO_CODEC_OK; | 163 return WEBRTC_VIDEO_CODEC_OK; |
164 } | 164 } |
165 | 165 |
166 int H264VideoToolboxDecoder::Release() { | 166 int H264VideoToolboxDecoder::Release() { |
| 167 // Need to invalidate the session so that callbacks no longer occur and it |
| 168 // is safe to null out the callback. |
| 169 DestroyDecompressionSession(); |
| 170 SetVideoFormat(nullptr); |
167 callback_ = nullptr; | 171 callback_ = nullptr; |
168 return WEBRTC_VIDEO_CODEC_OK; | 172 return WEBRTC_VIDEO_CODEC_OK; |
169 } | 173 } |
170 | 174 |
171 int H264VideoToolboxDecoder::ResetDecompressionSession() { | 175 int H264VideoToolboxDecoder::ResetDecompressionSession() { |
172 DestroyDecompressionSession(); | 176 DestroyDecompressionSession(); |
173 | 177 |
174 // Need to wait for the first SPS to initialize decoder. | 178 // Need to wait for the first SPS to initialize decoder. |
175 if (!video_format_) { | 179 if (!video_format_) { |
176 return WEBRTC_VIDEO_CODEC_OK; | 180 return WEBRTC_VIDEO_CODEC_OK; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } | 260 } |
257 } | 261 } |
258 | 262 |
259 const char* H264VideoToolboxDecoder::ImplementationName() const { | 263 const char* H264VideoToolboxDecoder::ImplementationName() const { |
260 return "VideoToolbox"; | 264 return "VideoToolbox"; |
261 } | 265 } |
262 | 266 |
263 } // namespace webrtc | 267 } // namespace webrtc |
264 | 268 |
265 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 269 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
OLD | NEW |