Reland of Deprecate VCMPacketizationCallback::SendData and use EncodedImageCallback instead. (patchset #1 id:1 of https://codereview.webrtc.org/1903193002/ )
Reason for revert: A fix is being prepared downstream so this can now go in. Original issue's description: > Revert of Deprecate VCMPacketizationCallback::SendData and use EncodedImageCallback instead. (patchset #5 id:80001 of https://codereview.webrtc.org/1897233002/ ) > > Reason for revert: > API changes broke downstream. > > Original issue's description: > > Deprecate VCMPacketizationCallback::SendData and use EncodedImageCallback instead. > > EncodedImageCallback is used by all encoder implementations and seems to be what we should try to use in the transport. > > EncodedImageCallback can of course be cleaned up in the future. > > > > This moves creation of RTPVideoHeader from the GenericEncoder to the PayLoadRouter. > > > > BUG=webrtc::5687 > > > > Committed: https://crrev.com/f5d55aaecdc39e9cc66eb6e87614f04afe28f6eb > > Cr-Commit-Position: refs/heads/master@{#12436} > > TBR=stefan@webrtc.org,pbos@webrtc.org,perkj@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:5687 > > Committed: https://crrev.com/a261e6136655af33f283eda8e60a6dd93dd746a4 > Cr-Commit-Position: refs/heads/master@{#12441} TBR=stefan@webrtc.org,pbos@webrtc.org,perkj@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5687 Review URL: https://codereview.webrtc.org/1905583002 Cr-Commit-Position: refs/heads/master@{#12442}
This commit is contained in:
@ -18,7 +18,7 @@ namespace webrtc {
|
||||
|
||||
IvfFileWriter::IvfFileWriter(const std::string& file_name,
|
||||
std::unique_ptr<FileWrapper> file,
|
||||
RtpVideoCodecTypes codec_type)
|
||||
VideoCodecType codec_type)
|
||||
: codec_type_(codec_type),
|
||||
num_frames_(0),
|
||||
width_(0),
|
||||
@ -34,9 +34,8 @@ IvfFileWriter::~IvfFileWriter() {
|
||||
|
||||
const size_t kIvfHeaderSize = 32;
|
||||
|
||||
std::unique_ptr<IvfFileWriter> IvfFileWriter::Open(
|
||||
const std::string& file_name,
|
||||
RtpVideoCodecTypes codec_type) {
|
||||
std::unique_ptr<IvfFileWriter> IvfFileWriter::Open(const std::string& file_name,
|
||||
VideoCodecType codec_type) {
|
||||
std::unique_ptr<IvfFileWriter> file_writer;
|
||||
std::unique_ptr<FileWrapper> file(FileWrapper::Create());
|
||||
if (file->OpenFile(file_name.c_str(), false) != 0)
|
||||
@ -65,19 +64,19 @@ bool IvfFileWriter::WriteHeader() {
|
||||
ByteWriter<uint16_t>::WriteLittleEndian(&ivf_header[6], 32); // Header size.
|
||||
|
||||
switch (codec_type_) {
|
||||
case kRtpVideoVp8:
|
||||
case kVideoCodecVP8:
|
||||
ivf_header[8] = 'V';
|
||||
ivf_header[9] = 'P';
|
||||
ivf_header[10] = '8';
|
||||
ivf_header[11] = '0';
|
||||
break;
|
||||
case kRtpVideoVp9:
|
||||
case kVideoCodecVP9:
|
||||
ivf_header[8] = 'V';
|
||||
ivf_header[9] = 'P';
|
||||
ivf_header[10] = '9';
|
||||
ivf_header[11] = '0';
|
||||
break;
|
||||
case kRtpVideoH264:
|
||||
case kVideoCodecH264:
|
||||
ivf_header[8] = 'H';
|
||||
ivf_header[9] = '2';
|
||||
ivf_header[10] = '6';
|
||||
|
||||
@ -27,18 +27,18 @@ class IvfFileWriter {
|
||||
~IvfFileWriter();
|
||||
|
||||
static std::unique_ptr<IvfFileWriter> Open(const std::string& file_name,
|
||||
RtpVideoCodecTypes codec_type);
|
||||
VideoCodecType codec_type);
|
||||
bool WriteFrame(const EncodedImage& encoded_image);
|
||||
bool Close();
|
||||
|
||||
private:
|
||||
IvfFileWriter(const std::string& path_name,
|
||||
std::unique_ptr<FileWrapper> file,
|
||||
RtpVideoCodecTypes codec_type);
|
||||
VideoCodecType codec_type);
|
||||
bool WriteHeader();
|
||||
bool InitFromFirstFrame(const EncodedImage& encoded_image);
|
||||
|
||||
const RtpVideoCodecTypes codec_type_;
|
||||
const VideoCodecType codec_type_;
|
||||
size_t num_frames_;
|
||||
uint16_t width_;
|
||||
uint16_t height_;
|
||||
|
||||
@ -103,7 +103,7 @@ class IvfFileWriterTest : public ::testing::Test {
|
||||
}
|
||||
}
|
||||
|
||||
void RunBasicFileStructureTest(RtpVideoCodecTypes codec_type,
|
||||
void RunBasicFileStructureTest(VideoCodecType codec_type,
|
||||
const uint8_t fourcc[4],
|
||||
bool use_capture_tims_ms) {
|
||||
file_writer_ = IvfFileWriter::Open(file_name_, codec_type);
|
||||
@ -135,7 +135,7 @@ class IvfFileWriterTest : public ::testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(IvfFileWriterTest, RemovesUnusedFile) {
|
||||
file_writer_ = IvfFileWriter::Open(file_name_, kRtpVideoVp8);
|
||||
file_writer_ = IvfFileWriter::Open(file_name_, kVideoCodecVP8);
|
||||
ASSERT_TRUE(file_writer_.get() != nullptr);
|
||||
EXPECT_TRUE(FileExists());
|
||||
EXPECT_TRUE(file_writer_->Close());
|
||||
@ -145,32 +145,32 @@ TEST_F(IvfFileWriterTest, RemovesUnusedFile) {
|
||||
|
||||
TEST_F(IvfFileWriterTest, WritesBasicVP8FileNtpTimestamp) {
|
||||
const uint8_t fourcc[4] = {'V', 'P', '8', '0'};
|
||||
RunBasicFileStructureTest(kRtpVideoVp8, fourcc, false);
|
||||
RunBasicFileStructureTest(kVideoCodecVP8, fourcc, false);
|
||||
}
|
||||
|
||||
TEST_F(IvfFileWriterTest, WritesBasicVP8FileMsTimestamp) {
|
||||
const uint8_t fourcc[4] = {'V', 'P', '8', '0'};
|
||||
RunBasicFileStructureTest(kRtpVideoVp8, fourcc, true);
|
||||
RunBasicFileStructureTest(kVideoCodecVP8, fourcc, true);
|
||||
}
|
||||
|
||||
TEST_F(IvfFileWriterTest, WritesBasicVP9FileNtpTimestamp) {
|
||||
const uint8_t fourcc[4] = {'V', 'P', '9', '0'};
|
||||
RunBasicFileStructureTest(kRtpVideoVp9, fourcc, false);
|
||||
RunBasicFileStructureTest(kVideoCodecVP9, fourcc, false);
|
||||
}
|
||||
|
||||
TEST_F(IvfFileWriterTest, WritesBasicVP9FileMsTimestamp) {
|
||||
const uint8_t fourcc[4] = {'V', 'P', '9', '0'};
|
||||
RunBasicFileStructureTest(kRtpVideoVp9, fourcc, true);
|
||||
RunBasicFileStructureTest(kVideoCodecVP9, fourcc, true);
|
||||
}
|
||||
|
||||
TEST_F(IvfFileWriterTest, WritesBasicH264FileNtpTimestamp) {
|
||||
const uint8_t fourcc[4] = {'H', '2', '6', '4'};
|
||||
RunBasicFileStructureTest(kRtpVideoH264, fourcc, false);
|
||||
RunBasicFileStructureTest(kVideoCodecH264, fourcc, false);
|
||||
}
|
||||
|
||||
TEST_F(IvfFileWriterTest, WritesBasicH264FileMsTimestamp) {
|
||||
const uint8_t fourcc[4] = {'H', '2', '6', '4'};
|
||||
RunBasicFileStructureTest(kRtpVideoH264, fourcc, true);
|
||||
RunBasicFileStructureTest(kVideoCodecH264, fourcc, true);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user