Added VideoContentType to OnDecodedFrame callback.

Also added a FrameInfo struct to propagate various meta information along side it.

Bug: webrtc:9106
Change-Id: I1feb9f94c662c367f7c6e0a50d33705fdd5346bb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183880
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32079}
This commit is contained in:
philipel
2020-09-10 15:30:02 +02:00
committed by Commit Bot
parent 673027b4a5
commit 3dc4780d8e
4 changed files with 51 additions and 38 deletions

View File

@ -62,16 +62,16 @@ class VideoStreamDecoderImpl : public VideoStreamDecoderInterface {
kDecodeFailure,
};
struct FrameTimestamps {
int64_t timestamp;
struct FrameInfo {
int64_t timestamp = -1;
int64_t decode_start_time_ms;
int64_t render_time_us;
VideoContentType content_type;
};
void SaveFrameTimestamps(const video_coding::EncodedFrame& frame)
RTC_RUN_ON(bookkeeping_queue_);
FrameTimestamps* GetFrameTimestamps(int64_t timestamp)
void SaveFrameInfo(const video_coding::EncodedFrame& frame)
RTC_RUN_ON(bookkeeping_queue_);
FrameInfo* GetFrameInfo(int64_t timestamp) RTC_RUN_ON(bookkeeping_queue_);
void StartNextDecode() RTC_RUN_ON(bookkeeping_queue_);
void OnNextFrameCallback(std::unique_ptr<video_coding::EncodedFrame> frame,
video_coding::FrameBuffer::ReturnReason res)
@ -90,10 +90,10 @@ class VideoStreamDecoderImpl : public VideoStreamDecoderInterface {
// Some decoders are pipelined so it is not sufficient to save frame info
// for the last frame only.
static constexpr int kFrameTimestampsMemory = 8;
std::array<FrameTimestamps, kFrameTimestampsMemory> frame_timestamps_
static constexpr int kFrameInfoMemory = 8;
std::array<FrameInfo, kFrameInfoMemory> frame_info_
RTC_GUARDED_BY(bookkeeping_queue_);
int next_frame_timestamps_index_ RTC_GUARDED_BY(bookkeeping_queue_);
int next_frame_info_index_ RTC_GUARDED_BY(bookkeeping_queue_);
VideoStreamDecoderInterface::Callbacks* const callbacks_
RTC_PT_GUARDED_BY(bookkeeping_queue_);
video_coding::VideoLayerFrameId last_continuous_id_