Skip to content

Commit d274706

Browse files
committed
Additional logging in Htsp DataSource and Extractor
1 parent a76acfe commit d274706

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

app/src/main/java/ie/macinnes/tvheadend/player/HtspDataSource.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public HtspDataSource createDataSource() {
7878

7979
public HtspDataSource(Context context, SimpleHtspConnection connection, String streamProfile) {
8080
Log.d(TAG, "New HtspDataSource instantiated");
81+
8182
mContext = context;
8283
mConnection = connection;
8384
mStreamProfile = streamProfile;
@@ -92,6 +93,7 @@ public HtspDataSource(Context context, SimpleHtspConnection connection, String s
9293
// DataSource Methods
9394
@Override
9495
public long open(DataSpec dataSpec) throws IOException {
96+
Log.i(TAG, "Opening HTSP DataSource");
9597
mDataSpec = dataSpec;
9698

9799
try {
@@ -154,6 +156,7 @@ public Uri getUri() {
154156

155157
@Override
156158
public void close() throws IOException {
159+
Log.i(TAG, "Closing HTSP DataSource");
157160
mIsOpen = false;
158161

159162
mConnection.removeAuthenticationListener(mSubscriber);
@@ -166,20 +169,27 @@ public void close() throws IOException {
166169
// Subscription.Listener Methods
167170
@Override
168171
public void onSubscriptionStart(@NonNull HtspMessage message) {
172+
Log.d(TAG, "Received subscriptionStart");
169173
serializeMessageToBuffer(message);
170174
}
171175

172176
@Override
173177
public void onSubscriptionStatus(@NonNull HtspMessage message) {
178+
Log.d(TAG, "Received subscriptionStatus");
174179
serializeMessageToBuffer(message);
175180
}
176181

177182
@Override
178183
public void onSubscriptionStop(@NonNull HtspMessage message) {
179-
Log.i(TAG, "Received subscriptionStop");
184+
Log.d(TAG, "Received subscriptionStop");
180185
mIsOpen = false;
181186
}
182187

188+
@Override
189+
public void onQueueStatus(@NonNull HtspMessage htspMessage) {
190+
191+
}
192+
183193
@Override
184194
public void onMuxpkt(@NonNull HtspMessage message) {
185195
serializeMessageToBuffer(message);
@@ -204,7 +214,7 @@ private void serializeMessageToBuffer(@NonNull HtspMessage message) {
204214
mBuffer.flip();
205215
} catch (IOException e) {
206216
// Ignore?
207-
Log.w(TAG, "IOException", e);
217+
Log.w(TAG, "Caught IOException, ignoring", e);
208218
} finally {
209219
mLock.unlock();
210220
try {

app/src/main/java/ie/macinnes/tvheadend/player/HtspExtractor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public boolean sniff(ExtractorInput input) throws IOException, InterruptedExcept
9494

9595
@Override
9696
public void init(ExtractorOutput output) {
97+
Log.i(TAG, "Initializing HTSP Extractor");
9798
mOutput = output;
9899
mOutput.seekMap(new HtspSeekMap());
99100
}
@@ -120,9 +121,7 @@ public int read(ExtractorInput input, PositionHolder seekPosition) throws IOExce
120121
Log.w(TAG, "Class Not Found");
121122
} finally {
122123
try {
123-
if (inputStream != null) {
124-
inputStream.close();
125-
}
124+
inputStream.close();
126125
} catch (IOException ex) {
127126
// Ignore
128127
}
@@ -140,11 +139,12 @@ public int read(ExtractorInput input, PositionHolder seekPosition) throws IOExce
140139

141140
@Override
142141
public void seek(long position, long timeUs) {
143-
142+
Log.d(TAG, "Seeking HTSP Extractor");
144143
}
145144

146145
@Override
147146
public void release() {
147+
Log.i(TAG, "Releasing HTSP Extractor");
148148
mStreamReaders.clear();
149149
}
150150

app/src/main/java/ie/macinnes/tvheadend/tvinput/ExoPlayerSession.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ protected boolean playChannel(int tvhChannelId) {
107107
// Stop any existing playback
108108
stopPlayback();
109109

110+
Log.i(TAG, "Start playback of channel");
111+
110112
SharedPreferences sharedPreferences = mContext.getSharedPreferences(
111113
Constants.PREFERENCE_TVHEADEND, Context.MODE_PRIVATE);
112114

@@ -126,6 +128,7 @@ protected boolean playChannel(int tvhChannelId) {
126128

127129
@Override
128130
protected void stopPlayback() {
131+
Log.i(TAG, "Stopping playback of channel");
129132
mExoPlayer.stop();
130133

131134
if (mMediaSource != null) {

0 commit comments

Comments
 (0)