Delete picture id and tl0 index from CodecSpecificInfo.
This is a followup to https://webrtc-review.googlesource.com/61640, moving the responsibility for setting these values to the PayloadRouter. Bug: webrtc:8830 Change-Id: I8e5a02cf7bb7417166f04d5511aab7a778799bc1 Reviewed-on: https://webrtc-review.googlesource.com/83164 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23654}
This commit is contained in:
@ -95,7 +95,6 @@ void VCMEncodedFrame::CopyCodecSpecific(const RTPVideoHeader* header) {
|
||||
case kVideoCodecVP8: {
|
||||
if (_codecSpecificInfo.codecType != kVideoCodecVP8) {
|
||||
// This is the first packet for this frame.
|
||||
_codecSpecificInfo.codecSpecific.VP8.pictureId = -1;
|
||||
_codecSpecificInfo.codecSpecific.VP8.temporalIdx = 0;
|
||||
_codecSpecificInfo.codecSpecific.VP8.layerSync = false;
|
||||
_codecSpecificInfo.codecSpecific.VP8.keyIdx = -1;
|
||||
@ -103,10 +102,6 @@ void VCMEncodedFrame::CopyCodecSpecific(const RTPVideoHeader* header) {
|
||||
}
|
||||
_codecSpecificInfo.codecSpecific.VP8.nonReference =
|
||||
header->codecHeader.VP8.nonReference;
|
||||
if (header->codecHeader.VP8.pictureId != kNoPictureId) {
|
||||
_codecSpecificInfo.codecSpecific.VP8.pictureId =
|
||||
header->codecHeader.VP8.pictureId;
|
||||
}
|
||||
if (header->codecHeader.VP8.temporalIdx != kNoTemporalIdx) {
|
||||
_codecSpecificInfo.codecSpecific.VP8.temporalIdx =
|
||||
header->codecHeader.VP8.temporalIdx;
|
||||
@ -122,12 +117,10 @@ void VCMEncodedFrame::CopyCodecSpecific(const RTPVideoHeader* header) {
|
||||
case kVideoCodecVP9: {
|
||||
if (_codecSpecificInfo.codecType != kVideoCodecVP9) {
|
||||
// This is the first packet for this frame.
|
||||
_codecSpecificInfo.codecSpecific.VP9.picture_id = -1;
|
||||
_codecSpecificInfo.codecSpecific.VP9.temporal_idx = 0;
|
||||
_codecSpecificInfo.codecSpecific.VP9.spatial_idx = 0;
|
||||
_codecSpecificInfo.codecSpecific.VP9.gof_idx = 0;
|
||||
_codecSpecificInfo.codecSpecific.VP9.inter_layer_predicted = false;
|
||||
_codecSpecificInfo.codecSpecific.VP9.tl0_pic_idx = -1;
|
||||
_codecSpecificInfo.codecType = kVideoCodecVP9;
|
||||
}
|
||||
_codecSpecificInfo.codecSpecific.VP9.inter_pic_predicted =
|
||||
@ -142,14 +135,6 @@ void VCMEncodedFrame::CopyCodecSpecific(const RTPVideoHeader* header) {
|
||||
}
|
||||
_codecSpecificInfo.codecSpecific.VP9.ss_data_available =
|
||||
header->codecHeader.VP9.ss_data_available;
|
||||
if (header->codecHeader.VP9.picture_id != kNoPictureId) {
|
||||
_codecSpecificInfo.codecSpecific.VP9.picture_id =
|
||||
header->codecHeader.VP9.picture_id;
|
||||
}
|
||||
if (header->codecHeader.VP9.tl0_pic_idx != kNoTl0PicIdx) {
|
||||
_codecSpecificInfo.codecSpecific.VP9.tl0_pic_idx =
|
||||
header->codecHeader.VP9.tl0_pic_idx;
|
||||
}
|
||||
if (header->codecHeader.VP9.temporal_idx != kNoTemporalIdx) {
|
||||
_codecSpecificInfo.codecSpecific.VP9.temporal_idx =
|
||||
header->codecHeader.VP9.temporal_idx;
|
||||
|
@ -28,21 +28,14 @@ class RTPFragmentationHeader; // forward declaration
|
||||
// Note: if any pointers are added to this struct, it must be fitted
|
||||
// with a copy-constructor. See below.
|
||||
struct CodecSpecificInfoVP8 {
|
||||
// TODO(nisse): Used on receive side only. Move elsewhere?
|
||||
int16_t pictureId; // Negative value to skip pictureId.
|
||||
bool nonReference;
|
||||
uint8_t simulcastIdx;
|
||||
uint8_t temporalIdx;
|
||||
bool layerSync;
|
||||
// TODO(nisse): Used on receive side only. Move elsewhere?
|
||||
int tl0PicIdx; // Negative value to skip tl0PicIdx.
|
||||
int8_t keyIdx; // Negative value to skip keyIdx.
|
||||
};
|
||||
|
||||
struct CodecSpecificInfoVP9 {
|
||||
// TODO(nisse): Used on receive side only. Move elsewhere?
|
||||
int16_t picture_id; // Negative value to skip pictureId.
|
||||
|
||||
bool first_frame_in_picture; // First frame, increment picture_id.
|
||||
bool inter_pic_predicted; // This layer frame is dependent on previously
|
||||
// coded frame(s).
|
||||
@ -50,8 +43,6 @@ struct CodecSpecificInfoVP9 {
|
||||
bool ss_data_available;
|
||||
bool non_ref_for_inter_layer_pred;
|
||||
|
||||
// TODO(nisse): Used on receive side only. Move elsewhere?
|
||||
int tl0_pic_idx; // Negative value to skip tl0PicIdx.
|
||||
uint8_t temporal_idx;
|
||||
uint8_t spatial_idx;
|
||||
bool temporal_up_switch;
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "rtc_base/bind.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/random.h"
|
||||
#include "rtc_base/sequenced_task_checker.h"
|
||||
#include "rtc_base/task_queue.h"
|
||||
#include "rtc_base/thread.h"
|
||||
@ -283,10 +282,6 @@ class MediaCodecVideoEncoder : public VideoEncoder {
|
||||
int frames_received_since_last_key_;
|
||||
VideoCodecMode codec_mode_;
|
||||
|
||||
// RTP state.
|
||||
uint16_t picture_id_;
|
||||
uint8_t tl0_pic_idx_;
|
||||
|
||||
bool sw_fallback_required_;
|
||||
|
||||
// All other member variables should be before WeakPtrFactory. Valid only from
|
||||
@ -314,10 +309,6 @@ MediaCodecVideoEncoder::MediaCodecVideoEncoder(JNIEnv* jni,
|
||||
egl_context_(egl_context),
|
||||
sw_fallback_required_(false) {
|
||||
encoder_queue_checker_.Detach();
|
||||
|
||||
Random random(rtc::TimeMicros());
|
||||
picture_id_ = random.Rand<uint16_t>() & 0x7FFF;
|
||||
tl0_pic_idx_ = random.Rand<uint8_t>();
|
||||
}
|
||||
|
||||
int32_t MediaCodecVideoEncoder::InitEncode(const VideoCodec* codec_settings,
|
||||
@ -1011,22 +1002,18 @@ bool MediaCodecVideoEncoder::DeliverPendingOutputs(JNIEnv* jni) {
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.codecType = codec_type;
|
||||
if (codec_type == kVideoCodecVP8) {
|
||||
info.codecSpecific.VP8.pictureId = picture_id_;
|
||||
info.codecSpecific.VP8.nonReference = false;
|
||||
info.codecSpecific.VP8.simulcastIdx = 0;
|
||||
info.codecSpecific.VP8.temporalIdx = kNoTemporalIdx;
|
||||
info.codecSpecific.VP8.layerSync = false;
|
||||
info.codecSpecific.VP8.tl0PicIdx = kNoTl0PicIdx;
|
||||
info.codecSpecific.VP8.keyIdx = kNoKeyIdx;
|
||||
} else if (codec_type == kVideoCodecVP9) {
|
||||
if (key_frame) {
|
||||
gof_idx_ = 0;
|
||||
}
|
||||
info.codecSpecific.VP9.picture_id = picture_id_;
|
||||
info.codecSpecific.VP9.inter_pic_predicted = key_frame ? false : true;
|
||||
info.codecSpecific.VP9.flexible_mode = false;
|
||||
info.codecSpecific.VP9.ss_data_available = key_frame ? true : false;
|
||||
info.codecSpecific.VP9.tl0_pic_idx = tl0_pic_idx_++;
|
||||
info.codecSpecific.VP9.temporal_idx = kNoTemporalIdx;
|
||||
info.codecSpecific.VP9.spatial_idx = kNoSpatialIdx;
|
||||
info.codecSpecific.VP9.temporal_up_switch = true;
|
||||
@ -1044,7 +1031,6 @@ bool MediaCodecVideoEncoder::DeliverPendingOutputs(JNIEnv* jni) {
|
||||
info.codecSpecific.VP9.gof.CopyGofInfoVP9(gof_);
|
||||
}
|
||||
}
|
||||
picture_id_ = (picture_id_ + 1) & 0x7FFF;
|
||||
|
||||
// Generate a header describing a single fragment.
|
||||
RTPFragmentationHeader header;
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include "modules/video_coding/utility/vp8_header_parser.h"
|
||||
#include "modules/video_coding/utility/vp9_uncompressed_header_parser.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/random.h"
|
||||
#include "rtc_base/timeutils.h"
|
||||
#include "sdk/android/generated_video_jni/jni/VideoEncoderWrapper_jni.h"
|
||||
#include "sdk/android/generated_video_jni/jni/VideoEncoder_jni.h"
|
||||
#include "sdk/android/native_api/jni/class_loader.h"
|
||||
@ -38,10 +36,6 @@ VideoEncoderWrapper::VideoEncoderWrapper(JNIEnv* jni,
|
||||
|
||||
initialized_ = false;
|
||||
num_resets_ = 0;
|
||||
|
||||
Random random(rtc::TimeMicros());
|
||||
picture_id_ = random.Rand<uint16_t>() & 0x7FFF;
|
||||
tl0_pic_idx_ = random.Rand<uint8_t>();
|
||||
}
|
||||
VideoEncoderWrapper::~VideoEncoderWrapper() = default;
|
||||
|
||||
@ -392,23 +386,19 @@ CodecSpecificInfo VideoEncoderWrapper::ParseCodecSpecificInfo(
|
||||
|
||||
switch (codec_settings_.codecType) {
|
||||
case kVideoCodecVP8:
|
||||
info.codecSpecific.VP8.pictureId = picture_id_;
|
||||
info.codecSpecific.VP8.nonReference = false;
|
||||
info.codecSpecific.VP8.simulcastIdx = 0;
|
||||
info.codecSpecific.VP8.temporalIdx = kNoTemporalIdx;
|
||||
info.codecSpecific.VP8.layerSync = false;
|
||||
info.codecSpecific.VP8.tl0PicIdx = kNoTl0PicIdx;
|
||||
info.codecSpecific.VP8.keyIdx = kNoKeyIdx;
|
||||
break;
|
||||
case kVideoCodecVP9:
|
||||
if (key_frame) {
|
||||
gof_idx_ = 0;
|
||||
}
|
||||
info.codecSpecific.VP9.picture_id = picture_id_;
|
||||
info.codecSpecific.VP9.inter_pic_predicted = key_frame ? false : true;
|
||||
info.codecSpecific.VP9.flexible_mode = false;
|
||||
info.codecSpecific.VP9.ss_data_available = key_frame ? true : false;
|
||||
info.codecSpecific.VP9.tl0_pic_idx = tl0_pic_idx_++;
|
||||
info.codecSpecific.VP9.temporal_idx = kNoTemporalIdx;
|
||||
info.codecSpecific.VP9.spatial_idx = kNoSpatialIdx;
|
||||
info.codecSpecific.VP9.temporal_up_switch = true;
|
||||
@ -430,8 +420,6 @@ CodecSpecificInfo VideoEncoderWrapper::ParseCodecSpecificInfo(
|
||||
break;
|
||||
}
|
||||
|
||||
picture_id_ = (picture_id_ + 1) & 0x7FFF;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -106,10 +106,6 @@ class VideoEncoderWrapper : public VideoEncoder {
|
||||
VideoCodec codec_settings_;
|
||||
H264BitstreamParser h264_bitstream_parser_;
|
||||
|
||||
// RTP state.
|
||||
uint16_t picture_id_;
|
||||
uint8_t tl0_pic_idx_;
|
||||
|
||||
// VP9 variables to populate codec specific structure.
|
||||
GofInfoVP9 gof_; // Contains each frame's temporal information for
|
||||
// non-flexible VP9 mode.
|
||||
|
Reference in New Issue
Block a user