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

Commit 682d5593 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Optionally log the transport stream transmitted to the sink." into jb-mr1-dev

parents 6524b7e1 774df0dc
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);