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

Side by Side Diff: content/renderer/media/webmediaplayer_ms.h

Issue 2985393002: Revert of Make rendering of MediaStreams reflect changes to its set of tracks. (Closed)
Patch Set: Created 3 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "content/renderer/media/media_stream.h"
18 #include "media/blink/webmediaplayer_delegate.h" 17 #include "media/blink/webmediaplayer_delegate.h"
19 #include "media/blink/webmediaplayer_util.h" 18 #include "media/blink/webmediaplayer_util.h"
20 #include "media/renderers/gpu_video_accelerator_factories.h" 19 #include "media/renderers/gpu_video_accelerator_factories.h"
21 #include "media/renderers/skcanvas_video_renderer.h" 20 #include "media/renderers/skcanvas_video_renderer.h"
22 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 21 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
23 #include "url/origin.h" 22 #include "url/origin.h"
24 23
25 namespace blink { 24 namespace blink {
26 class WebLocalFrame; 25 class WebLocalFrame;
27 class WebMediaPlayerClient; 26 class WebMediaPlayerClient;
(...skipping 28 matching lines...) Expand all
56 // Renderer process. 55 // Renderer process.
57 // 56 //
58 // WebMediaPlayerMS works with multiple objects, the most important ones are: 57 // WebMediaPlayerMS works with multiple objects, the most important ones are:
59 // 58 //
60 // MediaStreamVideoRenderer 59 // MediaStreamVideoRenderer
61 // provides video frames for rendering. 60 // provides video frames for rendering.
62 // 61 //
63 // blink::WebMediaPlayerClient 62 // blink::WebMediaPlayerClient
64 // WebKit client of this media player object. 63 // WebKit client of this media player object.
65 class CONTENT_EXPORT WebMediaPlayerMS 64 class CONTENT_EXPORT WebMediaPlayerMS
66 : public NON_EXPORTED_BASE(MediaStreamObserver), 65 : public NON_EXPORTED_BASE(blink::WebMediaPlayer),
67 public NON_EXPORTED_BASE(blink::WebMediaPlayer),
68 public NON_EXPORTED_BASE(media::WebMediaPlayerDelegate::Observer), 66 public NON_EXPORTED_BASE(media::WebMediaPlayerDelegate::Observer),
69 public NON_EXPORTED_BASE(base::SupportsWeakPtr<WebMediaPlayerMS>) { 67 public NON_EXPORTED_BASE(base::SupportsWeakPtr<WebMediaPlayerMS>) {
70 public: 68 public:
71 // Construct a WebMediaPlayerMS with reference to the client, and 69 // Construct a WebMediaPlayerMS with reference to the client, and
72 // a MediaStreamClient which provides MediaStreamVideoRenderer. 70 // a MediaStreamClient which provides MediaStreamVideoRenderer.
73 // |delegate| must not be null. 71 // |delegate| must not be null.
74 WebMediaPlayerMS( 72 WebMediaPlayerMS(
75 blink::WebLocalFrame* frame, 73 blink::WebLocalFrame* frame,
76 blink::WebMediaPlayerClient* client, 74 blink::WebMediaPlayerClient* client,
77 media::WebMediaPlayerDelegate* delegate, 75 media::WebMediaPlayerDelegate* delegate,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 int level, 172 int level,
175 int internalformat, 173 int internalformat,
176 unsigned format, 174 unsigned format,
177 unsigned type, 175 unsigned type,
178 int xoffset, 176 int xoffset,
179 int yoffset, 177 int yoffset,
180 int zoffset, 178 int zoffset,
181 bool flip_y, 179 bool flip_y,
182 bool premultiply_alpha) override; 180 bool premultiply_alpha) override;
183 181
184 // MediaStreamObserver implementation
185 void TrackAdded(const blink::WebMediaStreamTrack& track) override;
186 void TrackRemoved(const blink::WebMediaStreamTrack& track) override;
187
188 private: 182 private:
189 friend class WebMediaPlayerMSTest; 183 friend class WebMediaPlayerMSTest;
190 184
191 void OnFirstFrameReceived(media::VideoRotation video_rotation, 185 void OnFirstFrameReceived(media::VideoRotation video_rotation,
192 bool is_opaque); 186 bool is_opaque);
193 void OnOpacityChanged(bool is_opaque); 187 void OnOpacityChanged(bool is_opaque);
194 void OnRotationChanged(media::VideoRotation video_rotation, bool is_opaque); 188 void OnRotationChanged(media::VideoRotation video_rotation, bool is_opaque);
195 189
196 // Need repaint due to state change. 190 // Need repaint due to state change.
197 void RepaintInternal(); 191 void RepaintInternal();
198 192
199 // The callback for source to report error. 193 // The callback for source to report error.
200 void OnSourceError(); 194 void OnSourceError();
201 195
202 // Helpers that set the network/ready state and notifies the client if 196 // Helpers that set the network/ready state and notifies the client if
203 // they've changed. 197 // they've changed.
204 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); 198 void SetNetworkState(blink::WebMediaPlayer::NetworkState state);
205 void SetReadyState(blink::WebMediaPlayer::ReadyState state); 199 void SetReadyState(blink::WebMediaPlayer::ReadyState state);
206 200
207 // Getter method to |client_|. 201 // Getter method to |client_|.
208 blink::WebMediaPlayerClient* get_client() { return client_; } 202 blink::WebMediaPlayerClient* get_client() { return client_; }
209 203
210 // To be run when tracks are added or removed.
211 void Reload();
212 void ReloadVideo();
213 void ReloadAudio();
214
215 blink::WebLocalFrame* const frame_; 204 blink::WebLocalFrame* const frame_;
216 205
217 blink::WebMediaPlayer::NetworkState network_state_; 206 blink::WebMediaPlayer::NetworkState network_state_;
218 blink::WebMediaPlayer::ReadyState ready_state_; 207 blink::WebMediaPlayer::ReadyState ready_state_;
219 208
220 const blink::WebTimeRanges buffered_; 209 const blink::WebTimeRanges buffered_;
221 210
222 blink::WebMediaPlayerClient* const client_; 211 blink::WebMediaPlayerClient* const client_;
223 212
224 // WebMediaPlayer notifies the |delegate_| of playback state changes using 213 // WebMediaPlayer notifies the |delegate_| of playback state changes using
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // The last volume received by setVolume() and the last volume multiplier from 259 // The last volume received by setVolume() and the last volume multiplier from
271 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less 260 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less
272 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) 261 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking)
273 // for a transient sound. Playout volume is derived by volume * multiplier. 262 // for a transient sound. Playout volume is derived by volume * multiplier.
274 double volume_; 263 double volume_;
275 double volume_multiplier_; 264 double volume_multiplier_;
276 265
277 // True if playback should be started upon the next call to OnShown(). Only 266 // True if playback should be started upon the next call to OnShown(). Only
278 // used on Android. 267 // used on Android.
279 bool should_play_upon_shown_; 268 bool should_play_upon_shown_;
280 blink::WebMediaStream web_stream_;
281 // IDs of the tracks currently played.
282 blink::WebString current_video_track_id_;
283 blink::WebString current_audio_track_id_;
284 269
285 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); 270 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS);
286 }; 271 };
287 272
288 } // namespace content 273 } // namespace content
289 274
290 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 275 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
OLDNEW
« no previous file with comments | « content/browser/webrtc/webrtc_getusermedia_browsertest.cc ('k') | content/renderer/media/webmediaplayer_ms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698