|
|
Chromium Code Reviews|
Created:
4 years, 10 months ago by aleung Modified:
4 years, 10 months ago CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com, zhuangzesen_agora.io, stefan-webrtc, mflodman, pbos-webrtc Base URL:
https://chromium.googlesource.com/external/webrtc.git@master Target Ref:
refs/pending/heads/master Project:
webrtc Visibility:
Public. |
DescriptionAlways append the BYE packet type at the end
When composing a RTCP packet, if there is a BYE
to be appended, preserve it and append it at the
end after all other packet types are added.
BUG=webrtc:5498
NOTRY=true
Committed: https://crrev.com/0e2e50ca1c83c9ad9ba61149fbcd704b514b3e13
Cr-Commit-Position: refs/heads/master@{#11672}
Patch Set 1 #
Total comments: 4
Patch Set 2 : Changes per code review #Patch Set 3 : Unit Test Added #
Total comments: 5
Patch Set 4 : Updated Unit Test per Code Review #
Total comments: 1
Patch Set 5 : Removed Comment #
Messages
Total messages: 27 (12 generated)
pbos@webrtc.org changed reviewers: + danilchap@webrtc.org, pbos@webrtc.org, stefan@webrtc.org
danilchap@ can you help review this + suggest tests to be added?
Nice patch.
A test would be nice to ensure later changes will not put bye packet back in the
middle of a compound rtcp packet.
Here is one of the ways to add it to rtcp_sender_unittest.cc :
test::RtcpPacketParser doesn't worry about the order, so need a different
parser. Something like that:
const uint8_t* next_packet = data;
while (next_packet < data+len) {
RtcpCommonHeader header;
ParseHeader(next_packet, &header);
next_packet = next_packet + header.packet_size_bytes;
bool is_last_packet = (data + len == next_packet);
if (header.packet_type == kByeType) {
EXPECT_TRUE(is_last_packet) << "Bye packet should be last in a compound RTCP
packet.";
}
}
Create a MockTransport with pseudocode above in the mock of SendRtcp (check
gmock). In your test recreate rtcp_sender_ with this MockTransport instead of
TestTransport. Ensure test breaks before your change.
Other than missing test just some style comments.
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
File webrtc/modules/rtp_rtcp/source/rtcp_sender.cc (right):
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
webrtc/modules/rtp_rtcp/source/rtcp_sender.cc:838:
rtc::scoped_ptr<rtcp::RtcpPacket> packetWithBye = nullptr;
Local variables use snake_case.
This variable doesn't hold packet with bye, but instead bye packet itself, may
be call it 'packet_bye' or 'bye_packet' or just 'bye'.
Smart pointers do not require nullptr initialization.
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
webrtc/modules/rtp_rtcp/source/rtcp_sender.cc:854: // if there is a BYE, don't
append now - save it and append it
Comments better be started with an Upper letter and end with a dot.
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
webrtc/modules/rtp_rtcp/source/rtcp_sender.cc:857:
packetWithBye.reset(packet.release());
packetWithBye = std::move(packet); is a standard way to move a smart pointer
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
webrtc/modules/rtp_rtcp/source/rtcp_sender.cc:864: if (packetWithBye != nullptr)
{
"if (packetWithBye)" is preferred way to check if pointer holds something
On 2016/02/08 10:44:29, danilchap wrote:
> Nice patch.
> A test would be nice to ensure later changes will not put bye packet back in
the
> middle of a compound rtcp packet.
> Here is one of the ways to add it to rtcp_sender_unittest.cc :
> test::RtcpPacketParser doesn't worry about the order, so need a different
> parser. Something like that:
> const uint8_t* next_packet = data;
> while (next_packet < data+len) {
> RtcpCommonHeader header;
> ParseHeader(next_packet, &header);
> next_packet = next_packet + header.packet_size_bytes;
> bool is_last_packet = (data + len == next_packet);
> if (header.packet_type == kByeType) {
> EXPECT_TRUE(is_last_packet) << "Bye packet should be last in a compound
RTCP
> packet.";
> }
> }
>
> Create a MockTransport with pseudocode above in the mock of SendRtcp (check
> gmock). In your test recreate rtcp_sender_ with this MockTransport instead of
> TestTransport. Ensure test breaks before your change.
>
> Other than missing test just some style comments.
>
>
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
> File webrtc/modules/rtp_rtcp/source/rtcp_sender.cc (right):
>
>
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
> webrtc/modules/rtp_rtcp/source/rtcp_sender.cc:838:
> rtc::scoped_ptr<rtcp::RtcpPacket> packetWithBye = nullptr;
> Local variables use snake_case.
> This variable doesn't hold packet with bye, but instead bye packet itself, may
> be call it 'packet_bye' or 'bye_packet' or just 'bye'.
> Smart pointers do not require nullptr initialization.
>
>
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
> webrtc/modules/rtp_rtcp/source/rtcp_sender.cc:854: // if there is a BYE, don't
> append now - save it and append it
> Comments better be started with an Upper letter and end with a dot.
>
>
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
> webrtc/modules/rtp_rtcp/source/rtcp_sender.cc:857:
> packetWithBye.reset(packet.release());
> packetWithBye = std::move(packet); is a standard way to move a smart pointer
>
>
https://codereview.webrtc.org/1674963004/diff/1/webrtc/modules/rtp_rtcp/sourc...
> webrtc/modules/rtp_rtcp/source/rtcp_sender.cc:864: if (packetWithBye !=
nullptr)
> {
> "if (packetWithBye)" is preferred way to check if pointer holds something
Thanks for the review. I updated the source change per the review. I will add
unit test next.
https://codereview.webrtc.org/1674963004/diff/40001/webrtc/modules/rtp_rtcp/s... File webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc (right): https://codereview.webrtc.org/1674963004/diff/40001/webrtc/modules/rtp_rtcp/s... webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc:22: #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" Alphabetical order. https://codereview.webrtc.org/1674963004/diff/40001/webrtc/modules/rtp_rtcp/s... webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc:221: // This is a mock transport class which is solely used This mock is used in one test only, may be move it there. This way the main check (EXPECT_TRUE(is_last_packet)) would be inside the test. i.e. TEST_F(RtcpSenderTest, ByeMustBeLast) { class MockTransportExpectsByeIsLastInCompoundRtcpPacket : public Transport { ... } mock_transport; // Re-configure rtcp_sender_ with mock_transport rtcp_sender_.reset(new RTCPSender(..., &mock_transport)); ... or you can use gmock: #include "webrtc/test/mock_transport.h" using ::testing::_; using ::testing::ElementsAre; using ::testing::Invoke; ... TEST_F(RtcpSenderTest, ByeMustBeLast) { MockTransport mock_transport; EXPECT_CALL(mock_transport, SendRtcp(_, _)) .WillOnce(Invoke([](const uint8_t* data, size_t len) { const uint8_t* next_packet = data; ... return true; })); // Re-configure rtcp_sender_ with mock_transport rtcp_sender_.reset(new RTCPSender(..., &mock_transport)); https://codereview.webrtc.org/1674963004/diff/40001/webrtc/modules/rtp_rtcp/s... webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc:225: public NullRtpData { any reason to derive it from NullRtpData? https://codereview.webrtc.org/1674963004/diff/40001/webrtc/modules/rtp_rtcp/s... webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc:231: const PacketOptions& options) override { for consistency comment /*options*/ parameter too. https://codereview.webrtc.org/1674963004/diff/40001/webrtc/modules/rtp_rtcp/s... webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc:821: metric.lossRate = 1; Are VoIPMetric values have any meaning for this test? may be can remove them to make test shorter and concentrated on the bye packet. i.e. RTCPVoIPMetric metric; rtcp_sender_->SetRTCPVoIPMetrics(&metric);
lgtm
The CQ bit was checked by danilchap@webrtc.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1674963004/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1674963004/60001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm with comment removed https://codereview.webrtc.org/1674963004/diff/60001/webrtc/modules/rtp_rtcp/s... File webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc (right): https://codereview.webrtc.org/1674963004/diff/60001/webrtc/modules/rtp_rtcp/s... webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc:775: // details. I think we can remove the link to the bug, as this CL actually fixes the bug.
The CQ bit was checked by danilchap@webrtc.org
The patchset sent to the CQ was uploaded after l-g-t-m from danilchap@webrtc.org, stefan@webrtc.org Link to the patchset: https://codereview.webrtc.org/1674963004/#ps80001 (title: "Removed Comment")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1674963004/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1674963004/80001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_rel on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/android_rel/builds/11005)
The CQ bit was checked by pbos@webrtc.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1674963004/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1674963004/80001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_rel on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/android_rel/builds/11008)
Description was changed from ========== Always append the BYE packet type at the end When composing a RTCP packet, if there is a BYE to be appended, preserve it and append it at the end after all other packet types are added. BUG=webrtc:5498 ========== to ========== Always append the BYE packet type at the end When composing a RTCP packet, if there is a BYE to be appended, preserve it and append it at the end after all other packet types are added. BUG=webrtc:5498 NOTRY=true ==========
The CQ bit was checked by danilchap@webrtc.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1674963004/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1674963004/80001
Message was sent while issue was closed.
Description was changed from ========== Always append the BYE packet type at the end When composing a RTCP packet, if there is a BYE to be appended, preserve it and append it at the end after all other packet types are added. BUG=webrtc:5498 NOTRY=true ========== to ========== Always append the BYE packet type at the end When composing a RTCP packet, if there is a BYE to be appended, preserve it and append it at the end after all other packet types are added. BUG=webrtc:5498 NOTRY=true ==========
Message was sent while issue was closed.
Committed patchset #5 (id:80001)
Message was sent while issue was closed.
Description was changed from ========== Always append the BYE packet type at the end When composing a RTCP packet, if there is a BYE to be appended, preserve it and append it at the end after all other packet types are added. BUG=webrtc:5498 NOTRY=true ========== to ========== Always append the BYE packet type at the end When composing a RTCP packet, if there is a BYE to be appended, preserve it and append it at the end after all other packet types are added. BUG=webrtc:5498 NOTRY=true Committed: https://crrev.com/0e2e50ca1c83c9ad9ba61149fbcd704b514b3e13 Cr-Commit-Position: refs/heads/master@{#11672} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/0e2e50ca1c83c9ad9ba61149fbcd704b514b3e13 Cr-Commit-Position: refs/heads/master@{#11672} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
