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

Unified Diff: media/cast/video_receiver/codecs/vp8/vp8_decoder.cc

Issue 80383006: Cast: Forcing codec initialization on a designated thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: media/cast/video_receiver/codecs/vp8/vp8_decoder.cc
diff --git a/media/cast/video_receiver/codecs/vp8/vp8_decoder.cc b/media/cast/video_receiver/codecs/vp8/vp8_decoder.cc
index 84d4fa9d5588ff18dead29733561de17e37e038e..4c7db288fe71de170c458a0253cac2e2842417a8 100644
--- a/media/cast/video_receiver/codecs/vp8/vp8_decoder.cc
+++ b/media/cast/video_receiver/codecs/vp8/vp8_decoder.cc
@@ -12,18 +12,16 @@
namespace media {
namespace cast {
-Vp8Decoder::Vp8Decoder(int number_of_cores,
- scoped_refptr<CastEnvironment> cast_environment)
+Vp8Decoder::Vp8Decoder(scoped_refptr<CastEnvironment> cast_environment)
: decoder_(new vpx_dec_ctx_t()),
- cast_environment_(cast_environment) {
- InitDecode(number_of_cores);
-}
+ cast_environment_(cast_environment) {}
Vp8Decoder::~Vp8Decoder() {}
-void Vp8Decoder::InitDecode(int number_of_cores) {
- vpx_codec_dec_cfg_t cfg;
- cfg.threads = number_of_cores;
+void Vp8Decoder::InitDecoder() {
+ vpx_codec_dec_cfg_t cfg;
+ // Initializing to use one core.
+ cfg.threads = 1;
vpx_codec_flags_t flags = VPX_CODEC_USE_POSTPROC;
if (vpx_codec_dec_init(decoder_.get(), vpx_codec_vp8_dx(), &cfg, flags)) {
@@ -34,6 +32,7 @@ void Vp8Decoder::InitDecode(int number_of_cores) {
bool Vp8Decoder::Decode(const EncodedVideoFrame* encoded_frame,
const base::TimeTicks render_time,
const VideoFrameDecodedCallback& frame_decoded_cb) {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::VIDEO_DECODER));
const int frame_id_int = static_cast<int>(encoded_frame->frame_id);
VLOG(1) << "VP8 decode frame:" << frame_id_int
<< " sized:" << encoded_frame->data.size();
@@ -84,10 +83,7 @@ bool Vp8Decoder::Decode(const EncodedVideoFrame* encoded_frame,
memcpy(decoded_frame->v_plane.data, img->planes[VPX_PLANE_V],
decoded_frame->v_plane.length);
- cast_environment_->Logging()->InsertFrameEvent(kVideoFrameDecoded,
- kFrameIdUnknown, encoded_frame->frame_id);
VLOG(1) << "Decoded frame " << frame_id_int;
-
// Frame decoded - return frame to the user via callback.
cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
base::Bind(frame_decoded_cb, base::Passed(&decoded_frame), render_time));

Powered by Google App Engine
This is Rietveld 408576698