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

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 comments 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 309
311 private: 310 private:
312 template <typename T> 311 template <typename T>
313 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) { 312 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) {
314 if (o) { 313 if (o) {
315 *s = o; 314 *s = o;
316 } 315 }
317 } 316 }
318 }; 317 };
319 318
320 struct RtpHeaderExtension {
321 RtpHeaderExtension() : id(0) {}
322 RtpHeaderExtension(const std::string& u, int i) : uri(u), id(i) {}
323
324 bool operator==(const RtpHeaderExtension& ext) const {
325 // id is a reserved word in objective-c. Therefore the id attribute has to
326 // be a fully qualified name in order to compile on IOS.
327 return this->id == ext.id &&
328 uri == ext.uri;
329 }
330
331 std::string ToString() const {
332 std::ostringstream ost;
333 ost << "{";
334 ost << "uri: " << uri;
335 ost << ", id: " << id;
336 ost << "}";
337 return ost.str();
338 }
339
340 std::string uri;
341 int id;
342 // TODO(juberti): SendRecv direction;
343 };
344
345 // Returns the named header extension if found among all extensions, NULL
346 // otherwise.
347 inline const RtpHeaderExtension* FindHeaderExtension(
348 const std::vector<RtpHeaderExtension>& extensions,
349 const std::string& name) {
350 for (std::vector<RtpHeaderExtension>::const_iterator it = extensions.begin();
351 it != extensions.end(); ++it) {
352 if (it->uri == name)
353 return &(*it);
354 }
355 return NULL;
356 }
357
358 class MediaChannel : public sigslot::has_slots<> { 319 class MediaChannel : public sigslot::has_slots<> {
359 public: 320 public:
360 class NetworkInterface { 321 class NetworkInterface {
361 public: 322 public:
362 enum SocketType { ST_RTP, ST_RTCP }; 323 enum SocketType { ST_RTP, ST_RTCP };
363 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet, 324 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet,
364 const rtc::PacketOptions& options) = 0; 325 const rtc::PacketOptions& options) = 0;
365 virtual bool SendRtcp(rtc::CopyOnWriteBuffer* packet, 326 virtual bool SendRtcp(rtc::CopyOnWriteBuffer* packet,
366 const rtc::PacketOptions& options) = 0; 327 const rtc::PacketOptions& options) = 0;
367 virtual int SetOption(SocketType type, rtc::Socket::Option opt, 328 virtual int SetOption(SocketType type, rtc::Socket::Option opt,
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 virtual std::string ToString() const { 792 virtual std::string ToString() const {
832 std::ostringstream ost; 793 std::ostringstream ost;
833 ost << "{"; 794 ost << "{";
834 ost << "codecs: " << VectorToString(codecs) << ", "; 795 ost << "codecs: " << VectorToString(codecs) << ", ";
835 ost << "extensions: " << VectorToString(extensions); 796 ost << "extensions: " << VectorToString(extensions);
836 ost << "}"; 797 ost << "}";
837 return ost.str(); 798 return ost.str();
838 } 799 }
839 800
840 std::vector<Codec> codecs; 801 std::vector<Codec> codecs;
841 std::vector<RtpHeaderExtension> extensions; 802 std::vector<webrtc::RtpExtension> extensions;
842 // TODO(pthatcher): Add streams. 803 // TODO(pthatcher): Add streams.
843 RtcpParameters rtcp; 804 RtcpParameters rtcp;
844 virtual ~RtpParameters() = default; 805 virtual ~RtpParameters() = default;
845 }; 806 };
846 807
847 // TODO(deadbeef): Rename to RtpSenderParameters, since they're intended to 808 // TODO(deadbeef): Rename to RtpSenderParameters, since they're intended to
848 // encapsulate all the parameters needed for an RtpSender. 809 // encapsulate all the parameters needed for an RtpSender.
849 template <class Codec> 810 template <class Codec>
850 struct RtpSendParameters : RtpParameters<Codec> { 811 struct RtpSendParameters : RtpParameters<Codec> {
851 std::string ToString() const override { 812 std::string ToString() const override {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 // Signal when the media channel is ready to send the stream. Arguments are: 1088 // Signal when the media channel is ready to send the stream. Arguments are:
1128 // writable(bool) 1089 // writable(bool)
1129 sigslot::signal1<bool> SignalReadyToSend; 1090 sigslot::signal1<bool> SignalReadyToSend;
1130 // Signal for notifying that the remote side has closed the DataChannel. 1091 // Signal for notifying that the remote side has closed the DataChannel.
1131 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; 1092 sigslot::signal1<uint32_t> SignalStreamClosedRemotely;
1132 }; 1093 };
1133 1094
1134 } // namespace cricket 1095 } // namespace cricket
1135 1096
1136 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ 1097 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698