~morphis/aethercast/audio-streaming

« back to all changes in this revision

Viewing changes to src/mcs/miracastsourceclient.h

  • Committer: CI Train Bot
  • Author(s): Simon Fels
  • Date: 2016-04-29 09:54:49 UTC
  • mfrom: (136.1.17 trunk)
  • Revision ID: ci-train-bot@canonical.com-20160429095449-diyen52l869w9siw
Various fixes and improvements for stability

* React on RTSP timeouts and disconnect when one happens
* Don't save state on shutdown as its already saved
* Implement state saving / property guards
* Implement proper dbus errors and fix spec
* Fix H264Encoder tests
* Implement backend logic for the Enabled property
* Add Enabled property for our manager interface
* Bring back resending of failed packets
* Handle error/terminate cases for buffer queue
Approved by: Alfonso Sanchez-Beato

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include "mcs/non_copyable.h"
35
35
#include "mcs/scoped_gobject.h"
36
36
 
 
37
#include "mcs/basesourcemediamanager.h"
 
38
 
37
39
namespace mcs {
38
40
class TimerCallbackData;
39
41
 
40
42
class MiracastSourceClient : public std::enable_shared_from_this<MiracastSourceClient>,
41
 
                             public wds::Peer::Delegate {
 
43
                             public wds::Peer::Delegate,
 
44
                             public wds::Peer::Observer,
 
45
                             public BaseSourceMediaManager::Delegate {
42
46
public:
43
47
    class Delegate : private mcs::NonCopyable {
44
48
    public:
52
56
    void SetDelegate(const std::weak_ptr<Delegate>& delegate);
53
57
    void ResetDelegate();
54
58
 
 
59
    void OnSourceNetworkError();
 
60
 
55
61
public:
56
62
    void SendRTSPData(const std::string &data) override;
57
63
    std::string GetLocalIPAddress() const override;
60
66
    int GetNextCSeq(int* initial_peer_cseq = nullptr) const override;
61
67
 
62
68
public:
 
69
    void ErrorOccurred(wds::ErrorType error) override;
 
70
    void SessionCompleted() override;
 
71
 
 
72
public:
63
73
    static gboolean OnTimeout(gpointer user_data);
64
74
    static void OnTimeoutRemove(gpointer user_data);
65
75
    static gboolean OnIncomingData(GSocket *socket, GIOCondition condition,
71
81
 
72
82
    void DumpRtsp(const std::string &prefix, const std::string &data);
73
83
    void ReleaseTimers();
 
84
    void NotifyConnectionClosed();
74
85
 
75
86
private:
76
87
    std::weak_ptr<Delegate> delegate_;
79
90
    mcs::IpV4Address local_address_;
80
91
    std::vector<guint> timers_;
81
92
    std::unique_ptr<wds::Source> source_;
82
 
    std::shared_ptr<wds::SourceMediaManager> media_manager_;
 
93
    std::shared_ptr<BaseSourceMediaManager> media_manager_;
83
94
    guint watch_;
84
95
 
85
96
    friend class TimerCallbackData;