blob: b660e02b725037a52f3dcaa0868e589b208a5c46 [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 Shrubsole09da10e2022-10-14 14:38:31 +000023#include "api/video_codecs/video_decoder.h"
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000024#include "modules/include/module_common_types_public.h"
Yves Gerey3e707812018-11-28 16:47:49 +010025#include "modules/video_coding/include/video_error_codes.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020026#include "rtc_base/checks.h"
27#include "rtc_base/logging.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020028#include "rtc_base/trace_event.h"
29#include "system_wrappers/include/clock.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000030
31namespace webrtc {
32
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000033namespace {
34
35constexpr size_t kDecoderFrameMemoryLength = 10;
36
37}
38
Jonas Orelande02f9ee2022-03-25 12:43:14 +010039VCMDecodedFrameCallback::VCMDecodedFrameCallback(
40 VCMTiming* timing,
41 Clock* clock,
Jonas Orelande62c2f22022-03-29 11:04:48 +020042 const FieldTrialsView& field_trials)
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000043 : _clock(clock), _timing(timing) {
ilnik04f4d122017-06-19 07:18:55 -070044 ntp_offset_ =
45 _clock->CurrentNtpInMilliseconds() - _clock->TimeInMilliseconds();
46}
niklase@google.com470e71d2011-07-07 08:21:25 +000047
Yves Gerey665174f2018-06-19 15:03:05 +020048VCMDecodedFrameCallback::~VCMDecodedFrameCallback() {}
niklase@google.com470e71d2011-07-07 08:21:25 +000049
stefan@webrtc.org06887ae2011-10-10 14:17:46 +000050void VCMDecodedFrameCallback::SetUserReceiveCallback(
philipel9d3ab612015-12-21 04:12:39 -080051 VCMReceiveCallback* receiveCallback) {
Sebastian Janssonc01367d2019-04-08 15:20:44 +020052 RTC_DCHECK(construction_thread_.IsCurrent());
tommid0a71ba2017-03-14 04:16:20 -070053 RTC_DCHECK((!_receiveCallback && receiveCallback) ||
54 (_receiveCallback && !receiveCallback));
philipel9d3ab612015-12-21 04:12:39 -080055 _receiveCallback = receiveCallback;
niklase@google.com470e71d2011-07-07 08:21:25 +000056}
57
philipel9d3ab612015-12-21 04:12:39 -080058VCMReceiveCallback* VCMDecodedFrameCallback::UserReceiveCallback() {
tommid0a71ba2017-03-14 04:16:20 -070059 // Called on the decode thread via VCMCodecDataBase::GetDecoder.
60 // The callback must always have been set before this happens.
61 RTC_DCHECK(_receiveCallback);
philipel9d3ab612015-12-21 04:12:39 -080062 return _receiveCallback;
wuchengli@chromium.org0d94c2f2013-08-12 14:20:49 +000063}
64
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070065int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) {
Tommi553c8692020-05-05 15:35:45 +020066 // This function may be called on the decode TaskQueue, but may also be called
67 // on an OS provided queue such as on iOS (see e.g. b/153465112).
Per327d8ba2015-11-10 14:00:27 +010068 return Decoded(decodedImage, -1);
69}
70
71int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
72 int64_t decode_time_ms) {
sakalcc452e12017-02-09 04:53:45 -080073 Decoded(decodedImage,
Danil Chapovalov0040b662018-06-18 10:48:16 +020074 decode_time_ms >= 0 ? absl::optional<int32_t>(decode_time_ms)
75 : absl::nullopt,
76 absl::nullopt);
sakalcc452e12017-02-09 04:53:45 -080077 return WEBRTC_VIDEO_CODEC_OK;
78}
79
Evan Shrubsole1c51ec42022-08-08 11:21:26 +000080std::pair<absl::optional<FrameInfo>, size_t>
81VCMDecodedFrameCallback::FindFrameInfo(uint32_t rtp_timestamp) {
82 absl::optional<FrameInfo> frame_info;
83
84 auto it = absl::c_find_if(frame_infos_, [rtp_timestamp](const auto& entry) {
85 return entry.rtp_timestamp == rtp_timestamp ||
86 IsNewerTimestamp(entry.rtp_timestamp, rtp_timestamp);
87 });
88 size_t dropped_frames = std::distance(frame_infos_.begin(), it);
89
90 if (it != frame_infos_.end() && it->rtp_timestamp == rtp_timestamp) {
91 // Frame was found and should also be removed from the queue.
92 frame_info = std::move(*it);
93 ++it;
94 }
95
96 frame_infos_.erase(frame_infos_.begin(), it);
97 return std::make_pair(std::move(frame_info), dropped_frames);
98}
99
sakalcc452e12017-02-09 04:53:45 -0800100void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
Danil Chapovalov0040b662018-06-18 10:48:16 +0200101 absl::optional<int32_t> decode_time_ms,
102 absl::optional<uint8_t> qp) {
tommid0a71ba2017-03-14 04:16:20 -0700103 RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point";
philipel9d3ab612015-12-21 04:12:39 -0800104 TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
105 "timestamp", decodedImage.timestamp());
106 // TODO(holmer): We should improve this so that we can handle multiple
107 // callbacks from one call to Decode().
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000108 absl::optional<FrameInfo> frame_info;
Johannes Kron111e9812020-10-26 13:54:40 +0100109 int timestamp_map_size = 0;
Johannes Kronfc5d2762021-04-09 16:03:22 +0200110 int dropped_frames = 0;
Lu Liu352314a2018-02-21 19:38:59 +0000111 {
Markus Handell6deec382020-07-07 12:17:12 +0200112 MutexLock lock(&lock_);
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000113 std::tie(frame_info, dropped_frames) =
114 FindFrameInfo(decodedImage.timestamp());
115 timestamp_map_size = frame_infos_.size();
Johannes Kronfc5d2762021-04-09 16:03:22 +0200116 }
Johannes Kronfc5d2762021-04-09 16:03:22 +0200117 if (dropped_frames > 0) {
118 _receiveCallback->OnDroppedFrames(dropped_frames);
Lu Liu352314a2018-02-21 19:38:59 +0000119 }
philipel9d3ab612015-12-21 04:12:39 -0800120
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000121 if (!frame_info) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100122 RTC_LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping "
Johannes Kronac82bd32021-06-17 10:50:56 +0200123 "frame with timestamp "
124 << decodedImage.timestamp();
sakalcc452e12017-02-09 04:53:45 -0800125 return;
philipel9d3ab612015-12-21 04:12:39 -0800126 }
127
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000128 decodedImage.set_ntp_time_ms(frame_info->ntp_time_ms);
129 decodedImage.set_packet_infos(frame_info->packet_infos);
130 decodedImage.set_rotation(frame_info->rotation);
Johannes Kronbbf639e2022-06-15 12:27:23 +0200131 VideoFrame::RenderParameters render_parameters = _timing->RenderParameters();
132 if (render_parameters.max_composition_delay_in_frames) {
Evan Shrubsolef6adc642022-04-26 11:10:21 +0200133 // Subtract frames that are in flight.
Johannes Kronbbf639e2022-06-15 12:27:23 +0200134 render_parameters.max_composition_delay_in_frames =
135 std::max(0, *render_parameters.max_composition_delay_in_frames -
136 timestamp_map_size);
Johannes Kron111e9812020-10-26 13:54:40 +0100137 }
Johannes Kronbbf639e2022-06-15 12:27:23 +0200138 decodedImage.set_render_parameters(render_parameters);
Johannes Kron111e9812020-10-26 13:54:40 +0100139
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000140 RTC_DCHECK(frame_info->decode_start);
philipel85ddb232020-10-02 14:46:14 +0200141 const Timestamp now = _clock->CurrentTime();
142 const TimeDelta decode_time = decode_time_ms
143 ? TimeDelta::Millis(*decode_time_ms)
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000144 : now - *frame_info->decode_start;
Evan Shrubsoled6cdf802022-03-02 15:13:55 +0100145 _timing->StopDecodeTimer(decode_time, now);
philipel85ddb232020-10-02 14:46:14 +0200146 decodedImage.set_processing_time(
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000147 {*frame_info->decode_start, *frame_info->decode_start + decode_time});
philipel9d3ab612015-12-21 04:12:39 -0800148
ilnik04f4d122017-06-19 07:18:55 -0700149 // Report timing information.
Benjamin Wright3f10ca82018-12-07 03:45:19 -0800150 TimingFrameInfo timing_frame_info;
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000151 if (frame_info->timing.flags != VideoSendTiming::kInvalid) {
ilnik2edc6842017-07-06 03:06:50 -0700152 int64_t capture_time_ms = decodedImage.ntp_time_ms() - ntp_offset_;
ilnik04f4d122017-06-19 07:18:55 -0700153 // Convert remote timestamps to local time from ntp timestamps.
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000154 frame_info->timing.encode_start_ms -= ntp_offset_;
155 frame_info->timing.encode_finish_ms -= ntp_offset_;
156 frame_info->timing.packetization_finish_ms -= ntp_offset_;
157 frame_info->timing.pacer_exit_ms -= ntp_offset_;
158 frame_info->timing.network_timestamp_ms -= ntp_offset_;
159 frame_info->timing.network2_timestamp_ms -= ntp_offset_;
ilnik2edc6842017-07-06 03:06:50 -0700160
161 int64_t sender_delta_ms = 0;
162 if (decodedImage.ntp_time_ms() < 0) {
163 // Sender clock is not estimated yet. Make sure that sender times are all
164 // negative to indicate that. Yet they still should be relatively correct.
165 sender_delta_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000166 std::max({capture_time_ms, frame_info->timing.encode_start_ms,
167 frame_info->timing.encode_finish_ms,
168 frame_info->timing.packetization_finish_ms,
169 frame_info->timing.pacer_exit_ms,
170 frame_info->timing.network_timestamp_ms,
171 frame_info->timing.network2_timestamp_ms}) +
ilnik2edc6842017-07-06 03:06:50 -0700172 1;
173 }
174
ilnik2edc6842017-07-06 03:06:50 -0700175 timing_frame_info.capture_time_ms = capture_time_ms - sender_delta_ms;
176 timing_frame_info.encode_start_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000177 frame_info->timing.encode_start_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700178 timing_frame_info.encode_finish_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000179 frame_info->timing.encode_finish_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700180 timing_frame_info.packetization_finish_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000181 frame_info->timing.packetization_finish_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700182 timing_frame_info.pacer_exit_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000183 frame_info->timing.pacer_exit_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700184 timing_frame_info.network_timestamp_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000185 frame_info->timing.network_timestamp_ms - sender_delta_ms;
ilnik2edc6842017-07-06 03:06:50 -0700186 timing_frame_info.network2_timestamp_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000187 frame_info->timing.network2_timestamp_ms - sender_delta_ms;
ilnik04f4d122017-06-19 07:18:55 -0700188 }
189
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000190 timing_frame_info.flags = frame_info->timing.flags;
191 timing_frame_info.decode_start_ms = frame_info->decode_start->ms();
Johannes Kron05f84872020-01-16 14:09:33 +0100192 timing_frame_info.decode_finish_ms = now.ms();
Evan Shrubsole15b2ca72022-08-04 11:52:37 +0000193 timing_frame_info.render_time_ms =
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000194 frame_info->render_time ? frame_info->render_time->ms() : -1;
Benjamin Wright3f10ca82018-12-07 03:45:19 -0800195 timing_frame_info.rtp_timestamp = decodedImage.timestamp();
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000196 timing_frame_info.receive_start_ms = frame_info->timing.receive_start_ms;
197 timing_frame_info.receive_finish_ms = frame_info->timing.receive_finish_ms;
Benjamin Wright3f10ca82018-12-07 03:45:19 -0800198 _timing->SetTimingFrameInfo(timing_frame_info);
199
Evan Shrubsole15b2ca72022-08-04 11:52:37 +0000200 decodedImage.set_timestamp_us(
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000201 frame_info->render_time ? frame_info->render_time->us() : -1);
Philipp Hancked970b092022-06-17 07:34:23 +0200202 _receiveCallback->FrameToRender(decodedImage, qp, decode_time,
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000203 frame_info->content_type);
niklase@google.com470e71d2011-07-07 08:21:25 +0000204}
205
Evan Shrubsole09da10e2022-10-14 14:38:31 +0000206void VCMDecodedFrameCallback::OnDecoderInfoChanged(
207 const VideoDecoder::DecoderInfo& decoder_info) {
208 _receiveCallback->OnDecoderInfoChanged(decoder_info);
Peter Boströmb7d9a972015-12-18 16:01:11 +0100209}
210
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000211void VCMDecodedFrameCallback::Map(FrameInfo frameInfo) {
Johannes Kronfc5d2762021-04-09 16:03:22 +0200212 int dropped_frames = 0;
213 {
214 MutexLock lock(&lock_);
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000215 int initial_size = frame_infos_.size();
216 if (initial_size == kDecoderFrameMemoryLength) {
217 frame_infos_.pop_front();
218 dropped_frames = 1;
219 }
220 frame_infos_.push_back(std::move(frameInfo));
Artem Titovdcd7fc72021-08-09 13:02:57 +0200221 // If no frame is dropped, the new size should be `initial_size` + 1
Johannes Kronfc5d2762021-04-09 16:03:22 +0200222 }
223 if (dropped_frames > 0) {
224 _receiveCallback->OnDroppedFrames(dropped_frames);
225 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000226}
227
Johannes Kronfc5d2762021-04-09 16:03:22 +0200228void VCMDecodedFrameCallback::ClearTimestampMap() {
229 int dropped_frames = 0;
230 {
231 MutexLock lock(&lock_);
Evan Shrubsole1c51ec42022-08-08 11:21:26 +0000232 dropped_frames = frame_infos_.size();
233 frame_infos_.clear();
Lu Liu352314a2018-02-21 19:38:59 +0000234 }
Johannes Kronfc5d2762021-04-09 16:03:22 +0200235 if (dropped_frames > 0) {
236 _receiveCallback->OnDroppedFrames(dropped_frames);
237 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000238}
239
Danil Chapovalov7b78a312021-08-06 12:30:02 +0200240VCMGenericDecoder::VCMGenericDecoder(VideoDecoder* decoder)
Peter Boström187db632015-12-01 17:20:01 +0100241 : _callback(NULL),
tommi5b7fc8c2017-07-05 16:45:57 -0700242 decoder_(decoder),
tommi5b7fc8c2017-07-05 16:45:57 -0700243 _last_keyframe_content_type(VideoContentType::UNSPECIFIED) {
244 RTC_DCHECK(decoder_);
245}
niklase@google.com470e71d2011-07-07 08:21:25 +0000246
tommi5b7fc8c2017-07-05 16:45:57 -0700247VCMGenericDecoder::~VCMGenericDecoder() {
248 decoder_->Release();
tommi5b7fc8c2017-07-05 16:45:57 -0700249}
niklase@google.com470e71d2011-07-07 08:21:25 +0000250
Danil Chapovalov355b8d22021-08-13 16:50:37 +0200251bool VCMGenericDecoder::Configure(const VideoDecoder::Settings& settings) {
252 TRACE_EVENT0("webrtc", "VCMGenericDecoder::Configure");
niklase@google.com470e71d2011-07-07 08:21:25 +0000253
Danil Chapovalov355b8d22021-08-13 16:50:37 +0200254 bool ok = decoder_->Configure(settings);
Erik Språngc12f6252021-01-13 21:49:59 +0100255 decoder_info_ = decoder_->GetDecoderInfo();
256 RTC_LOG(LS_INFO) << "Decoder implementation: " << decoder_info_.ToString();
257 if (_callback) {
Evan Shrubsole09da10e2022-10-14 14:38:31 +0000258 _callback->OnDecoderInfoChanged(decoder_info_);
Erik Språngc12f6252021-01-13 21:49:59 +0100259 }
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;
Evan Shrubsole09da10e2022-10-14 14:38:31 +0000296 if (decoder_info.implementation_name.empty()) {
297 decoder_info.implementation_name = "unknown";
298 }
299 _callback->OnDecoderInfoChanged(std::move(decoder_info));
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()) {
Evan Shrubsole09da10e2022-10-14 14:38:31 +0000317 callback->OnDecoderInfoChanged(decoder_info_);
Erik Språngc12f6252021-01-13 21:49:59 +0100318 }
319 return ret;
niklase@google.com470e71d2011-07-07 08:21:25 +0000320}
321
philipel9d3ab612015-12-21 04:12:39 -0800322} // namespace webrtc