Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #if !defined(MediaOmxDecoder_h_)
7 #define MediaOmxDecoder_h_
9 #include "base/basictypes.h"
10 #include "MediaDecoder.h"
11 #include "MediaOmxReader.h"
12 #include "AudioOffloadPlayerBase.h"
14 namespace mozilla {
16 class MediaOmxDecoder : public MediaDecoder
17 {
18 typedef android::MediaSource MediaSource;
19 public:
20 MediaOmxDecoder();
21 virtual MediaDecoder* Clone();
22 virtual MediaDecoderStateMachine* CreateStateMachine();
24 virtual void MetadataLoaded(int aChannels,
25 int aRate,
26 bool aHasAudio,
27 bool aHasVideo,
28 MetadataTags* aTags);
29 virtual void ChangeState(PlayState aState);
30 virtual void ApplyStateToStateMachine(PlayState aState);
31 virtual void SetVolume(double aVolume);
32 virtual void PlaybackPositionChanged();
33 virtual void UpdateReadyStateForData();
34 virtual void SetElementVisibility(bool aIsVisible);
35 virtual void SetCanOffloadAudio(bool aCanOffloadAudio);
36 virtual void AddOutputStream(ProcessedMediaStream* aStream,
37 bool aFinishWhenEnded);
38 virtual void SetPlaybackRate(double aPlaybackRate);
40 void AudioOffloadTearDown();
41 int64_t GetSeekTime() { return mRequestedSeekTarget.mTime; }
42 void ResetSeekTime() { mRequestedSeekTarget.Reset(); }
44 private:
45 void PauseStateMachine();
46 void ResumeStateMachine();
48 MediaOmxReader* mReader;
50 // Offloaded audio track
51 android::sp<MediaSource> mAudioTrack;
53 nsAutoPtr<AudioOffloadPlayerBase> mAudioOffloadPlayer;
55 // Set by MediaOmxReader to denote current track can be offloaded
56 bool mCanOffloadAudio;
58 // Set when offload playback of current track fails in the middle and need to
59 // fallback to state machine
60 bool mFallbackToStateMachine;
61 };
63 } // namespace mozilla
65 #endif