[media] Add error code to OnStreamFailed
In some situations, it is of value to provide an error code pertaining
to why a Stream might have failed. This CL updates OnStreamFailed to
include a StreamError error code. This is the second stage of the soft
transition and OnStreamFailed2 will remain until all clients have been
migrated to the new OnStreamFailed event.
Bug: 13691
Test: fx run-test stream_processor_lib_test
Test: fx run-test use_h264_decoder_test
Test: fx run-test audio_encoder_test
Change-Id: I13a5afba685a2f6c13ea9d1098f19d74dfb70c93
diff --git a/garnet/lib/media/codec_impl/codec_impl.cc b/garnet/lib/media/codec_impl/codec_impl.cc
index 95edd22..945ee3f 100644
--- a/garnet/lib/media/codec_impl/codec_impl.cc
+++ b/garnet/lib/media/codec_impl/codec_impl.cc
@@ -3038,7 +3038,7 @@
// See "is_bound_checks" comment up top.
if (binding_.is_bound()) {
// TODO(MTWN-411): Complete soft transition and only send one event.
- binding_.events().OnStreamFailed(stream_lifetime_ordinal);
+ binding_.events().OnStreamFailed(stream_lifetime_ordinal, error);
binding_.events().OnStreamFailed2(stream_lifetime_ordinal, error);
}
});
diff --git a/garnet/lib/media/codec_impl/unit_tests/test_decryptor_adapter.cc b/garnet/lib/media/codec_impl/unit_tests/test_decryptor_adapter.cc
index 554aba0..be8e1e4 100644
--- a/garnet/lib/media/codec_impl/unit_tests/test_decryptor_adapter.cc
+++ b/garnet/lib/media/codec_impl/unit_tests/test_decryptor_adapter.cc
@@ -139,7 +139,7 @@
input_collection_.set_error_handler([this](zx_status_t s) { input_collection_error_ = s; });
output_collection_.set_error_handler([this](zx_status_t s) { output_collection_error_ = s; });
- decryptor_.events().OnStreamFailed2 =
+ decryptor_.events().OnStreamFailed =
fit::bind_member(this, &DecryptorAdapterTest::OnStreamFailed);
decryptor_.events().OnInputConstraints =
fit::bind_member(this, &DecryptorAdapterTest::OnInputConstraints);
diff --git a/garnet/lib/media/test/codec_client.cc b/garnet/lib/media/test/codec_client.cc
index 25c6add..64a88c3 100644
--- a/garnet/lib/media/test/codec_client.cc
+++ b/garnet/lib/media/test/codec_client.cc
@@ -51,7 +51,7 @@
// We treat event setup as much as possible like a hidden part of creating the
// CodecPtr. If NewBinding() has !is_valid(), we rely on the Codec server to
// close the Codec channel async.
- codec_.events().OnStreamFailed2 = fit::bind_member(this, &CodecClient::OnStreamFailed);
+ codec_.events().OnStreamFailed = fit::bind_member(this, &CodecClient::OnStreamFailed);
codec_.events().OnInputConstraints = fit::bind_member(this, &CodecClient::OnInputConstraints);
codec_.events().OnFreeInputPacket = fit::bind_member(this, &CodecClient::OnFreeInputPacket);
codec_.events().OnOutputConstraints = fit::bind_member(this, &CodecClient::OnOutputConstraints);
diff --git a/sdk/fidl/fuchsia.media/fuchsia.media.api b/sdk/fidl/fuchsia.media/fuchsia.media.api
index cadcad2..f8a64c6 100644
--- a/sdk/fidl/fuchsia.media/fuchsia.media.api
+++ b/sdk/fidl/fuchsia.media/fuchsia.media.api
@@ -7,7 +7,7 @@
"fidl/fuchsia.media/metadata.fidl": "fb11fd050505ea7a8fc661754b044012",
"fidl/fuchsia.media/stream.fidl": "3448eded0321f9308535708fa2ed53a1",
"fidl/fuchsia.media/stream_common.fidl": "94f8089f2e58955d82560b6ef74247c3",
- "fidl/fuchsia.media/stream_processor.fidl": "396fe28a914c0786bdcc9d88663fb67b",
+ "fidl/fuchsia.media/stream_processor.fidl": "3bebf793dd1678813002414c703d6281",
"fidl/fuchsia.media/stream_type.fidl": "51b26d41607bec6c23b7335de736c756",
"fidl/fuchsia.media/timeline_function.fidl": "10e9c5225e1b4596150724cf45d2a8a4"
}
\ No newline at end of file
diff --git a/sdk/fidl/fuchsia.media/stream_processor.fidl b/sdk/fidl/fuchsia.media/stream_processor.fidl
index f8042a0..034b6319 100644
--- a/sdk/fidl/fuchsia.media/stream_processor.fidl
+++ b/sdk/fidl/fuchsia.media/stream_processor.fidl
@@ -1061,7 +1061,7 @@
// No further messages will arrive from the server regarding the failed
// stream. This includes any OnOutputEndOfStream() that the client would
// have otherwise expected.
- -> OnStreamFailed(uint64 stream_lifetime_ordinal);
+ -> OnStreamFailed(uint64 stream_lifetime_ordinal, StreamError error);
-> OnStreamFailed2(uint64 stream_lifetime_ordinal, StreamError error);
// OnInputConstraints()
diff --git a/src/media/playback/mediaplayer/fidl/fidl_decoder.cc b/src/media/playback/mediaplayer/fidl/fidl_decoder.cc
index d1a3116..e345608 100644
--- a/src/media/playback/mediaplayer/fidl/fidl_decoder.cc
+++ b/src/media/playback/mediaplayer/fidl/fidl_decoder.cc
@@ -59,7 +59,7 @@
outboard_decoder_.set_error_handler(fit::bind_member(this, &FidlDecoder::OnConnectionFailed));
- outboard_decoder_.events().OnStreamFailed2 = fit::bind_member(this, &FidlDecoder::OnStreamFailed);
+ outboard_decoder_.events().OnStreamFailed = fit::bind_member(this, &FidlDecoder::OnStreamFailed);
outboard_decoder_.events().OnInputConstraints =
fit::bind_member(this, &FidlDecoder::OnInputConstraints);
outboard_decoder_.events().OnOutputConstraints =