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

Unified Diff: remoting/client/software_video_renderer.cc

Issue 2088953004: Fix VideoDecoderVpx to use pixel format the consumer wants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/codec/video_decoder.h » ('j') | remoting/codec/video_decoder.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/software_video_renderer.cc
diff --git a/remoting/client/software_video_renderer.cc b/remoting/client/software_video_renderer.cc
index 0bb2f03b5615a70bf5ac89a94fe0d7eb46172981..4401f31e6f171049f1225f4e73618b97292eb485 100644
--- a/remoting/client/software_video_renderer.cc
+++ b/remoting/client/software_video_renderer.cc
@@ -31,35 +31,6 @@ namespace remoting {
namespace {
-// This class wraps a VideoDecoder and byte-swaps the pixels for compatibility
-// with the android.graphics.Bitmap class.
-// TODO(lambroslambrou): Refactor so that the VideoDecoder produces data
-// in the right byte-order, instead of swapping it here.
-class RgbToBgrVideoDecoderFilter : public VideoDecoder {
- public:
- RgbToBgrVideoDecoderFilter(std::unique_ptr<VideoDecoder> parent)
- : parent_(std::move(parent)) {}
-
- bool DecodePacket(const VideoPacket& packet,
- webrtc::DesktopFrame* frame) override {
- if (!parent_->DecodePacket(packet, frame))
- return false;
- for (webrtc::DesktopRegion::Iterator i(frame->updated_region());
- !i.IsAtEnd(); i.Advance()) {
- webrtc::DesktopRect rect = i.rect();
- uint8_t* pixels = frame->data() + (rect.top() * frame->stride()) +
- (rect.left() * webrtc::DesktopFrame::kBytesPerPixel);
- libyuv::ABGRToARGB(pixels, frame->stride(), pixels, frame->stride(),
- rect.width(), rect.height());
- }
-
- return true;
- }
-
- private:
- std::unique_ptr<VideoDecoder> parent_;
-};
-
std::unique_ptr<webrtc::DesktopFrame> DoDecodeFrame(
VideoDecoder* decoder,
std::unique_ptr<VideoPacket> packet,
@@ -101,10 +72,10 @@ void SoftwareVideoRenderer::OnSessionConfig(
NOTREACHED() << "Invalid Encoding found: " << codec;
}
- if (consumer_->GetPixelFormat() == protocol::FrameConsumer::FORMAT_RGBA) {
- decoder_ =
- base::WrapUnique(new RgbToBgrVideoDecoderFilter(std::move(decoder_)));
- }
+ decoder_->SetPixelFormat(
+ (consumer_->GetPixelFormat() == protocol::FrameConsumer::FORMAT_BGRA)
+ ? VideoDecoder::PixelFormat::BGRA
+ : VideoDecoder::PixelFormat::RGBA);
}
protocol::VideoStub* SoftwareVideoRenderer::GetVideoStub() {
« no previous file with comments | « no previous file | remoting/codec/video_decoder.h » ('j') | remoting/codec/video_decoder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698