Allow gap on packet buffer fix with GFD
The current solution does not work for GFD since GFD is only parsed from the first packet of the frame. As a result, to access the generic information, we have to check every packet when traversing the packet buffer to find the first packet of frame. This fix is necessary to ensure temporal scaling works correctly with GFD. Bug: webrtc:42225186 Change-Id: Iadda4ec690deab62c32eb6101583e6a6d75cfeaf Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/344840 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42836}
This commit is contained in:
parent
6793f831ff
commit
8771cf470d
@ -279,6 +279,14 @@ std::vector<std::unique_ptr<PacketBuffer::Packet>> PacketBuffer::FindFrames(
|
||||
int idr_height = -1;
|
||||
bool full_frame_found = false;
|
||||
while (true) {
|
||||
// GFD is only attached to first packet of frame, so update check on
|
||||
// every packet.
|
||||
if (buffer_[start_index] != nullptr) {
|
||||
is_generic = buffer_[start_index]->video_header.generic.has_value();
|
||||
if (is_generic) {
|
||||
is_h264_descriptor = false;
|
||||
}
|
||||
}
|
||||
++tested_packets;
|
||||
|
||||
if (!is_h264_descriptor) {
|
||||
|
||||
@ -827,6 +827,18 @@ TEST_F(PacketBufferH264FrameGap, DisallowFrameGapForH264NoGeneric) {
|
||||
IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(PacketBufferH264FrameGap,
|
||||
AllowFrameGapForH264WithGenericOnFirstPacketOnly) {
|
||||
bool generic = true;
|
||||
InsertH264(1, kKeyFrame, kFirst, kLast, 1001, {}, 0, 0, generic);
|
||||
InsertH264(3, kDeltaFrame, kFirst, kNotLast, 1003, {}, 0, 0, generic);
|
||||
// Second packet is not generic, but we can still output frame with 2 packets.
|
||||
EXPECT_THAT(
|
||||
InsertH264(4, kDeltaFrame, kNotFirst, kLast, 1003, {}, 0, 0, !generic)
|
||||
.packets,
|
||||
SizeIs(2));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace video_coding
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user