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

Side by Side Diff: webrtc/modules/audio_coding/neteq/test/RTPencode.cc

Issue 1168753002: Match existing type usage better. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Attempted test fix Created 5 years, 6 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 10
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 } else { 636 } else {
637 // tone has ended 637 // tone has ended
638 makeRTPheader(rtp_data, NETEQ_CODEC_AVT_PT, seqNo, DTMFtimestamp, ssrc); 638 makeRTPheader(rtp_data, NETEQ_CODEC_AVT_PT, seqNo, DTMFtimestamp, ssrc);
639 enc_len = makeDTMFpayload(&rtp_data[12], NTone % 12, 1, 4, 639 enc_len = makeDTMFpayload(&rtp_data[12], NTone % 12, 1, 4,
640 DTMF_DURATION * (fs / 1000)); 640 DTMF_DURATION * (fs / 1000));
641 NTone++; 641 NTone++;
642 DTMFfirst = 1; 642 DTMFfirst = 1;
643 } 643 }
644 644
645 /* write RTP packet to file */ 645 /* write RTP packet to file */
646 length = htons(12 + enc_len + 8); 646 length = htons(static_cast<unsigned short>(12 + enc_len + 8));
647 plen = htons(12 + enc_len); 647 plen = htons(static_cast<unsigned short>(12 + enc_len));
648 offset = (uint32_t)sendtime; //(timestamp/(fs/1000)); 648 offset = (uint32_t)sendtime; //(timestamp/(fs/1000));
649 offset = htonl(offset); 649 offset = htonl(offset);
650 if (fwrite(&length, 2, 1, out_file) != 1) { 650 if (fwrite(&length, 2, 1, out_file) != 1) {
651 return -1; 651 return -1;
652 } 652 }
653 if (fwrite(&plen, 2, 1, out_file) != 1) { 653 if (fwrite(&plen, 2, 1, out_file) != 1) {
654 return -1; 654 return -1;
655 } 655 }
656 if (fwrite(&offset, 4, 1, out_file) != 1) { 656 if (fwrite(&offset, 4, 1, out_file) != 1) {
657 return -1; 657 return -1;
(...skipping 30 matching lines...) Expand all
688 } 688 }
689 #endif 689 #endif
690 690
691 if (enc_len > 0 && 691 if (enc_len > 0 &&
692 (sendtime <= STOPSENDTIME || sendtime > RESTARTSENDTIME)) { 692 (sendtime <= STOPSENDTIME || sendtime > RESTARTSENDTIME)) {
693 if (useRed) { 693 if (useRed) {
694 if (red_len[0] > 0) { 694 if (red_len[0] > 0) {
695 memmove(&rtp_data[RTPheaderLen + red_len[0]], &rtp_data[12], enc_len); 695 memmove(&rtp_data[RTPheaderLen + red_len[0]], &rtp_data[12], enc_len);
696 memcpy(&rtp_data[RTPheaderLen], red_data, red_len[0]); 696 memcpy(&rtp_data[RTPheaderLen], red_data, red_len[0]);
697 697
698 red_len[1] = enc_len; 698 red_len[1] = static_cast<uint16_t>(enc_len);
699 red_TS[1] = timestamp; 699 red_TS[1] = timestamp;
700 if (vad) 700 if (vad)
701 red_PT[1] = payloadType; 701 red_PT[1] = payloadType;
702 else 702 else
703 red_PT[1] = NETEQ_CODEC_CN_PT; 703 red_PT[1] = NETEQ_CODEC_CN_PT;
704 704
705 makeRedundantHeader(rtp_data, red_PT, 2, red_TS, red_len, seqNo++, 705 makeRedundantHeader(rtp_data, red_PT, 2, red_TS, red_len, seqNo++,
706 ssrc); 706 ssrc);
707 707
708 enc_len += red_len[0] + RTPheaderLen - 12; 708 enc_len += red_len[0] + RTPheaderLen - 12;
709 } else { // do not use redundancy payload for this packet, i.e., only 709 } else { // do not use redundancy payload for this packet, i.e., only
710 // last payload 710 // last payload
711 memmove(&rtp_data[RTPheaderLen - 4], &rtp_data[12], enc_len); 711 memmove(&rtp_data[RTPheaderLen - 4], &rtp_data[12], enc_len);
712 // memcpy(&rtp_data[RTPheaderLen], red_data, red_len[0]); 712 // memcpy(&rtp_data[RTPheaderLen], red_data, red_len[0]);
713 713
714 red_len[1] = enc_len; 714 red_len[1] = static_cast<uint16_t>(enc_len);
715 red_TS[1] = timestamp; 715 red_TS[1] = timestamp;
716 if (vad) 716 if (vad)
717 red_PT[1] = payloadType; 717 red_PT[1] = payloadType;
718 else 718 else
719 red_PT[1] = NETEQ_CODEC_CN_PT; 719 red_PT[1] = NETEQ_CODEC_CN_PT;
720 720
721 makeRedundantHeader(rtp_data, red_PT, 2, red_TS, red_len, seqNo++, 721 makeRedundantHeader(rtp_data, red_PT, 2, red_TS, red_len, seqNo++,
722 ssrc); 722 ssrc);
723 723
724 enc_len += red_len[0] + RTPheaderLen - 4 - 724 enc_len += red_len[0] + RTPheaderLen - 4 -
725 12; // 4 is length of redundancy header (not used) 725 12; // 4 is length of redundancy header (not used)
726 } 726 }
727 } else { 727 } else {
728 /* make RTP header */ 728 /* make RTP header */
729 if (vad) // regular speech data 729 if (vad) // regular speech data
730 makeRTPheader(rtp_data, payloadType, seqNo++, timestamp, ssrc); 730 makeRTPheader(rtp_data, payloadType, seqNo++, timestamp, ssrc);
731 else // CNG data 731 else // CNG data
732 makeRTPheader(rtp_data, NETEQ_CODEC_CN_PT, seqNo++, timestamp, ssrc); 732 makeRTPheader(rtp_data, NETEQ_CODEC_CN_PT, seqNo++, timestamp, ssrc);
733 } 733 }
734 #ifdef MULTIPLE_SAME_TIMESTAMP 734 #ifdef MULTIPLE_SAME_TIMESTAMP
735 int mult_pack = 0; 735 int mult_pack = 0;
736 do { 736 do {
737 #endif // MULTIPLE_SAME_TIMESTAMP 737 #endif // MULTIPLE_SAME_TIMESTAMP
738 /* write RTP packet to file */ 738 /* write RTP packet to file */
739 length = htons(12 + enc_len + 8); 739 length = htons(static_cast<unsigned short>(12 + enc_len + 8));
740 plen = htons(12 + enc_len); 740 plen = htons(static_cast<unsigned short>(12 + enc_len));
741 offset = (uint32_t)sendtime; 741 offset = (uint32_t)sendtime;
742 //(timestamp/(fs/1000)); 742 //(timestamp/(fs/1000));
743 offset = htonl(offset); 743 offset = htonl(offset);
744 if (fwrite(&length, 2, 1, out_file) != 1) { 744 if (fwrite(&length, 2, 1, out_file) != 1) {
745 return -1; 745 return -1;
746 } 746 }
747 if (fwrite(&plen, 2, 1, out_file) != 1) { 747 if (fwrite(&plen, 2, 1, out_file) != 1) {
748 return -1; 748 return -1;
749 } 749 }
750 if (fwrite(&offset, 4, 1, out_file) != 1) { 750 if (fwrite(&offset, 4, 1, out_file) != 1) {
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 memmove(ptrL + stride, ptrL, ptrR - ptrL); 1876 memmove(ptrL + stride, ptrL, ptrR - ptrL);
1877 1877
1878 // copy from temp to left pointer 1878 // copy from temp to left pointer
1879 memcpy(ptrL, temp, stride); 1879 memcpy(ptrL, temp, stride);
1880 1880
1881 // advance pointers 1881 // advance pointers
1882 ptrL += stride * 2; 1882 ptrL += stride * 2;
1883 ptrR += stride; 1883 ptrR += stride;
1884 } 1884 }
1885 } 1885 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698