Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et tw=80 : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef RtspControllerChild_h
8 #define RtspControllerChild_h
10 #include "mozilla/net/PRtspControllerChild.h"
11 #include "nsIStreamingProtocolController.h"
12 #include "nsIChannel.h"
13 #include "nsCOMPtr.h"
14 #include "nsString.h"
15 #include "nsTArray.h"
16 #include "mozilla/net/RtspChannelChild.h"
18 namespace mozilla {
19 namespace net {
21 class RtspControllerChild : public nsIStreamingProtocolController
22 , public nsIStreamingProtocolListener
23 , public PRtspControllerChild
24 {
25 public:
26 NS_DECL_THREADSAFE_ISUPPORTS
27 NS_DECL_NSISTREAMINGPROTOCOLCONTROLLER
28 NS_DECL_NSISTREAMINGPROTOCOLLISTENER
30 RtspControllerChild(nsIChannel *channel);
31 ~RtspControllerChild();
33 bool RecvOnConnected(const uint8_t& index,
34 const InfallibleTArray<RtspMetadataParam>& meta);
36 bool RecvOnMediaDataAvailable(
37 const uint8_t& index,
38 const nsCString& data,
39 const uint32_t& length,
40 const uint32_t& offset,
41 const InfallibleTArray<RtspMetadataParam>& meta);
43 bool RecvOnDisconnected(const uint8_t& index,
44 const nsresult& reason);
46 bool RecvAsyncOpenFailed(const nsresult& reason);
47 void AddIPDLReference();
48 void ReleaseIPDLReference();
49 void AddMetaData(already_AddRefed<nsIStreamingProtocolMetaData>&& meta);
50 int GetMetaDataLength();
51 bool OKToSendIPC();
52 void AllowIPC();
53 void DisallowIPC();
55 private:
56 bool mIPCOpen;
57 // The intention of this variable is just to avoid any IPC message to be sent
58 // when this flag is set as false. Nothing more.
59 bool mIPCAllowed;
60 // Dummy channel used to aid MediaResource creation in HTMLMediaElement.
61 nsCOMPtr<nsIChannel> mChannel;
62 // The nsIStreamingProtocolListener implementation.
63 nsCOMPtr<nsIStreamingProtocolListener> mListener;
64 // RTSP URL refer to a stream or an aggregate of streams.
65 nsCOMPtr<nsIURI> mURI;
66 // Array refer to metadata of the media stream.
67 nsTArray<nsCOMPtr<nsIStreamingProtocolMetaData>> mMetaArray;
68 // ASCII encoded URL spec
69 nsCString mSpec;
70 // The total tracks for the given media stream session.
71 uint32_t mTotalTracks;
72 // Current suspension depth for this channel object
73 uint32_t mSuspendCount;
74 // Detach channel-controller relationship.
75 void ReleaseChannel();
76 };
77 } // namespace net
78 } // namespace mozilla
80 #endif // RtspControllerChild_h