MediaPlayerService: Reset the bytes written in AudioSink stop and flush

When playing in non-offloaded mode with gapless playback it is
necessary to reset AudioSink's bytes written on stop and flush
(e.g. seeking) so the frames written can be correctly retrieved
for the subsequent song in NuPlayer::Renderer::onAudioSinkChanged().

Without this change, seeks performed during playback will cause
a time position offset of the subsequent song in Play Music.

Bug: 21198655
Change-Id: I0fb6cc94b5a0ff106dc8a71571ed85d75fb00660
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 7c40121..2ba05c0 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -1744,12 +1744,14 @@
 void MediaPlayerService::AudioOutput::stop()
 {
     ALOGV("stop");
+    mBytesWritten = 0;
     if (mTrack != 0) mTrack->stop();
 }
 
 void MediaPlayerService::AudioOutput::flush()
 {
     ALOGV("flush");
+    mBytesWritten = 0;
     if (mTrack != 0) mTrack->flush();
 }