[Spice-devel] [PATCH 07/18] stream: minor simplification

Fabiano Fidêncio fidencio at redhat.com
Mon Nov 23 01:42:28 PST 2015


On Fri, Nov 20, 2015 at 3:55 PM, Fabiano Fidêncio <fabiano at fidencio.org> wrote:
> On Fri, Nov 20, 2015 at 12:17 PM, Frediano Ziglio <fziglio at redhat.com> wrote:
>> From: Marc-André Lureau <marcandre.lureau at gmail.com>
>>
>> ---
>>  server/red_worker.c |  2 +-
>>  server/stream.c     | 21 +++++++++++----------
>>  server/stream.h     |  3 +--
>>  3 files changed, 13 insertions(+), 13 deletions(-)
>>
>> diff --git a/server/red_worker.c b/server/red_worker.c
>> index 09ebc0d..ef27ebe 100644
>> --- a/server/red_worker.c
>> +++ b/server/red_worker.c
>> @@ -3918,7 +3918,7 @@ static void red_display_marshall_stream_end(RedChannelClient *rcc,
>>
>>      red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DESTROY, NULL);
>>      destroy.id = get_stream_id(DCC_TO_DC(dcc), agent->stream);
>> -    stream_agent_stop(dcc, agent);
>> +    stream_agent_stop(agent);
>>      spice_marshall_msg_display_stream_destroy(base_marshaller, &destroy);
>>  }
>>
>> diff --git a/server/stream.c b/server/stream.c
>> index 357c632..85136ea 100644
>> --- a/server/stream.c
>> +++ b/server/stream.c
>> @@ -596,8 +596,7 @@ static void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgen
>>      dcc->streams_max_latency = new_max_latency;
>>  }
>>
>> -static uint64_t red_stream_get_initial_bit_rate(DisplayChannelClient *dcc,
>> -                                                Stream *stream)
>> +static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, Stream *stream)
>>  {
>>      char *env_bit_rate_str;
>>      uint64_t bit_rate = 0;
>> @@ -644,7 +643,7 @@ static uint64_t red_stream_get_initial_bit_rate(DisplayChannelClient *dcc,
>>              stream->width * stream->height) / DCC_TO_DC(dcc)->streams_size_total;
>>  }
>>
>> -static uint32_t red_stream_mjpeg_encoder_get_roundtrip(void *opaque)
>> +static uint32_t get_roundtrip_ms(void *opaque)
>>  {
>>      StreamAgent *agent = opaque;
>>      int roundtrip;
>> @@ -664,14 +663,14 @@ static uint32_t red_stream_mjpeg_encoder_get_roundtrip(void *opaque)
>>      return roundtrip;
>>  }
>>
>> -static uint32_t red_stream_mjpeg_encoder_get_source_fps(void *opaque)
>> +static uint32_t get_source_fps(void *opaque)
>>  {
>>      StreamAgent *agent = opaque;
>>
>>      return agent->stream->input_fps;
>>  }
>>
>> -static void red_stream_update_client_playback_latency(void *opaque, uint32_t delay_ms)
>> +static void update_client_playback_delay(void *opaque, uint32_t delay_ms)
>>  {
>>      StreamAgent *agent = opaque;
>>      DisplayChannelClient *dcc = agent->dcc;
>> @@ -708,11 +707,11 @@ void dcc_create_stream(DisplayChannelClient *dcc, Stream *stream)
>>          MJpegEncoderRateControlCbs mjpeg_cbs;
>>          uint64_t initial_bit_rate;
>>
>> -        mjpeg_cbs.get_roundtrip_ms = red_stream_mjpeg_encoder_get_roundtrip;
>> -        mjpeg_cbs.get_source_fps = red_stream_mjpeg_encoder_get_source_fps;
>> -        mjpeg_cbs.update_client_playback_delay = red_stream_update_client_playback_latency;
>> +        mjpeg_cbs.get_roundtrip_ms = get_roundtrip_ms;
>> +        mjpeg_cbs.get_source_fps = get_source_fps;
>> +        mjpeg_cbs.update_client_playback_delay = update_client_playback_delay;
>>
>> -        initial_bit_rate = red_stream_get_initial_bit_rate(dcc, stream);
>> +        initial_bit_rate = get_initial_bit_rate(dcc, stream);
>>          agent->mjpeg_encoder = mjpeg_encoder_new(initial_bit_rate, &mjpeg_cbs, agent);
>>      } else {
>>          agent->mjpeg_encoder = mjpeg_encoder_new(0, NULL, NULL);
>> @@ -736,8 +735,10 @@ void dcc_create_stream(DisplayChannelClient *dcc, Stream *stream)
>>  #endif
>>  }
>>
>> -void stream_agent_stop(DisplayChannelClient *dcc, StreamAgent *agent)
>> +void stream_agent_stop(StreamAgent *agent)
>>  {
>> +    DisplayChannelClient *dcc = agent->dcc;
>> +
>>      dcc_update_streams_max_latency(dcc, agent);
>>      if (agent->mjpeg_encoder) {
>>          mjpeg_encoder_destroy(agent->mjpeg_encoder);
>> diff --git a/server/stream.h b/server/stream.h
>> index efe7ceb..7c589e4 100644
>> --- a/server/stream.h
>> +++ b/server/stream.h
>> @@ -152,8 +152,7 @@ void                  stream_maintenance                            (DisplayChan
>>  void                  stream_agent_unref                            (DisplayChannel *display,
>>                                                                       StreamAgent *agent);
>>  void                  stream_agent_stats_print                      (StreamAgent *agent);
>> -void                  stream_agent_stop                             (DisplayChannelClient *dcc,
>> -                                                                     StreamAgent *agent);
>> +void                  stream_agent_stop                             (StreamAgent *agent);
>>
>>  void detach_stream(DisplayChannel *display, Stream *stream, int detach_sized);
>>
>> --
>> 2.4.3
>>
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
> I split this patch in 3 small patches ...

Link to the patches:
http://lists.freedesktop.org/archives/spice-devel/2015-November/023998.html

>
> --
> Fabiano Fidêncio
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list