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

Unified Diff: media/mojo/services/mojo_decryptor_service.cc

Issue 1809903002: Reland "Update mojo Decryptor interface to support reusing shared memory" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add includes Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/mojo/services/mojo_decryptor_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/mojo_decryptor_service.cc
diff --git a/media/mojo/services/mojo_decryptor_service.cc b/media/mojo/services/mojo_decryptor_service.cc
index 07cb1cce67d09f719d2bb5b1ec5230427537fc1c..89c87bff48104e35674e2dc2ff7886b66c7e722a 100644
--- a/media/mojo/services/mojo_decryptor_service.cc
+++ b/media/mojo/services/mojo_decryptor_service.cc
@@ -4,8 +4,6 @@
#include "media/mojo/services/mojo_decryptor_service.h"
-#include <stdint.h>
-
#include <utility>
#include "base/bind.h"
@@ -18,6 +16,7 @@
#include "media/base/video_decoder_config.h"
#include "media/base/video_frame.h"
#include "media/mojo/common/media_type_converters.h"
+#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/interfaces/demuxer_stream.mojom.h"
namespace media {
@@ -112,6 +111,12 @@ void MojoDecryptorService::DeinitializeDecoder(
static_cast<media::Decryptor::StreamType>(stream_type));
}
+void MojoDecryptorService::ReleaseSharedBuffer(
+ mojo::ScopedSharedBufferHandle buffer,
+ uint64_t buffer_size) {
+ in_use_video_frames_.erase(buffer.get().value());
+}
+
void MojoDecryptorService::OnDecryptDone(
const DecryptCallback& callback,
media::Decryptor::Status status,
@@ -174,6 +179,15 @@ void MojoDecryptorService::OnVideoDecoded(
return;
}
+ // If |frame| has shared memory that will be passed back, keep a reference
+ // to it until the other side is done with the memory.
+ if (frame->storage_type() == VideoFrame::STORAGE_MOJO_SHARED_BUFFER) {
+ MojoSharedBufferVideoFrame* mojo_frame =
+ static_cast<MojoSharedBufferVideoFrame*>(frame.get());
+ in_use_video_frames_.insert(
+ std::make_pair(mojo_frame->Handle().value(), frame));
+ }
+
callback.Run(static_cast<Decryptor::Status>(status),
interfaces::VideoFrame::From(frame));
}
« no previous file with comments | « media/mojo/services/mojo_decryptor_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698