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

Side by Side Diff: talk/media/base/mediachannel.h

Issue 1363573002: Wire up transport sequence number / send time callbacks to webrtc via libjingle. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Connect to SignalSentPacket when enabling bundle. 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 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 enum DtmfFlags { 516 enum DtmfFlags {
517 DF_PLAY = 0x01, 517 DF_PLAY = 0x01,
518 DF_SEND = 0x02, 518 DF_SEND = 0x02,
519 }; 519 };
520 520
521 class MediaChannel : public sigslot::has_slots<> { 521 class MediaChannel : public sigslot::has_slots<> {
522 public: 522 public:
523 class NetworkInterface { 523 class NetworkInterface {
524 public: 524 public:
525 enum SocketType { ST_RTP, ST_RTCP }; 525 enum SocketType { ST_RTP, ST_RTCP };
526 virtual bool SendPacket( 526 virtual bool SendPacket(rtc::Buffer* packet,
527 rtc::Buffer* packet, 527 const rtc::PacketOptions& options) = 0;
528 rtc::DiffServCodePoint dscp = rtc::DSCP_NO_CHANGE) = 0; 528 virtual bool SendRtcp(rtc::Buffer* packet,
529 virtual bool SendRtcp( 529 const rtc::PacketOptions& options) = 0;
530 rtc::Buffer* packet,
531 rtc::DiffServCodePoint dscp = rtc::DSCP_NO_CHANGE) = 0;
532 virtual int SetOption(SocketType type, rtc::Socket::Option opt, 530 virtual int SetOption(SocketType type, rtc::Socket::Option opt,
533 int option) = 0; 531 int option) = 0;
534 virtual ~NetworkInterface() {} 532 virtual ~NetworkInterface() {}
535 }; 533 };
536 534
537 MediaChannel() : network_interface_(NULL) {} 535 MediaChannel() : network_interface_(NULL) {}
538 virtual ~MediaChannel() {} 536 virtual ~MediaChannel() {}
539 537
540 // Sets the abstract interface class for sending RTP/RTCP data. 538 // Sets the abstract interface class for sending RTP/RTCP data.
541 virtual void SetInterface(NetworkInterface *iface) { 539 virtual void SetInterface(NetworkInterface *iface) {
(...skipping 23 matching lines...) Expand all
565 // ssrc must be the first SSRC of the media stream if the stream uses 563 // ssrc must be the first SSRC of the media stream if the stream uses
566 // multiple SSRCs. 564 // multiple SSRCs.
567 virtual bool RemoveRecvStream(uint32_t ssrc) = 0; 565 virtual bool RemoveRecvStream(uint32_t ssrc) = 0;
568 566
569 // Returns the absoulte sendtime extension id value from media channel. 567 // Returns the absoulte sendtime extension id value from media channel.
570 virtual int GetRtpSendTimeExtnId() const { 568 virtual int GetRtpSendTimeExtnId() const {
571 return -1; 569 return -1;
572 } 570 }
573 571
574 // Base method to send packet using NetworkInterface. 572 // Base method to send packet using NetworkInterface.
575 bool SendPacket(rtc::Buffer* packet) { 573 bool SendPacket(rtc::Buffer* packet, const rtc::PacketOptions& options) {
576 return DoSendPacket(packet, false); 574 return DoSendPacket(packet, false, options);
577 } 575 }
578 576
579 bool SendRtcp(rtc::Buffer* packet) { 577 bool SendRtcp(rtc::Buffer* packet, const rtc::PacketOptions& options) {
580 return DoSendPacket(packet, true); 578 return DoSendPacket(packet, true, options);
581 } 579 }
582 580
583 int SetOption(NetworkInterface::SocketType type, 581 int SetOption(NetworkInterface::SocketType type,
584 rtc::Socket::Option opt, 582 rtc::Socket::Option opt,
585 int option) { 583 int option) {
586 rtc::CritScope cs(&network_interface_crit_); 584 rtc::CritScope cs(&network_interface_crit_);
587 if (!network_interface_) 585 if (!network_interface_)
588 return -1; 586 return -1;
589 587
590 return network_interface_->SetOption(type, opt, option); 588 return network_interface_->SetOption(type, opt, option);
591 } 589 }
592 590
593 protected: 591 protected:
594 // This method sets DSCP |value| on both RTP and RTCP channels. 592 // This method sets DSCP |value| on both RTP and RTCP channels.
595 int SetDscp(rtc::DiffServCodePoint value) { 593 int SetDscp(rtc::DiffServCodePoint value) {
596 int ret; 594 int ret;
597 ret = SetOption(NetworkInterface::ST_RTP, 595 ret = SetOption(NetworkInterface::ST_RTP,
598 rtc::Socket::OPT_DSCP, 596 rtc::Socket::OPT_DSCP,
599 value); 597 value);
600 if (ret == 0) { 598 if (ret == 0) {
601 ret = SetOption(NetworkInterface::ST_RTCP, 599 ret = SetOption(NetworkInterface::ST_RTCP,
602 rtc::Socket::OPT_DSCP, 600 rtc::Socket::OPT_DSCP,
603 value); 601 value);
604 } 602 }
605 return ret; 603 return ret;
606 } 604 }
607 605
608 private: 606 private:
609 bool DoSendPacket(rtc::Buffer* packet, bool rtcp) { 607 bool DoSendPacket(rtc::Buffer* packet,
608 bool rtcp,
609 const rtc::PacketOptions& options) {
610 rtc::CritScope cs(&network_interface_crit_); 610 rtc::CritScope cs(&network_interface_crit_);
611 if (!network_interface_) 611 if (!network_interface_)
612 return false; 612 return false;
613 613
614 return (!rtcp) ? network_interface_->SendPacket(packet) : 614 return (!rtcp) ? network_interface_->SendPacket(packet, options)
615 network_interface_->SendRtcp(packet); 615 : network_interface_->SendRtcp(packet, options);
616 } 616 }
617 617
618 // |network_interface_| can be accessed from the worker_thread and 618 // |network_interface_| can be accessed from the worker_thread and
619 // from any MediaEngine threads. This critical section is to protect accessing 619 // from any MediaEngine threads. This critical section is to protect accessing
620 // of network_interface_ object. 620 // of network_interface_ object.
621 rtc::CriticalSection network_interface_crit_; 621 rtc::CriticalSection network_interface_crit_;
622 NetworkInterface* network_interface_; 622 NetworkInterface* network_interface_;
623 }; 623 };
624 624
625 enum SendFlags { 625 enum SendFlags {
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 // Signal when the media channel is ready to send the stream. Arguments are: 1281 // Signal when the media channel is ready to send the stream. Arguments are:
1282 // writable(bool) 1282 // writable(bool)
1283 sigslot::signal1<bool> SignalReadyToSend; 1283 sigslot::signal1<bool> SignalReadyToSend;
1284 // Signal for notifying that the remote side has closed the DataChannel. 1284 // Signal for notifying that the remote side has closed the DataChannel.
1285 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; 1285 sigslot::signal1<uint32_t> SignalStreamClosedRemotely;
1286 }; 1286 };
1287 1287
1288 } // namespace cricket 1288 } // namespace cricket
1289 1289
1290 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ 1290 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698