Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 1347793005: Replace Atomic32 with webrtc/base/atomicops.h. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix typo Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include <algorithm> // max 10 #include <algorithm> // max
11 #include <vector> 11 #include <vector>
12 12
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 #include "webrtc/base/atomicops.h"
15 #include "webrtc/base/bind.h" 16 #include "webrtc/base/bind.h"
16 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
17 #include "webrtc/base/criticalsection.h" 18 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/scoped_ptr.h" 19 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/call.h" 20 #include "webrtc/call.h"
20 #include "webrtc/call/transport_adapter.h" 21 #include "webrtc/call/transport_adapter.h"
21 #include "webrtc/frame_callback.h" 22 #include "webrtc/frame_callback.h"
22 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" 23 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
23 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h" 24 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
24 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 } else { 577 } else {
577 // Increase next expected frame size. If testing with FEC, make sure 578 // Increase next expected frame size. If testing with FEC, make sure
578 // a FEC packet has been received for this frame size before 579 // a FEC packet has been received for this frame size before
579 // proceeding, to make sure that redundancy packets don't exceed 580 // proceeding, to make sure that redundancy packets don't exceed
580 // size limit. 581 // size limit.
581 if (!use_fec_) { 582 if (!use_fec_) {
582 ++current_size_rtp_; 583 ++current_size_rtp_;
583 } else if (fec_packet_received_) { 584 } else if (fec_packet_received_) {
584 fec_packet_received_ = false; 585 fec_packet_received_ = false;
585 ++current_size_rtp_; 586 ++current_size_rtp_;
586 ++current_size_frame_; 587 rtc::AtomicOps::Increment(&current_size_frame_);
587 } 588 }
588 } 589 }
589 } 590 }
590 591
591 return SEND_PACKET; 592 return SEND_PACKET;
592 } 593 }
593 594
594 void TriggerLossReport(const RTPHeader& header) { 595 void TriggerLossReport(const RTPHeader& header) {
595 // Send lossy receive reports to trigger FEC enabling. 596 // Send lossy receive reports to trigger FEC enabling.
596 if (packet_count_++ % 2 != 0) { 597 if (packet_count_++ % 2 != 0) {
(...skipping 10 matching lines...) Expand all
607 RTCPSender::FeedbackState feedback_state; 608 RTCPSender::FeedbackState feedback_state;
608 609
609 EXPECT_EQ(0, rtcp_sender.SendRTCP(feedback_state, kRtcpRr)); 610 EXPECT_EQ(0, rtcp_sender.SendRTCP(feedback_state, kRtcpRr));
610 } 611 }
611 } 612 }
612 613
613 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) { 614 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) {
614 // Increase frame size for next encoded frame, in the context of the 615 // Increase frame size for next encoded frame, in the context of the
615 // encoder thread. 616 // encoder thread.
616 if (!use_fec_ && 617 if (!use_fec_ &&
617 current_size_frame_.Value() < static_cast<int32_t>(stop_size_)) { 618 rtc::AtomicOps::AcquireLoad(&current_size_frame_) <
618 ++current_size_frame_; 619 static_cast<int32_t>(stop_size_)) {
620 rtc::AtomicOps::Increment(&current_size_frame_);
619 } 621 }
620 encoder_.SetFrameSize(static_cast<size_t>(current_size_frame_.Value())); 622 encoder_.SetFrameSize(static_cast<size_t>(
623 rtc::AtomicOps::AcquireLoad(&current_size_frame_)));
621 } 624 }
622 625
623 Call::Config GetSenderCallConfig() override { 626 Call::Config GetSenderCallConfig() override {
624 Call::Config config; 627 Call::Config config;
625 const int kMinBitrateBps = 30000; 628 const int kMinBitrateBps = 30000;
626 config.bitrate_config.min_bitrate_bps = kMinBitrateBps; 629 config.bitrate_config.min_bitrate_bps = kMinBitrateBps;
627 return config; 630 return config;
628 } 631 }
629 632
630 void ModifyConfigs(VideoSendStream::Config* send_config, 633 void ModifyConfigs(VideoSendStream::Config* send_config,
(...skipping 28 matching lines...) Expand all
659 const size_t stop_size_; 662 const size_t stop_size_;
660 const bool test_generic_packetization_; 663 const bool test_generic_packetization_;
661 const bool use_fec_; 664 const bool use_fec_;
662 665
663 uint32_t packet_count_; 666 uint32_t packet_count_;
664 size_t accumulated_size_; 667 size_t accumulated_size_;
665 size_t accumulated_payload_; 668 size_t accumulated_payload_;
666 bool fec_packet_received_; 669 bool fec_packet_received_;
667 670
668 size_t current_size_rtp_; 671 size_t current_size_rtp_;
669 Atomic32 current_size_frame_; 672 volatile int current_size_frame_;
670 }; 673 };
671 674
672 // Don't auto increment if FEC is used; continue sending frame size until 675 // Don't auto increment if FEC is used; continue sending frame size until
673 // a FEC packet has been received. 676 // a FEC packet has been received.
674 FrameFragmentationTest test( 677 FrameFragmentationTest test(
675 kMaxPacketSize, start, stop, format == kGeneric, with_fec); 678 kMaxPacketSize, start, stop, format == kGeneric, with_fec);
676 679
677 RunBaseTest(&test); 680 RunBaseTest(&test);
678 } 681 }
679 682
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 EXPECT_TRUE(vp9videoHeader->flexible_mode); 1901 EXPECT_TRUE(vp9videoHeader->flexible_mode);
1899 observation_complete_->Set(); 1902 observation_complete_->Set();
1900 } 1903 }
1901 1904
1902 } test; 1905 } test;
1903 1906
1904 RunBaseTest(&test); 1907 RunBaseTest(&test);
1905 } 1908 }
1906 1909
1907 } // namespace webrtc 1910 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698