blob: dac8f2cd43b978b9b4cfe4ec9c1070431a1d83f2 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
mikhal@webrtc.orga2031d52012-07-31 15:53:44 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "modules/video_coding/generic_decoder.h"
tommi5b7fc8c2017-07-05 16:45:57 -070012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <stddef.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020014
ilnik2edc6842017-07-06 03:06:50 -070015#include <algorithm>
Johannes Kron111e9812020-10-26 13:54:40 +010016#include <cmath>
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000017#include <iterator>
18#include <utility>
ilnik2edc6842017-07-06 03:06:50 -070019
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000020#include "absl/algorithm/container.h"
Evan Shrubsole15b2ca72022-08-04 11:52:37 +000021#include "absl/types/optional.h"
Yves Gerey3e707812018-11-28 16:47:49 +010022#include "api/video/video_timing.h"
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000023#include "modules/include/module_common_types_public.h"
Yves Gerey3e707812018-11-28 16:47:49 +010024#include "modules/video_coding/include/video_error_codes.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020025#include "rtc_base/checks.h"
26#include "rtc_base/logging.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020027#include "rtc_base/trace_event.h"
28#include "system_wrappers/include/clock.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000029
30namespace webrtc {
31
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000032namespace {
33
34constexpr size_t kDecoderFrameMemoryLength = 10;
35
36}
37
Jonas Orelande02f9ee2022-03-25 12:43:14 +010038VCMDecodedFrameCallback::VCMDecodedFrameCallback(
39 VCMTiming* timing,
40 Clock* clock,
Jonas Orelande62c2f22022-03-29 11:04:48 +020041 const FieldTrialsView& field_trials)
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000042 : _clock(clock), _timing(timing) {
ilnik04f4d122017-06-19 07:18:55 -070043 ntp_offset_ =
44 _clock->CurrentNtpInMilliseconds() - _clock->TimeInMilliseconds();
45}
niklase@google.com470e71d2011-07-07 08:21:25 +000046
Yves Gerey665174f2018-06-19 15:03:05 +020047VCMDecodedFrameCallback::~VCMDecodedFrameCallback() {}
niklase@google.com470e71d2011-07-07 08:21:25 +000048
stefan@webrtc.org06887ae2011-10-10 14:17:46 +000049void VCMDecodedFrameCallback::SetUserReceiveCallback(
philipel9d3ab612015-12-21 04:12:39 -080050 VCMReceiveCallback* receiveCallback) {
Sebastian Janssonc01367d2019-04-08 15:20:44 +020051 RTC_DCHECK(construction_thread_.IsCurrent());
tommid0a71ba2017-03-14 04:16:20 -070052 RTC_DCHECK((!_receiveCallback && receiveCallback) ||
53 (_receiveCallback && !receiveCallback));
philipel9d3ab612015-12-21 04:12:39 -080054 _receiveCallback = receiveCallback;
niklase@google.com470e71d2011-07-07 08:21:25 +000055}
56
philipel9d3ab612015-12-21 04:12:39 -080057VCMReceiveCallback* VCMDecodedFrameCallback::UserReceiveCallback() {
tommid0a71ba2017-03-14 04:16:20 -070058 // Called on the decode thread via VCMCodecDataBase::GetDecoder.
59 // The callback must always have been set before this happens.
60 RTC_DCHECK(_receiveCallback);
philipel9d3ab612015-12-21 04:12:39 -080061 return _receiveCallback;
wuchengli@chromium.org0d94c2f2013-08-12 14:20:49 +000062}
63
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070064int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) {
Tommi553c8692020-05-05 15:35:45 +020065 // This function may be called on the decode TaskQueue, but may also be called
66 // on an OS provided queue such as on iOS (see e.g. b/153465112).
Per327d8ba2015-11-10 14:00:27 +010067 return Decoded(decodedImage, -1);
68}
69
70int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
71 int64_t decode_time_ms) {
sakalcc452e12017-02-09 04:53:45 -080072 Decoded(decodedImage,
Danil Chapovalov0040b662018-06-18 10:48:16 +020073 decode_time_ms >= 0 ? absl::optional<int32_t>(decode_time_ms)
74 : absl::nullopt,
75 absl::nullopt);
sakalcc452e12017-02-09 04:53:45 -080076 return WEBRTC_VIDEO_CODEC_OK;
77}
78
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000079std::pair<absl::optional<FrameInfo>, size_t>
80VCMDecodedFrameCallback::FindFrameInfo(uint32_t rtp_timestamp) {
81 absl::optional<FrameInfo> frame_info;
82
83 auto it = absl::c_find_if(frame_infos_, [rtp_timestamp](const auto& entry) {
84 return entry.rtp_timestamp == rtp_timestamp ||
85 IsNewerTimestamp(entry.rtp_timestamp, rtp_timestamp);
86 });
87 size_t dropped_frames = std::distance(frame_infos_.begin(), it);
88
89 if (it != frame_infos_.end() && it->rtp_timestamp == rtp_timestamp) {
90 // Frame was found and should also be removed from the queue.
91 frame_info = std::move(*it);
92 ++it;
93 }
94
95 frame_infos_.erase(frame_infos_.begin(), it);
96 return std::make_pair(std::move(frame_info), dropped_frames);
97}
98
sakalcc452e12017-02-09 04:53:45 -080099void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
Danil Chapovalov0040b662018-06-18 10:48:16 +0200100 absl::optional<int32_t> decode_time_ms,
101 absl::optional<uint8_t> qp) {
tommid0a71ba2017-03-14 04:16:20 -0700102 RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point";
philipel9d3ab612015-12-21 04:12:39 -0800103 TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
104 "timestamp", decodedImage.timestamp());
105 // TODO(holmer): We should improve this so that we can handle multiple
106 // callbacks from one call to Decode().
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000107 absl::optional<FrameInfo> frame_info;
Johannes Kron111e9812020-10-26 13:54:40 +0100108 int timestamp_map_size = 0;
Johannes Kronfc5d2762021-04-09 16:03:22 +0200109 int dropped_frames = 0;
Lu Liu352314a2018-02-21 19:38:59 +0000110 {
Markus Handell6deec382020-07-07 12:17:12 +0200111 MutexLock lock(&lock_);
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000112 std::tie(frame_info, dropped_frames) =
113 FindFrameInfo(decodedImage.timestamp());
114 timestamp_map_size = frame_infos_.size();
Johannes Kronfc5d2762021-04-09 16:03:22 +0200115 }
Johannes Kronfc5d2762021-04-09 16:03:22 +0200116 if (dropped_frames > 0) {
117 _receiveCallback->OnDroppedFrames(dropped_frames);
Lu Liu352314a2018-02-21 19:38:59 +0000118 }
philipel9d3ab612015-12-21 04:12:39 -0800119
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000120 if (!frame_info) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100121 RTC_LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping "
Johannes Kronac82bd32021-06-17 10:50:56 +0200122 "frame with timestamp "
123 << decodedImage.timestamp();
sakalcc452e12017-02-09 04:53:45 -0800124 return;
philipel9d3ab612015-12-21 04:12:39 -0800125 }
126
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000127 decodedImage.set_ntp_time_ms(frame_info->ntp_time_ms);
128 decodedImage.set_packet_infos(frame_info->packet_infos);
129 decodedImage.set_rotation(frame_info->rotation);
Johannes Kronbbf639e2022-06-15 12:27:23 +0200130 VideoFrame::RenderParameters render_parameters = _timing->RenderParameters();
131 if (render_parameters.max_composition_delay_in_frames) {
Evan Shrubsolef6adc642022-04-26 11:10:21 +0200132 // Subtract frames that are in flight.
Johannes Kronbbf639e2022-06-15 12:27:23 +0200133 render_parameters.max_composition_delay_in_frames =
134 std::max(0, *render_parameters.max_composition_delay_in_frames -
135 timestamp_map_size);
Johannes Kron111e9812020-10-26 13:54:40 +0100136 }
Johannes Kronbbf639e2022-06-15 12:27:23 +0200137 decodedImage.set_render_parameters(render_parameters);
Johannes Kron111e9812020-10-26 13:54:40 +0100138
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000139 RTC_DCHECK(frame_info->decode_start);
philipel85ddb232020-10-02 14:46:14 +0200140 const Timestamp now = _clock->CurrentTime();
141 const TimeDelta decode_time = decode_time_ms
142 ? TimeDelta::Millis(*decode_time_ms)
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000143 : now - *frame_info->decode_start;
Evan Shrubsoled6cdf802022-03-02 15:13:55 +0100144 _timing->StopDecodeTimer(decode_time, now);
philipel85ddb232020-10-02 14:46:14 +0200145 decodedImage.set_processing_time(
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000146 {*frame_info->decode_start, *frame_info->decode_start + decode_time});
philipel9d3ab612015-12-21 04:12:39 -0800147
ilnik04f4d122017-06-19 07:18:55 -0700148 // Report timing information.
Benjamin Wright3f10ca82018-12-07 03:45:19 -0800149 TimingFrameInfo timing_frame_info;
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000150 if (frame_info->timing.flags != VideoSendTiming::kInvalid) {
ilnik2edc6842017-07-06 03:06:50 -0700151 int64_t capture_time_ms = decodedImage.ntp_time_ms() - ntp_offset_;
ilnik04f4d122017-06-19 07:18:55 -0700152 // Convert remote timestamps to local time from ntp timestamps.
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000153 frame_info->timing.encode_start_ms -= ntp_offset_;
154 frame_info->timing.encode_finish_ms -= ntp_offset_;
155 frame_info->timing.packetization_finish_ms -= ntp_offset_;
156 frame_info->timing.pacer_exit_ms -= ntp_offset_;
157 frame_info->timing.network_timestamp_ms -= ntp_offset_;
158 frame_info->timing.network2_timestamp_ms -= ntp_offset_;
ilnik2edc6842017-07-06 03:06:50 -0700159
160 int64_t sender_delta_ms = 0;
161 if (decodedImage.ntp_time_ms() < 0) {
162 // Sender clock is not estimated yet. Make sure that sender times are all
163 // negative to indicate that. Yet they still should be relatively correct.
164 sender_delta_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000165 std::max({capture_time_ms, frame_info->timing.encode_start_ms,
166 frame_info->timing.encode_finish_ms,
167 frame_info->timing.packetization_finish_ms,
168 frame_info->timing.pacer_exit_ms,
169 frame_info->timing.network_timestamp_ms,
170 frame_info->timing.network2_timestamp_ms}) +
ilnik2edc6842017-07-06 03:06:50 -0700171 1;
172 }
173
ilnik2edc6842017-07-06 03:06:50 -0700174 timing_frame_info.capture_time_ms = capture_time_ms - sender_delta_ms;
175 timing_frame_info.encode_start_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000176 frame_info->timing.encode_start_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700177 timing_frame_info.encode_finish_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000178 frame_info->timing.encode_finish_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700179 timing_frame_info.packetization_finish_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000180 frame_info->timing.packetization_finish_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700181 timing_frame_info.pacer_exit_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000182 frame_info->timing.pacer_exit_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700183 timing_frame_info.network_timestamp_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000184 frame_info->timing.network_timestamp_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700185 timing_frame_info.network2_timestamp_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000186 frame_info->timing.network2_timestamp_ms - sender_delta_ms;
ilnik04f4d122017-06-19 07:18:55 -0700187 }
188
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000189 timing_frame_info.flags = frame_info->timing.flags;
190 timing_frame_info.decode_start_ms = frame_info->decode_start->ms();
Johannes Kron05f84872020-01-16 14:09:33 +0100191 timing_frame_info.decode_finish_ms = now.ms();
Evan Shrubsole15b2ca72022-08-04 11:52:37 +0000192 timing_frame_info.render_time_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000193 frame_info->render_time ? frame_info->render_time->ms() : -1;
Benjamin Wright3f10ca82018-12-07 03:45:19 -0800194 timing_frame_info.rtp_timestamp = decodedImage.timestamp();
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000195 timing_frame_info.receive_start_ms = frame_info->timing.receive_start_ms;
196 timing_frame_info.receive_finish_ms = frame_info->timing.receive_finish_ms;
Benjamin Wright3f10ca82018-12-07 03:45:19 -0800197 _timing->SetTimingFrameInfo(timing_frame_info);
198
Evan Shrubsole15b2ca72022-08-04 11:52:37 +0000199 decodedImage.set_timestamp_us(
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000200 frame_info->render_time ? frame_info->render_time->us() : -1);
Philipp Hancked970b092022-06-17 07:34:23 +0200201 _receiveCallback->FrameToRender(decodedImage, qp, decode_time,
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000202 frame_info->content_type);
niklase@google.com470e71d2011-07-07 08:21:25 +0000203}
204
Peter Boströmb7d9a972015-12-18 16:01:11 +0100205void VCMDecodedFrameCallback::OnDecoderImplementationName(
206 const char* implementation_name) {
tommid0a71ba2017-03-14 04:16:20 -0700207 _receiveCallback->OnDecoderImplementationName(implementation_name);
Peter Boströmb7d9a972015-12-18 16:01:11 +0100208}
209
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000210void VCMDecodedFrameCallback::Map(FrameInfo frameInfo) {
Johannes Kronfc5d2762021-04-09 16:03:22 +0200211 int dropped_frames = 0;
212 {
213 MutexLock lock(&lock_);
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000214 int initial_size = frame_infos_.size();
215 if (initial_size == kDecoderFrameMemoryLength) {
216 frame_infos_.pop_front();
217 dropped_frames = 1;
218 }
219 frame_infos_.push_back(std::move(frameInfo));
Artem Titovdcd7fc72021-08-09 13:02:57 +0200220 // If no frame is dropped, the new size should be `initial_size` + 1
Johannes Kronfc5d2762021-04-09 16:03:22 +0200221 }
222 if (dropped_frames > 0) {
223 _receiveCallback->OnDroppedFrames(dropped_frames);
224 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000225}
226
Johannes Kronfc5d2762021-04-09 16:03:22 +0200227void VCMDecodedFrameCallback::ClearTimestampMap() {
228 int dropped_frames = 0;
229 {
230 MutexLock lock(&lock_);
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000231 dropped_frames = frame_infos_.size();
232 frame_infos_.clear();
Lu Liu352314a2018-02-21 19:38:59 +0000233 }
Johannes Kronfc5d2762021-04-09 16:03:22 +0200234 if (dropped_frames > 0) {
235 _receiveCallback->OnDroppedFrames(dropped_frames);
236 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000237}
238
Danil Chapovalov7b78a312021-08-06 12:30:02 +0200239VCMGenericDecoder::VCMGenericDecoder(VideoDecoder* decoder)
Peter Boström187db632015-12-01 17:20:01 +0100240 : _callback(NULL),
tommi5b7fc8c2017-07-05 16:45:57 -0700241 decoder_(decoder),
tommi5b7fc8c2017-07-05 16:45:57 -0700242 _last_keyframe_content_type(VideoContentType::UNSPECIFIED) {
243 RTC_DCHECK(decoder_);
244}
niklase@google.com470e71d2011-07-07 08:21:25 +0000245
tommi5b7fc8c2017-07-05 16:45:57 -0700246VCMGenericDecoder::~VCMGenericDecoder() {
247 decoder_->Release();
tommi5b7fc8c2017-07-05 16:45:57 -0700248}
niklase@google.com470e71d2011-07-07 08:21:25 +0000249
Danil Chapovalov355b8d22021-08-13 16:50:37 +0200250bool VCMGenericDecoder::Configure(const VideoDecoder::Settings& settings) {
251 TRACE_EVENT0("webrtc", "VCMGenericDecoder::Configure");
niklase@google.com470e71d2011-07-07 08:21:25 +0000252
Danil Chapovalov355b8d22021-08-13 16:50:37 +0200253 bool ok = decoder_->Configure(settings);
Erik Språngc12f6252021-01-13 21:49:59 +0100254 decoder_info_ = decoder_->GetDecoderInfo();
255 RTC_LOG(LS_INFO) << "Decoder implementation: " << decoder_info_.ToString();
256 if (_callback) {
257 _callback->OnDecoderImplementationName(
258 decoder_info_.implementation_name.c_str());
259 }
Danil Chapovalov355b8d22021-08-13 16:50:37 +0200260 return ok;
niklase@google.com470e71d2011-07-07 08:21:25 +0000261}
262
Johannes Kron05f84872020-01-16 14:09:33 +0100263int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, Timestamp now) {
Yves Gerey665174f2018-06-19 15:03:05 +0200264 TRACE_EVENT1("webrtc", "VCMGenericDecoder::Decode", "timestamp",
Niels Möller23775882018-08-16 10:24:12 +0200265 frame.Timestamp());
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000266 FrameInfo frame_info;
267 frame_info.rtp_timestamp = frame.Timestamp();
Evan Shrubsole15b2ca72022-08-04 11:52:37 +0000268 frame_info.decode_start = now;
269 frame_info.render_time =
270 frame.RenderTimeMs() >= 0
271 ? absl::make_optional(Timestamp::Millis(frame.RenderTimeMs()))
272 : absl::nullopt;
Johannes Kronb6b782d2021-03-03 14:39:44 +0100273 frame_info.rotation = frame.rotation();
274 frame_info.timing = frame.video_timing();
275 frame_info.ntp_time_ms = frame.EncodedImage().ntp_time_ms_;
276 frame_info.packet_infos = frame.PacketInfos();
Ilya Nikolaevskiy2ebf5232019-05-13 16:13:36 +0200277
Yves Gerey665174f2018-06-19 15:03:05 +0200278 // Set correctly only for key frames. Thus, use latest key frame
279 // content type. If the corresponding key frame was lost, decode will fail
280 // and content type will be ignored.
Niels Möller8f7ce222019-03-21 15:43:58 +0100281 if (frame.FrameType() == VideoFrameType::kVideoFrameKey) {
Johannes Kronb6b782d2021-03-03 14:39:44 +0100282 frame_info.content_type = frame.contentType();
Yves Gerey665174f2018-06-19 15:03:05 +0200283 _last_keyframe_content_type = frame.contentType();
284 } else {
Johannes Kronb6b782d2021-03-03 14:39:44 +0100285 frame_info.content_type = _last_keyframe_content_type;
Yves Gerey665174f2018-06-19 15:03:05 +0200286 }
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000287 _callback->Map(std::move(frame_info));
niklase@google.com470e71d2011-07-07 08:21:25 +0000288
Yves Gerey665174f2018-06-19 15:03:05 +0200289 int32_t ret = decoder_->Decode(frame.EncodedImage(), frame.MissingFrame(),
Niels Möller7aacdd92019-03-25 09:11:40 +0100290 frame.RenderTimeMs());
Erik Språngc12f6252021-01-13 21:49:59 +0100291 VideoDecoder::DecoderInfo decoder_info = decoder_->GetDecoderInfo();
292 if (decoder_info != decoder_info_) {
Ilya Nikolaevskiy43c108b2020-05-15 12:24:29 +0200293 RTC_LOG(LS_INFO) << "Changed decoder implementation to: "
Erik Språngc12f6252021-01-13 21:49:59 +0100294 << decoder_info.ToString();
Erik Språngc80f9552021-03-12 16:36:49 +0100295 decoder_info_ = decoder_info;
Erik Språngc12f6252021-01-13 21:49:59 +0100296 _callback->OnDecoderImplementationName(
297 decoder_info.implementation_name.empty()
298 ? "unknown"
299 : decoder_info.implementation_name.c_str());
Ilya Nikolaevskiy43c108b2020-05-15 12:24:29 +0200300 }
Yves Gerey665174f2018-06-19 15:03:05 +0200301 if (ret < WEBRTC_VIDEO_CODEC_OK) {
302 RTC_LOG(LS_WARNING) << "Failed to decode frame with timestamp "
Niels Möller23775882018-08-16 10:24:12 +0200303 << frame.Timestamp() << ", error code: " << ret;
Johannes Kronfc5d2762021-04-09 16:03:22 +0200304 _callback->ClearTimestampMap();
Niels Möller9cccf852018-12-04 11:01:26 +0100305 } else if (ret == WEBRTC_VIDEO_CODEC_NO_OUTPUT) {
Johannes Kronfc5d2762021-04-09 16:03:22 +0200306 // No output.
307 _callback->ClearTimestampMap();
Yves Gerey665174f2018-06-19 15:03:05 +0200308 }
309 return ret;
guidouc3372582017-04-04 07:16:21 -0700310}
niklase@google.com470e71d2011-07-07 08:21:25 +0000311
Peter Boström187db632015-12-01 17:20:01 +0100312int32_t VCMGenericDecoder::RegisterDecodeCompleteCallback(
313 VCMDecodedFrameCallback* callback) {
314 _callback = callback;
Erik Språngc12f6252021-01-13 21:49:59 +0100315 int32_t ret = decoder_->RegisterDecodeCompleteCallback(callback);
316 if (callback && !decoder_info_.implementation_name.empty()) {
317 callback->OnDecoderImplementationName(
318 decoder_info_.implementation_name.c_str());
319 }
320 return ret;
niklase@google.com470e71d2011-07-07 08:21:25 +0000321}
322
philipel9d3ab612015-12-21 04:12:39 -0800323} // namespace webrtc