blob: 6b040c6a6f82f0c7027aff1fcb8dc85765f6c097 [file] [log] [blame]
mflodmancfc8e3b2016-05-03 21:22:04 -07001/*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
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#ifndef VIDEO_VIDEO_STREAM_DECODER_H_
12#define VIDEO_VIDEO_STREAM_DECODER_H_
mflodmancfc8e3b2016-05-03 21:22:04 -070013
14#include <list>
15#include <map>
16#include <memory>
17#include <vector>
18
Mirko Bonadeid9708072019-01-25 20:26:48 +010019#include "api/scoped_refptr.h"
Niels Möllerc6ce9c52018-05-11 11:15:30 +020020#include "api/video/video_sink_interface.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020021#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
22#include "modules/video_coding/include/video_coding_defines.h"
Steve Anton10542f22019-01-11 09:11:00 -080023#include "rtc_base/critical_section.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020024#include "rtc_base/platform_thread.h"
mflodmancfc8e3b2016-05-03 21:22:04 -070025
26namespace webrtc {
27
mflodmancfc8e3b2016-05-03 21:22:04 -070028class ReceiveStatisticsProxy;
Niels Mölleree3d9952019-09-09 12:51:55 +020029class VideoReceiver2;
mflodmancfc8e3b2016-05-03 21:22:04 -070030
Niels Möller41684372019-03-25 15:51:03 +010031class VideoStreamDecoder : public VCMReceiveCallback {
mflodmancfc8e3b2016-05-03 21:22:04 -070032 public:
nisse76bc8e82017-02-07 09:37:41 -080033 VideoStreamDecoder(
Niels Mölleree3d9952019-09-09 12:51:55 +020034 VideoReceiver2* video_receiver,
nisse76bc8e82017-02-07 09:37:41 -080035 ReceiveStatisticsProxy* receive_statistics_proxy,
36 rtc::VideoSinkInterface<VideoFrame>* incoming_video_stream);
Mirko Bonadei8fdcac32018-08-28 16:30:18 +020037 ~VideoStreamDecoder() override;
mflodmancfc8e3b2016-05-03 21:22:04 -070038
39 // Implements VCMReceiveCallback.
sakalcc452e12017-02-09 04:53:45 -080040 int32_t FrameToRender(VideoFrame& video_frame,
Danil Chapovalovb9b146c2018-06-15 12:28:07 +020041 absl::optional<uint8_t> qp,
Johannes Kronbfd343b2019-07-01 10:07:50 +020042 int32_t decode_time_ms,
ilnik00d802b2017-04-11 10:34:31 -070043 VideoContentType content_type) override;
Johannes Kron0c141c52019-08-26 15:04:43 +020044 void OnDroppedFrames(uint32_t frames_dropped) override;
mflodmancfc8e3b2016-05-03 21:22:04 -070045 void OnIncomingPayloadType(int payload_type) override;
46 void OnDecoderImplementationName(const char* implementation_name) override;
47
mflodmancfc8e3b2016-05-03 21:22:04 -070048 void RegisterReceiveStatisticsProxy(
49 ReceiveStatisticsProxy* receive_statistics_proxy);
50
mflodmancfc8e3b2016-05-03 21:22:04 -070051 private:
mflodmancfc8e3b2016-05-03 21:22:04 -070052 // Used for all registered callbacks except rendering.
53 rtc::CriticalSection crit_;
54
Niels Mölleree3d9952019-09-09 12:51:55 +020055 VideoReceiver2* const video_receiver_;
mflodmancfc8e3b2016-05-03 21:22:04 -070056
57 ReceiveStatisticsProxy* const receive_stats_callback_;
tommi2e82f382016-06-21 00:26:43 -070058 rtc::VideoSinkInterface<VideoFrame>* const incoming_video_stream_;
mflodmancfc8e3b2016-05-03 21:22:04 -070059};
60
61} // namespace webrtc
62
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020063#endif // VIDEO_VIDEO_STREAM_DECODER_H_