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

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

Issue 7584013: Log PipelineImpl events to MediaLog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase atop _and_diff_against_ 759001. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/glue/webmediaplayer_impl.h" 5 #include "webkit/glue/webmediaplayer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 paused_(true), 331 paused_(true),
332 seeking_(false), 332 seeking_(false),
333 playback_rate_(0.0f), 333 playback_rate_(0.0f),
334 client_(client), 334 client_(client),
335 proxy_(NULL), 335 proxy_(NULL),
336 media_stream_client_(media_stream_client), 336 media_stream_client_(media_stream_client),
337 media_log_(media_log) { 337 media_log_(media_log) {
338 // Saves the current message loop. 338 // Saves the current message loop.
339 DCHECK(!main_loop_); 339 DCHECK(!main_loop_);
340 main_loop_ = MessageLoop::current(); 340 main_loop_ = MessageLoop::current();
341 media_log_->AddEvent(media_log_->CreateEvent(media::MediaLogEvent::CREATING)); 341 media_log_->AddEvent(
342 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
342 } 343 }
343 344
344 bool WebMediaPlayerImpl::Initialize( 345 bool WebMediaPlayerImpl::Initialize(
345 WebKit::WebFrame* frame, 346 WebKit::WebFrame* frame,
346 bool use_simple_data_source, 347 bool use_simple_data_source,
347 scoped_refptr<WebVideoRenderer> web_video_renderer) { 348 scoped_refptr<WebVideoRenderer> web_video_renderer) {
348 MessageLoop* pipeline_message_loop = 349 MessageLoop* pipeline_message_loop =
349 message_loop_factory_->GetMessageLoop("PipelineThread"); 350 message_loop_factory_->GetMessageLoop("PipelineThread");
350 if (!pipeline_message_loop) { 351 if (!pipeline_message_loop) {
351 NOTREACHED() << "Could not start PipelineThread"; 352 NOTREACHED() << "Could not start PipelineThread";
352 return false; 353 return false;
353 } 354 }
354 355
355 pipeline_ = new media::PipelineImpl(pipeline_message_loop); 356 pipeline_ = new media::PipelineImpl(pipeline_message_loop, media_log_);
356 357
357 // Also we want to be notified of |main_loop_| destruction. 358 // Also we want to be notified of |main_loop_| destruction.
358 main_loop_->AddDestructionObserver(this); 359 main_loop_->AddDestructionObserver(this);
359 360
360 // Creates the proxy. 361 // Creates the proxy.
361 proxy_ = new Proxy(main_loop_, this); 362 proxy_ = new Proxy(main_loop_, this);
362 web_video_renderer->SetWebMediaPlayerImplProxy(proxy_); 363 web_video_renderer->SetWebMediaPlayerImplProxy(proxy_);
363 proxy_->SetVideoRenderer(web_video_renderer); 364 proxy_->SetVideoRenderer(web_video_renderer);
364 365
365 // Set our pipeline callbacks. 366 // Set our pipeline callbacks.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 filter_collection_->AddAudioDecoder(new media::FFmpegAudioDecoder( 421 filter_collection_->AddAudioDecoder(new media::FFmpegAudioDecoder(
421 message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); 422 message_loop_factory_->GetMessageLoop("AudioDecoderThread")));
422 filter_collection_->AddVideoDecoder(new media::FFmpegVideoDecoder( 423 filter_collection_->AddVideoDecoder(new media::FFmpegVideoDecoder(
423 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), NULL)); 424 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), NULL));
424 filter_collection_->AddAudioRenderer(new media::NullAudioRenderer()); 425 filter_collection_->AddAudioRenderer(new media::NullAudioRenderer());
425 426
426 return true; 427 return true;
427 } 428 }
428 429
429 WebMediaPlayerImpl::~WebMediaPlayerImpl() { 430 WebMediaPlayerImpl::~WebMediaPlayerImpl() {
431 Destroy();
430 media_log_->AddEvent( 432 media_log_->AddEvent(
431 media_log_->CreateEvent(media::MediaLogEvent::DESTROYING)); 433 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_DESTROYED));
432 Destroy();
433 434
434 // Finally tell the |main_loop_| we don't want to be notified of destruction 435 // Finally tell the |main_loop_| we don't want to be notified of destruction
435 // event. 436 // event.
436 if (main_loop_) { 437 if (main_loop_) {
437 main_loop_->RemoveDestructionObserver(this); 438 main_loop_->RemoveDestructionObserver(this);
438 } 439 }
439 } 440 }
440 441
441 void WebMediaPlayerImpl::load(const WebKit::WebURL& url) { 442 void WebMediaPlayerImpl::load(const WebKit::WebURL& url) {
442 DCHECK(MessageLoop::current() == main_loop_); 443 DCHECK(MessageLoop::current() == main_loop_);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // cause extra pre-rolling and will break servers without range request 512 // cause extra pre-rolling and will break servers without range request
512 // support. 513 // support.
513 // 514 //
514 // We still have to notify WebKit that time has changed otherwise 515 // We still have to notify WebKit that time has changed otherwise
515 // HTMLMediaElement gets into an inconsistent state. 516 // HTMLMediaElement gets into an inconsistent state.
516 if (pipeline_->GetCurrentTime().ToInternalValue() == 0 && seconds == 0) { 517 if (pipeline_->GetCurrentTime().ToInternalValue() == 0 && seconds == 0) {
517 GetClient()->timeChanged(); 518 GetClient()->timeChanged();
518 return; 519 return;
519 } 520 }
520 521
522 media_log_->AddEvent(media_log_->CreateSeekEvent(seconds));
523
521 base::TimeDelta seek_time = ConvertSecondsToTimestamp(seconds); 524 base::TimeDelta seek_time = ConvertSecondsToTimestamp(seconds);
522 525
523 // Update our paused time. 526 // Update our paused time.
524 if (paused_) { 527 if (paused_) {
525 paused_time_ = seek_time; 528 paused_time_ = seek_time;
526 } 529 }
527 530
528 seeking_ = true; 531 seeking_ = true;
529 532
530 proxy_->DemuxerFlush(); 533 proxy_->DemuxerFlush();
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 } 1049 }
1047 } 1050 }
1048 1051
1049 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { 1052 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() {
1050 DCHECK(MessageLoop::current() == main_loop_); 1053 DCHECK(MessageLoop::current() == main_loop_);
1051 DCHECK(client_); 1054 DCHECK(client_);
1052 return client_; 1055 return client_;
1053 } 1056 }
1054 1057
1055 } // namespace webkit_glue 1058 } // namespace webkit_glue
OLDNEW
« media/base/pipeline_impl_unittest.cc ('K') | « media/tools/player_x11/player_x11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698