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

Side by Side Diff: content/renderer/pepper/video_decoder_shim.cc

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/renderer/pepper/video_decoder_shim.h" 5 #include "content/renderer/pepper/video_decoder_shim.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 #include <utility> 10 #include <utility>
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 650
651 private: 651 private:
652 void OnInitDone(bool success); 652 void OnInitDone(bool success);
653 void DoDecode(); 653 void DoDecode();
654 void OnDecodeComplete(media::DecodeStatus status); 654 void OnDecodeComplete(media::DecodeStatus status);
655 void OnOutputComplete(const scoped_refptr<media::VideoFrame>& frame); 655 void OnOutputComplete(const scoped_refptr<media::VideoFrame>& frame);
656 void OnResetComplete(); 656 void OnResetComplete();
657 657
658 // WeakPtr is bound to main_message_loop_. Use only in shim callbacks. 658 // WeakPtr is bound to main_message_loop_. Use only in shim callbacks.
659 base::WeakPtr<VideoDecoderShim> shim_; 659 base::WeakPtr<VideoDecoderShim> shim_;
660 media::MediaLog media_log_;
660 std::unique_ptr<media::VideoDecoder> decoder_; 661 std::unique_ptr<media::VideoDecoder> decoder_;
661 bool initialized_ = false; 662 bool initialized_ = false;
662 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 663 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
663 // Queue of decodes waiting for the decoder. 664 // Queue of decodes waiting for the decoder.
664 typedef std::queue<PendingDecode> PendingDecodeQueue; 665 typedef std::queue<PendingDecode> PendingDecodeQueue;
665 PendingDecodeQueue pending_decodes_; 666 PendingDecodeQueue pending_decodes_;
666 bool awaiting_decoder_ = false; 667 bool awaiting_decoder_ = false;
667 // VideoDecoder returns pictures without information about the decode buffer 668 // VideoDecoder returns pictures without information about the decode buffer
668 // that generated it, but VideoDecoder implementations used in this class 669 // that generated it, but VideoDecoder implementations used in this class
669 // (media::FFmpegVideoDecoder and media::VpxVideoDecoder) always generate 670 // (media::FFmpegVideoDecoder and media::VpxVideoDecoder) always generate
(...skipping 20 matching lines...) Expand all
690 DCHECK(!decoder_); 691 DCHECK(!decoder_);
691 #if !defined(MEDIA_DISABLE_LIBVPX) 692 #if !defined(MEDIA_DISABLE_LIBVPX)
692 if (config.codec() == media::kCodecVP9) { 693 if (config.codec() == media::kCodecVP9) {
693 decoder_.reset(new media::VpxVideoDecoder()); 694 decoder_.reset(new media::VpxVideoDecoder());
694 } else 695 } else
695 #endif 696 #endif
696 697
697 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_VIDEO_DECODERS) 698 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_VIDEO_DECODERS)
698 { 699 {
699 std::unique_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder( 700 std::unique_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder(
700 new media::FFmpegVideoDecoder( 701 new media::FFmpegVideoDecoder(&media_log_));
701 make_scoped_refptr(new media::MediaLog())));
702 ffmpeg_video_decoder->set_decode_nalus(true); 702 ffmpeg_video_decoder->set_decode_nalus(true);
703 decoder_ = std::move(ffmpeg_video_decoder); 703 decoder_ = std::move(ffmpeg_video_decoder);
704 } 704 }
705 #elif defined(MEDIA_DISABLE_LIBVPX) 705 #elif defined(MEDIA_DISABLE_LIBVPX)
706 OnInitDone(false); 706 OnInitDone(false);
707 return; 707 return;
708 #endif 708 #endif
709 709
710 // VpxVideoDecoder and FFmpegVideoDecoder support only one pending Decode() 710 // VpxVideoDecoder and FFmpegVideoDecoder support only one pending Decode()
711 // request. 711 // request.
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { 1120 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) {
1121 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); 1121 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL();
1122 gles2->DeleteTextures(1, &texture_id); 1122 gles2->DeleteTextures(1, &texture_id);
1123 } 1123 }
1124 1124
1125 void VideoDecoderShim::FlushCommandBuffer() { 1125 void VideoDecoderShim::FlushCommandBuffer() {
1126 context_provider_->ContextGL()->Flush(); 1126 context_provider_->ContextGL()->Flush();
1127 } 1127 }
1128 1128
1129 } // namespace content 1129 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698