mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00

This reverts commit 07efe436c9
.
Reason for revert: Breaks downstream project.
cricket::GetSimulcastConfig method signature has been updated.
I think you can get away with a default value for temporal_layers_supported (and then you can remove it after a few days when projects will be updated).
Original change's description:
> Implement H264 simulcast support and generalize SimulcastEncoderAdapter use for H264 & VP8.
>
> * Move SimulcastEncoderAdapter out under modules/video_coding
> * Move SimulcastRateAllocator back out to modules/video_coding/utility
> * Move TemporalLayers and ScreenshareLayers to modules/video_coding/utility
> * Move any VP8 specific code - such as temporal layer bitrate budgeting -
> under codec type dependent conditionals.
> * Plumb the simulcast index for H264 in the codec specific and RTP format data structures.
>
> Bug: webrtc:5840
> Change-Id: Ieced8a00e38f273c1a6cfd0f5431a87d07b8f44e
> Reviewed-on: https://webrtc-review.googlesource.com/64100
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#23705}
TBR=sprang@webrtc.org,stefan@webrtc.org,mflodman@webrtc.org,hta@webrtc.org,sergio.garcia.murillo@gmail.com,titovartem@webrtc.org,agouaillard@gmail.com
Change-Id: Ic9d3b1eeaf195bb5ec2063954421f5e77866d663
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:5840
Reviewed-on: https://webrtc-review.googlesource.com/84760
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23710}
103 lines
3.1 KiB
C++
103 lines
3.1 KiB
C++
/*
|
|
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*
|
|
*/
|
|
|
|
#ifndef MODULES_VIDEO_CODING_CODECS_H264_H264_ENCODER_IMPL_H_
|
|
#define MODULES_VIDEO_CODING_CODECS_H264_H264_ENCODER_IMPL_H_
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "common_video/h264/h264_bitstream_parser.h"
|
|
#include "modules/video_coding/codecs/h264/include/h264.h"
|
|
#include "modules/video_coding/utility/quality_scaler.h"
|
|
|
|
#include "third_party/openh264/src/codec/api/svc/codec_app_def.h"
|
|
|
|
class ISVCEncoder;
|
|
|
|
namespace webrtc {
|
|
|
|
class H264EncoderImpl : public H264Encoder {
|
|
public:
|
|
explicit H264EncoderImpl(const cricket::VideoCodec& codec);
|
|
~H264EncoderImpl() override;
|
|
|
|
// |max_payload_size| is ignored.
|
|
// The following members of |codec_settings| are used. The rest are ignored.
|
|
// - codecType (must be kVideoCodecH264)
|
|
// - targetBitrate
|
|
// - maxFramerate
|
|
// - width
|
|
// - height
|
|
int32_t InitEncode(const VideoCodec* codec_settings,
|
|
int32_t number_of_cores,
|
|
size_t max_payload_size) override;
|
|
int32_t Release() override;
|
|
|
|
int32_t RegisterEncodeCompleteCallback(
|
|
EncodedImageCallback* callback) override;
|
|
int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation,
|
|
uint32_t framerate) override;
|
|
|
|
// The result of encoding - an EncodedImage and RTPFragmentationHeader - are
|
|
// passed to the encode complete callback.
|
|
int32_t Encode(const VideoFrame& frame,
|
|
const CodecSpecificInfo* codec_specific_info,
|
|
const std::vector<FrameType>* frame_types) override;
|
|
|
|
const char* ImplementationName() const override;
|
|
|
|
VideoEncoder::ScalingSettings GetScalingSettings() const override;
|
|
|
|
// Unsupported / Do nothing.
|
|
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
|
|
|
|
// Exposed for testing.
|
|
H264PacketizationMode PacketizationModeForTesting() const {
|
|
return packetization_mode_;
|
|
}
|
|
|
|
private:
|
|
bool IsInitialized() const;
|
|
SEncParamExt CreateEncoderParams() const;
|
|
|
|
webrtc::H264BitstreamParser h264_bitstream_parser_;
|
|
// Reports statistics with histograms.
|
|
void ReportInit();
|
|
void ReportError();
|
|
|
|
ISVCEncoder* openh264_encoder_;
|
|
// Settings that are used by this encoder.
|
|
int width_;
|
|
int height_;
|
|
float max_frame_rate_;
|
|
uint32_t target_bps_;
|
|
uint32_t max_bps_;
|
|
VideoCodecMode mode_;
|
|
// H.264 specifc parameters
|
|
bool frame_dropping_on_;
|
|
int key_frame_interval_;
|
|
H264PacketizationMode packetization_mode_;
|
|
|
|
size_t max_payload_size_;
|
|
int32_t number_of_cores_;
|
|
|
|
EncodedImage encoded_image_;
|
|
std::unique_ptr<uint8_t[]> encoded_image_buffer_;
|
|
EncodedImageCallback* encoded_image_callback_;
|
|
|
|
bool has_reported_init_;
|
|
bool has_reported_error_;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_VIDEO_CODING_CODECS_H264_H264_ENCODER_IMPL_H_
|