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

Side by Side Diff: webkit/media/webmediaplayer_impl.cc

Issue 10662030: WebMediaPlayerImpl needs to own the audio source provider. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "webkit/media/webmediaplayer_impl.h" 5 #include "webkit/media/webmediaplayer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 return result; 101 return result;
102 } 102 }
103 103
104 WebMediaPlayerImpl::WebMediaPlayerImpl( 104 WebMediaPlayerImpl::WebMediaPlayerImpl(
105 WebKit::WebFrame* frame, 105 WebKit::WebFrame* frame,
106 WebKit::WebMediaPlayerClient* client, 106 WebKit::WebMediaPlayerClient* client,
107 base::WeakPtr<WebMediaPlayerDelegate> delegate, 107 base::WeakPtr<WebMediaPlayerDelegate> delegate,
108 media::FilterCollection* collection, 108 media::FilterCollection* collection,
109 WebKit::WebAudioSourceProvider* audio_source_provider, 109 WebKit::WebAudioSourceProvider* audio_source_provider,
110 media::AudioRendererSink* audio_renderer_sink,
110 media::MessageLoopFactory* message_loop_factory, 111 media::MessageLoopFactory* message_loop_factory,
111 MediaStreamClient* media_stream_client, 112 MediaStreamClient* media_stream_client,
112 media::MediaLog* media_log) 113 media::MediaLog* media_log)
113 : frame_(frame), 114 : frame_(frame),
114 network_state_(WebMediaPlayer::NetworkStateEmpty), 115 network_state_(WebMediaPlayer::NetworkStateEmpty),
115 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), 116 ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
116 main_loop_(MessageLoop::current()), 117 main_loop_(MessageLoop::current()),
117 filter_collection_(collection), 118 filter_collection_(collection),
118 started_(false), 119 started_(false),
119 message_loop_factory_(message_loop_factory), 120 message_loop_factory_(message_loop_factory),
120 paused_(true), 121 paused_(true),
121 seeking_(false), 122 seeking_(false),
122 playback_rate_(0.0f), 123 playback_rate_(0.0f),
123 pending_seek_(false), 124 pending_seek_(false),
124 pending_seek_seconds_(0.0f), 125 pending_seek_seconds_(0.0f),
125 client_(client), 126 client_(client),
126 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)), 127 proxy_(new WebMediaPlayerProxy(main_loop_->message_loop_proxy(), this)),
127 delegate_(delegate), 128 delegate_(delegate),
128 media_stream_client_(media_stream_client), 129 media_stream_client_(media_stream_client),
129 media_log_(media_log), 130 media_log_(media_log),
130 accelerated_compositing_reported_(false), 131 accelerated_compositing_reported_(false),
131 incremented_externally_allocated_memory_(false), 132 incremented_externally_allocated_memory_(false),
132 audio_source_provider_(audio_source_provider), 133 audio_source_provider_(audio_source_provider),
134 audio_renderer_sink_(audio_renderer_sink),
133 is_local_source_(false) { 135 is_local_source_(false) {
134 media_log_->AddEvent( 136 media_log_->AddEvent(
scherkus (not reviewing) 2012/07/09 23:13:23 can you DCHECK_EQ() that the two pointers are equa
Raymond Toy 2012/07/10 02:51:39 No, I can't do that because they're pointers deriv
scherkus (not reviewing) 2012/07/10 17:13:51 Right -- that makes sense :\
135 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 137 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
136 138
137 MessageLoop* pipeline_message_loop = 139 MessageLoop* pipeline_message_loop =
138 message_loop_factory_->GetMessageLoop("PipelineThread"); 140 message_loop_factory_->GetMessageLoop("PipelineThread");
139 pipeline_ = new media::Pipeline(pipeline_message_loop, media_log_); 141 pipeline_ = new media::Pipeline(pipeline_message_loop, media_log_);
140 142
141 // Let V8 know we started new thread if we did not did it yet. 143 // Let V8 know we started new thread if we did not did it yet.
142 // Made separate task to avoid deletion of player currently being created. 144 // Made separate task to avoid deletion of player currently being created.
143 // Also, delaying GC until after player starts gets rid of starting lag -- 145 // Also, delaying GC until after player starts gets rid of starting lag --
144 // collection happens in parallel with playing. 146 // collection happens in parallel with playing.
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 return audio_source_provider_; 1023 return audio_source_provider_;
1022 } 1024 }
1023 1025
1024 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { 1026 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() {
1025 DCHECK_EQ(main_loop_, MessageLoop::current()); 1027 DCHECK_EQ(main_loop_, MessageLoop::current());
1026 incremented_externally_allocated_memory_ = true; 1028 incremented_externally_allocated_memory_ = true;
1027 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); 1029 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory);
1028 } 1030 }
1029 1031
1030 } // namespace webkit_media 1032 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698