Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: webkit/media/android/media_source_delegate.h

Issue 14247018: Implement WebRTC in Chrome for TV (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WebRTC impl on Chrome for TV Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ 5 #ifndef WEBKIT_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_
6 #define WEBKIT_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ 6 #define WEBKIT_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 13 matching lines...) Expand all
24 struct MediaPlayerHostMsg_ReadFromDemuxerAck_Params; 24 struct MediaPlayerHostMsg_ReadFromDemuxerAck_Params;
25 } 25 }
26 26
27 namespace WebKit { 27 namespace WebKit {
28 class WebFrame; 28 class WebFrame;
29 class WebMediaSource; 29 class WebMediaSource;
30 } 30 }
31 31
32 namespace webkit_media { 32 namespace webkit_media {
33 33
34 class KeyHandlingDemuxer;
34 class ProxyDecryptor; 35 class ProxyDecryptor;
35 class WebMediaPlayerProxyAndroid; 36 class WebMediaPlayerProxyAndroid;
36 37
37 class MediaSourceDelegate : public media::DemuxerHost { 38 class MediaSourceDelegate : public media::DemuxerHost {
38 public: 39 public:
39 typedef base::Callback<void(WebKit::WebMediaPlayer::NetworkState)> 40 typedef base::Callback<void(WebKit::WebMediaPlayer::NetworkState)>
40 UpdateNetworkStateCB; 41 UpdateNetworkStateCB;
41 42
42 MediaSourceDelegate(WebKit::WebFrame* frame, 43 MediaSourceDelegate(WebMediaPlayerProxyAndroid* proxy,
43 WebKit::WebMediaPlayerClient* client,
44 WebMediaPlayerProxyAndroid* proxy,
45 int player_id, 44 int player_id,
46 media::MediaLog* media_log); 45 const UpdateNetworkStateCB& update_network_state_cb);
47 virtual ~MediaSourceDelegate(); 46 virtual ~MediaSourceDelegate();
48 47
49 void Initialize(scoped_ptr<WebKit::WebMediaSource> media_source, 48 void InitializeMediaSource(WebKit::WebFrame* frame,
50 const UpdateNetworkStateCB& update_network_state_cb); 49 WebKit::WebMediaPlayerClient* client,
50 WebKit::WebMediaSource* media_source,
51 media::MediaLog* media_log);
52
53 void InitializeMediaStream(media::Demuxer* demuxer);
51 54
52 const WebKit::WebTimeRanges& Buffered(); 55 const WebKit::WebTimeRanges& Buffered();
53 size_t DecodedFrameCount() const; 56 size_t DecodedFrameCount() const;
54 size_t DroppedFrameCount() const; 57 size_t DroppedFrameCount() const;
55 size_t AudioDecodedByteCount() const; 58 size_t AudioDecodedByteCount() const;
56 size_t VideoDecodedByteCount() const; 59 size_t VideoDecodedByteCount() const;
57 60
58 WebKit::WebMediaPlayer::MediaKeyException GenerateKeyRequest( 61 WebKit::WebMediaPlayer::MediaKeyException GenerateKeyRequest(
59 const WebKit::WebString& key_system, 62 const WebKit::WebString& key_system,
60 const unsigned char* init_data, 63 const unsigned char* init_data,
(...skipping 17 matching lines...) Expand all
78 81
79 private: 82 private:
80 // Methods inherited from DemuxerHost. 83 // Methods inherited from DemuxerHost.
81 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE; 84 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE;
82 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE; 85 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE;
83 virtual void AddBufferedTimeRange(base::TimeDelta start, 86 virtual void AddBufferedTimeRange(base::TimeDelta start,
84 base::TimeDelta end) OVERRIDE; 87 base::TimeDelta end) OVERRIDE;
85 virtual void SetDuration(base::TimeDelta duration) OVERRIDE; 88 virtual void SetDuration(base::TimeDelta duration) OVERRIDE;
86 virtual void OnDemuxerError(media::PipelineStatus status) OVERRIDE; 89 virtual void OnDemuxerError(media::PipelineStatus status) OVERRIDE;
87 90
88 // Callbacks for ChunkDemuxer & Decryptor. 91 // Callbacks for Demuxer
89 void OnDemuxerInitDone(media::PipelineStatus status); 92 void OnDemuxerInitDone(media::PipelineStatus status);
90 void OnDemuxerOpened();
91 void OnKeyAdded(const std::string& key_system, const std::string& session_id);
92 void OnKeyError(const std::string& key_system,
93 const std::string& session_id,
94 media::Decryptor::KeyError error_code,
95 int system_code);
96 void OnKeyMessage(const std::string& key_system,
97 const std::string& session_id,
98 const std::string& message,
99 const std::string& default_url);
100 void OnNeedKey(const std::string& key_system,
101 const std::string& type,
102 const std::string& session_id,
103 scoped_ptr<uint8[]> init_data,
104 int init_data_size);
105 void OnDecryptorReady(media::Decryptor*);
106 93
107 // Reads an access unit from the demuxer stream |stream| and stores it in 94 // Reads an access unit from the demuxer stream |stream| and stores it in
108 // the |index|th access unit in |params|. 95 // the |index|th access unit in |params|.
109 void ReadFromDemuxerStream( 96 void ReadFromDemuxerStream(
110 media::DemuxerStream* stream, 97 media::DemuxerStream* stream,
111 media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params* params, 98 media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params* params,
112 size_t index); 99 size_t index);
113 void OnBufferReady( 100 void OnBufferReady(
114 media::DemuxerStream* stream, 101 media::DemuxerStream* stream,
115 media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params* params, 102 media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params* params,
116 size_t index, 103 size_t index,
117 media::DemuxerStream::Status status, 104 media::DemuxerStream::Status status,
118 const scoped_refptr<media::DecoderBuffer>& buffer); 105 const scoped_refptr<media::DecoderBuffer>& buffer);
119 106
120 void NotifyDemuxerReady(const std::string& key_system); 107 void NotifyDemuxerReady(const std::string& key_system);
121 108
122 base::WeakPtrFactory<MediaSourceDelegate> weak_this_; 109 base::WeakPtrFactory<MediaSourceDelegate> weak_this_;
123 110
124 WebKit::WebMediaPlayerClient* const client_;
125 WebMediaPlayerProxyAndroid* proxy_; 111 WebMediaPlayerProxyAndroid* proxy_;
126 int player_id_; 112 int player_id_;
127 113
128 scoped_refptr<media::MediaLog> media_log_;
129 UpdateNetworkStateCB update_network_state_cb_; 114 UpdateNetworkStateCB update_network_state_cb_;
130 115
131 scoped_ptr<media::ChunkDemuxer> chunk_demuxer_; 116 scoped_ptr<KeyHandlingDemuxer> demuxer_;
132 scoped_ptr<WebKit::WebMediaSource> media_source_;
133 117
134 media::PipelineStatistics statistics_; 118 media::PipelineStatistics statistics_;
135 media::Ranges<base::TimeDelta> buffered_time_ranges_; 119 media::Ranges<base::TimeDelta> buffered_time_ranges_;
136 // Keep a list of buffered time ranges. 120 // Keep a list of buffered time ranges.
137 WebKit::WebTimeRanges buffered_web_time_ranges_; 121 WebKit::WebTimeRanges buffered_web_time_ranges_;
138 122
139 // The decryptor that manages decryption keys and decrypts encrypted frames.
140 scoped_ptr<ProxyDecryptor> decryptor_;
141
142 // The currently selected key system. Empty string means that no key system
143 // has been selected.
144 WebKit::WebString current_key_system_;
145
146 // Temporary for EME v0.1. In the future the init data type should be passed
147 // through GenerateKeyRequest() directly from WebKit.
148 std::string init_data_type_;
149
150 scoped_ptr<media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params> audio_params_; 123 scoped_ptr<media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params> audio_params_;
151 scoped_ptr<media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params> video_params_; 124 scoped_ptr<media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params> video_params_;
152 125
153 bool seeking_; 126 bool seeking_;
127 bool low_latency_mode_;
154 128
155 DISALLOW_COPY_AND_ASSIGN(MediaSourceDelegate); 129 DISALLOW_COPY_AND_ASSIGN(MediaSourceDelegate);
156 }; 130 };
157 131
158 } // namespace webkit_media 132 } // namespace webkit_media
159 #endif // WEBKIT_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ 133 #endif // WEBKIT_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_
160 134
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698