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

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

Issue 1984983002: Remove use of RtpHeaderExtension and clean up (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed nit Created 4 years, 7 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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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
11 #ifndef WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ 11 #ifndef WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_
12 #define WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ 12 #define WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/api/rtpparameters.h" 18 #include "webrtc/api/rtpparameters.h"
19 #include "webrtc/base/basictypes.h" 19 #include "webrtc/base/basictypes.h"
20 #include "webrtc/base/buffer.h" 20 #include "webrtc/base/buffer.h"
21 #include "webrtc/base/copyonwritebuffer.h" 21 #include "webrtc/base/copyonwritebuffer.h"
22 #include "webrtc/base/dscp.h" 22 #include "webrtc/base/dscp.h"
23 #include "webrtc/base/logging.h" 23 #include "webrtc/base/logging.h"
24 #include "webrtc/base/networkroute.h" 24 #include "webrtc/base/networkroute.h"
25 #include "webrtc/base/optional.h" 25 #include "webrtc/base/optional.h"
26 #include "webrtc/base/sigslot.h" 26 #include "webrtc/base/sigslot.h"
27 #include "webrtc/base/socket.h" 27 #include "webrtc/base/socket.h"
28 #include "webrtc/base/window.h" 28 #include "webrtc/base/window.h"
29 #include "webrtc/config.h"
29 #include "webrtc/media/base/codec.h" 30 #include "webrtc/media/base/codec.h"
30 #include "webrtc/media/base/mediaconstants.h" 31 #include "webrtc/media/base/mediaconstants.h"
31 #include "webrtc/media/base/streamparams.h" 32 #include "webrtc/media/base/streamparams.h"
32 #include "webrtc/media/base/videosinkinterface.h" 33 #include "webrtc/media/base/videosinkinterface.h"
33 #include "webrtc/media/base/videosourceinterface.h" 34 #include "webrtc/media/base/videosourceinterface.h"
34 // TODO(juberti): re-evaluate this include 35 // TODO(juberti): re-evaluate this include
35 #include "webrtc/pc/audiomonitor.h" 36 #include "webrtc/pc/audiomonitor.h"
36 37
37 namespace rtc { 38 namespace rtc {
38 class RateLimiter; 39 class RateLimiter;
39 class Timing; 40 class Timing;
40 } 41 }
41 42
42 namespace webrtc { 43 namespace webrtc {
43 class AudioSinkInterface; 44 class AudioSinkInterface;
44 } 45 }
45 46
46 namespace cricket { 47 namespace cricket {
47 48
48 class AudioSource; 49 class AudioSource;
49 class ScreencastId; 50 class ScreencastId;
50 class VideoCapturer; 51 class VideoCapturer;
51 class VideoFrame; 52 class VideoFrame;
52 struct RtpHeader; 53 struct RtpHeader;
53 struct VideoFormat; 54 struct VideoFormat;
54 55
55 const int kMinRtpHeaderExtensionId = 1;
56 const int kMaxRtpHeaderExtensionId = 255;
57 const int kScreencastDefaultFps = 5; 56 const int kScreencastDefaultFps = 5;
58 57
59 template <class T> 58 template <class T>
60 static std::string ToStringIfSet(const char* key, const rtc::Optional<T>& val) { 59 static std::string ToStringIfSet(const char* key, const rtc::Optional<T>& val) {
61 std::string str; 60 std::string str;
62 if (val) { 61 if (val) {
63 str = key; 62 str = key;
64 str += ": "; 63 str += ": ";
65 str += val ? rtc::ToString(*val) : ""; 64 str += val ? rtc::ToString(*val) : "";
66 str += ", "; 65 str += ", ";
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 313
315 private: 314 private:
316 template <typename T> 315 template <typename T>
317 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) { 316 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) {
318 if (o) { 317 if (o) {
319 *s = o; 318 *s = o;
320 } 319 }
321 } 320 }
322 }; 321 };
323 322
324 struct RtpHeaderExtension {
325 RtpHeaderExtension() : id(0) {}
326 RtpHeaderExtension(const std::string& u, int i) : uri(u), id(i) {}
327
328 bool operator==(const RtpHeaderExtension& ext) const {
329 // id is a reserved word in objective-c. Therefore the id attribute has to
330 // be a fully qualified name in order to compile on IOS.
331 return this->id == ext.id &&
332 uri == ext.uri;
333 }
334
335 std::string ToString() const {
336 std::ostringstream ost;
337 ost << "{";
338 ost << "uri: " << uri;
339 ost << ", id: " << id;
340 ost << "}";
341 return ost.str();
342 }
343
344 std::string uri;
345 int id;
346 // TODO(juberti): SendRecv direction;
347 };
348
349 // Returns the named header extension if found among all extensions, NULL
350 // otherwise.
351 inline const RtpHeaderExtension* FindHeaderExtension(
352 const std::vector<RtpHeaderExtension>& extensions,
353 const std::string& name) {
354 for (std::vector<RtpHeaderExtension>::const_iterator it = extensions.begin();
355 it != extensions.end(); ++it) {
356 if (it->uri == name)
357 return &(*it);
358 }
359 return NULL;
360 }
361
362 class MediaChannel : public sigslot::has_slots<> { 323 class MediaChannel : public sigslot::has_slots<> {
363 public: 324 public:
364 class NetworkInterface { 325 class NetworkInterface {
365 public: 326 public:
366 enum SocketType { ST_RTP, ST_RTCP }; 327 enum SocketType { ST_RTP, ST_RTCP };
367 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet, 328 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet,
368 const rtc::PacketOptions& options) = 0; 329 const rtc::PacketOptions& options) = 0;
369 virtual bool SendRtcp(rtc::CopyOnWriteBuffer* packet, 330 virtual bool SendRtcp(rtc::CopyOnWriteBuffer* packet,
370 const rtc::PacketOptions& options) = 0; 331 const rtc::PacketOptions& options) = 0;
371 virtual int SetOption(SocketType type, rtc::Socket::Option opt, 332 virtual int SetOption(SocketType type, rtc::Socket::Option opt,
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 virtual std::string ToString() const { 796 virtual std::string ToString() const {
836 std::ostringstream ost; 797 std::ostringstream ost;
837 ost << "{"; 798 ost << "{";
838 ost << "codecs: " << VectorToString(codecs) << ", "; 799 ost << "codecs: " << VectorToString(codecs) << ", ";
839 ost << "extensions: " << VectorToString(extensions); 800 ost << "extensions: " << VectorToString(extensions);
840 ost << "}"; 801 ost << "}";
841 return ost.str(); 802 return ost.str();
842 } 803 }
843 804
844 std::vector<Codec> codecs; 805 std::vector<Codec> codecs;
845 std::vector<RtpHeaderExtension> extensions; 806 std::vector<webrtc::RtpExtension> extensions;
846 // TODO(pthatcher): Add streams. 807 // TODO(pthatcher): Add streams.
847 RtcpParameters rtcp; 808 RtcpParameters rtcp;
848 virtual ~RtpParameters() = default; 809 virtual ~RtpParameters() = default;
849 }; 810 };
850 811
851 // TODO(deadbeef): Rename to RtpSenderParameters, since they're intended to 812 // TODO(deadbeef): Rename to RtpSenderParameters, since they're intended to
852 // encapsulate all the parameters needed for an RtpSender. 813 // encapsulate all the parameters needed for an RtpSender.
853 template <class Codec> 814 template <class Codec>
854 struct RtpSendParameters : RtpParameters<Codec> { 815 struct RtpSendParameters : RtpParameters<Codec> {
855 std::string ToString() const override { 816 std::string ToString() const override {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 // Signal when the media channel is ready to send the stream. Arguments are: 1104 // Signal when the media channel is ready to send the stream. Arguments are:
1144 // writable(bool) 1105 // writable(bool)
1145 sigslot::signal1<bool> SignalReadyToSend; 1106 sigslot::signal1<bool> SignalReadyToSend;
1146 // Signal for notifying that the remote side has closed the DataChannel. 1107 // Signal for notifying that the remote side has closed the DataChannel.
1147 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; 1108 sigslot::signal1<uint32_t> SignalStreamClosedRemotely;
1148 }; 1109 };
1149 1110
1150 } // namespace cricket 1111 } // namespace cricket
1151 1112
1152 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ 1113 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698