Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 774df0dc authored by Andreas Huber's avatar Andreas Huber
Browse files

Optionally log the transport stream transmitted to the sink.

Change-Id: I5d392e7997d6beb09ba6eca70d6899747098d2b3
parent 2f9a4410
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -132,8 +132,16 @@ WifiDisplaySource::PlaybackSession::PlaybackSession(
      mNumSRsSent(0),
      mSendSRPending(false),
      mFirstPacketTimeUs(-1ll),
      mHistoryLength(0) {
      mHistoryLength(0)
#if LOG_TRANSPORT_STREAM
      ,mLogFile(NULL)
#endif
{
    mTSQueue->setRange(0, 12);

#if LOG_TRANSPORT_STREAM
    mLogFile = fopen("/system/etc/log.ts", "wb");
#endif
}

status_t WifiDisplaySource::PlaybackSession::init(
@@ -215,6 +223,13 @@ status_t WifiDisplaySource::PlaybackSession::init(
}

WifiDisplaySource::PlaybackSession::~PlaybackSession() {
#if LOG_TRANSPORT_STREAM
    if (mLogFile != NULL) {
        fclose(mLogFile);
        mLogFile = NULL;
    }
#endif

    mTracks.clear();

    if (mCodecLooper != NULL) {
@@ -470,6 +485,12 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived(
                                true /* timeDiscontinuity */,
                                lastTSPacket /* flush */);
                    }

#if LOG_TRANSPORT_STREAM
                    if (mLogFile != NULL) {
                        fwrite(packets->data(), 1, packets->size(), mLogFile);
                    }
#endif
                }
            } else if (what == Converter::kWhatEOS) {
                CHECK_EQ(what, Converter::kWhatEOS);
+6 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ struct ABuffer;
struct Serializer;
struct TSPacketizer;

#define LOG_TRANSPORT_STREAM    0

// Encapsulates the state of an RTP/RTCP session in the context of wifi
// display.
struct WifiDisplaySource::PlaybackSession : public AHandler {
@@ -111,6 +113,10 @@ private:
    List<sp<ABuffer> > mHistory;
    size_t mHistoryLength;

#if LOG_TRANSPORT_STREAM
    FILE *mLogFile;
#endif

    void onSendSR();
    void addSR(const sp<ABuffer> &buffer);
    void addSDES(const sp<ABuffer> &buffer);